Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_data_factory - allow the git_url to be blank/empty #24879

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading