Skip to content

Commit

Permalink
azurerm_data_factory - allow the git_url to be blank/empty (hashicorp…
Browse files Browse the repository at this point in the history
…#24879)

* azurerm_data_factory - allow the git_url to be blank/empty

* update docs
  • Loading branch information
katbyte authored and rizkybiz committed Feb 21, 2024
1 parent e8bb996 commit 9ff23ad
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
5 changes: 2 additions & 3 deletions internal/services/datafactory/data_factory_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ func resourceDataFactory() *pluginsdk.Resource {
ValidateFunc: validation.StringIsNotEmpty,
},
"git_url": {
Type: pluginsdk.TypeString,
Required: true,
ValidateFunc: validation.StringIsNotEmpty,
Type: pluginsdk.TypeString,
Optional: true,
},
"repository_name": {
Type: pluginsdk.TypeString,
Expand Down
39 changes: 39 additions & 0 deletions internal/services/datafactory/data_factory_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ func TestAccDataFactory_github(t *testing.T) {
})
}

func TestAccDataFactory_githubEmpty(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_data_factory", "test")
r := DataFactoryResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
data.DisappearsStep(acceptance.DisappearsStepData{
Config: r.githubUrlEmpty,
TestResource: r,
}),
})
}

func TestAccDataFactory_publicNetworkDisabled(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_data_factory", "test")
r := DataFactoryResource{}
Expand Down Expand Up @@ -527,6 +539,33 @@ resource "azurerm_data_factory" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger)
}

func (DataFactoryResource) githubUrlEmpty(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-df-%d"
location = "%s"
}
resource "azurerm_data_factory" "test" {
name = "acctestDF%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
github_configuration {
repository_name = "terraform-provider-azurerm"
branch_name = "main"
root_folder = "/"
account_name = "acctestGH-%d"
publishing_enabled = false
}
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger)
}

func (DataFactoryResource) publicNetworkDisabled(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/data_factory.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ A `github_configuration` block exports the following:

- `branch_name` - The branch of the repository to get code from.

- `git_url` - The GitHub Enterprise host name.
- `git_url` - The GitHub repository url.

- `repository_name` - The name of the git repository.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/data_factory.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ A `github_configuration` block supports the following:

* `branch_name` - (Required) Specifies the branch of the repository to get code from.

* `git_url` - (Required) Specifies the GitHub Enterprise host name. For example: <https://github.mydomain.com>. Use <https://github.com> for open source repositories.
* `git_url` - (Optional) Specifies the GitHub Enterprise host name. For example: <https://github.mydomain.com>. Use <https://github.com> for open source repositories.

* `repository_name` - (Required) Specifies the name of the git repository.

Expand Down

0 comments on commit 9ff23ad

Please sign in to comment.