From 4de9c6617dcd7c0fb79821d6fe60375f42274479 Mon Sep 17 00:00:00 2001 From: Francis Liu Date: Sun, 3 Mar 2024 20:12:19 +0000 Subject: [PATCH] Suppress private_endpoint_subnetwork when master_ipv4_cidr_block is set --- .../services/container/resource_container_cluster.go.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 00a3f3aaab84..508589006b4b 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 @@ -1684,7 +1684,7 @@ func ResourceContainerCluster() *schema.Resource { Optional: true, ForceNew: true, AtLeastOneOf: privateClusterConfigKeys, - DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, + DiffSuppressFunc: containerClusterPrivateClusterConfigSuppress, Description: `Subnetwork in cluster's network where master's endpoint will be provisioned.`, }, "public_endpoint": { @@ -6387,6 +6387,10 @@ func containerClusterPrivateClusterConfigSuppress(k, old, new string, d *schema. return suppressNodes && !hasSubnet } else if k == "private_cluster_config.#" { return suppressEndpoint && suppressNodes && !hasSubnet && !hasGlobalAccessConfig + } else if k == "private_cluster_config.0.private_endpoint_subnetwork" { + // Suppress diffs in private_endpoint_subnetwork when master_ipv4_cidr_block is set + _, hasMasterCidr := d.GetOk("private_cluster_config.0.master_ipv4_cidr_block") + return hasMasterCidr || tpgresource.CompareSelfLinkOrResourceName(k, old, new, d) } return false }