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_kubernetes_cluster - web_app_routing's dns_zone_ids property allows an empty list input #26747

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
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,22 @@ func TestAccKubernetesCluster_webAppRoutingWithMultipleDnsZone(t *testing.T) {
})
}

func TestAccKubernetesCluster_webAppRoutingWithEmptyDnsZone(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster", "test")
r := KubernetesClusterResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.webAppRoutingWitEmptyDnsZone(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("web_app_routing.0.web_app_routing_identity.#").HasValue("1"),
),
},
data.ImportStep(),
})
}

func TestAccKubernetesCluster_webAppRouting(t *testing.T) {
if !features.FourPointOhBeta() {
t.Skip("Skipping test in 4.0 as `dns_zone_id` is removed")
Expand Down Expand Up @@ -3339,6 +3355,43 @@ resource "azurerm_kubernetes_cluster" "test" {
`, data.Locations.Primary, data.RandomInteger)
}

func (KubernetesClusterResource) webAppRoutingWitEmptyDnsZone(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}

resource "azurerm_resource_group" "test" {
name = "acctestRG-aks-%[2]d"
location = "%[1]s"
}

resource "azurerm_kubernetes_cluster" "test" {
name = "acctestaks%[2]d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
dns_prefix = "acctestaks%[2]d"

default_node_pool {
name = "default"
node_count = 1
vm_size = "Standard_DS2_v2"
upgrade_settings {
max_surge = "10%%"
}
}

identity {
type = "SystemAssigned"
}

web_app_routing {
dns_zone_ids = []
}
}
`, data.Locations.Primary, data.RandomInteger)
}

func (KubernetesClusterResource) webAppRouting(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
Expand Down
2 changes: 0 additions & 2 deletions internal/services/containers/kubernetes_cluster_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,6 @@ func resourceKubernetesCluster() *pluginsdk.Resource {
"dns_zone_ids": {
Type: pluginsdk.TypeList,
Required: true,
MinItems: 1,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
ValidateFunc: validation.Any(
Expand Down Expand Up @@ -1745,7 +1744,6 @@ func resourceKubernetesCluster() *pluginsdk.Resource {
resource.Schema["web_app_routing"].Elem.(*pluginsdk.Resource).Schema["dns_zone_ids"] = &pluginsdk.Schema{
Type: pluginsdk.TypeList,
Optional: true,
MinItems: 1,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
ValidateFunc: validation.Any(
Expand Down
Loading