From b951305fc4b7e5477fca32d771336839309ce667 Mon Sep 17 00:00:00 2001 From: Emile Hofsink Date: Sun, 22 Sep 2024 13:29:31 +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