From 320e28c6e3fc85d9b8c420c9326e29e1dc8c97cd Mon Sep 17 00:00:00 2001 From: Emile Hofsink Date: Sun, 22 Sep 2024 19:56:57 +1000 Subject: [PATCH] Force recreate of cluster if cluster is Autopilot and additive_vpc_scope_dns_domain has changed --- .../services/container/resource_container_cluster.go.erb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb b/mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb index 4cdf23a8d97f..38c7a95651ca 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb @@ -6849,8 +6849,13 @@ func containerClusterAutopilotCustomizeDiff(_ context.Context, d *schema.Resourc if err := d.SetNew("networking_mode", "VPC_NATIVE"); err != nil { return err } - } - return nil + } + // Additive VPC Scope DNS domain is supported in Autopilot but only on creation. + // If additive_vpc_scope_dns_domain is changed and enable_autopilot is true, force recreation. + if d.HasChange("dns_config.0.additive_vpc_scope_dns_domain") && d.Get("enable_autopilot").(bool) { + return d.ForceNew("dns_config.0.additive_vpc_scope_dns_domain") + } + return nil } // node_version only applies to the default node pool, so it should conflict with remove_default_node_pool = true