Skip to content

Commit 536cc21

Browse files
committed
Add DNS_SCOPE_UNSPECIFIED back and fix diffs
1 parent ad2ff30 commit 536cc21

File tree

3 files changed

+47
-5
lines changed

3 files changed

+47
-5
lines changed

mmv1/third_party/terraform/services/container/resource_container_cluster.go.tmpl

+12-4
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,13 @@ func isBeenEnabled(_ context.Context, old, new, _ interface{}) bool {
192192
return false
193193
}
194194

195+
func suppressDiffForClusterDnsScope(k, o, n string, d *schema.ResourceData) bool {
196+
if o == "" && n == "DNS_SCOPE_UNSPECIFIED" {
197+
return true
198+
}
199+
return false
200+
}
201+
195202
func ResourceContainerCluster() *schema.Resource {
196203
return &schema.Resource{
197204
UseJSONNumber: true,
@@ -2205,10 +2212,11 @@ func ResourceContainerCluster() *schema.Resource {
22052212
Optional: true,
22062213
},
22072214
"cluster_dns_scope": {
2208-
Type: schema.TypeString,
2209-
ValidateFunc: validation.StringInSlice([]string{"CLUSTER_SCOPE", "VPC_SCOPE"}, false),
2210-
Description: `The scope of access to cluster DNS records.`,
2211-
Optional: true,
2215+
Type: schema.TypeString,
2216+
ValidateFunc: validation.StringInSlice([]string{"DNS_SCOPE_UNSPECIFIED", "CLUSTER_SCOPE", "VPC_SCOPE"}, false),
2217+
Description: `The scope of access to cluster DNS records.`,
2218+
Optional: true,
2219+
DiffSuppressFunc: suppressDiffForClusterDnsScope,
22122220
},
22132221
"cluster_dns_domain": {
22142222
Type: schema.TypeString,

mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl

+34
Original file line numberDiff line numberDiff line change
@@ -5206,6 +5206,40 @@ func TestAccContainerCluster_withDNSConfig(t *testing.T) {
52065206
})
52075207
}
52085208

5209+
func TestAccContainerCluster_withDNSConfigWithUnspecifiedScope(t *testing.T) {
5210+
t.Parallel()
5211+
5212+
clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10))
5213+
domainName := fmt.Sprintf("tf-test-domain-%s", acctest.RandString(t, 10))
5214+
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
5215+
subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)
5216+
acctest.VcrTest(t, resource.TestCase{
5217+
PreCheck: func() { acctest.AccTestPreCheck(t) },
5218+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
5219+
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
5220+
Steps: []resource.TestStep{
5221+
{
5222+
Config: testAccContainerCluster_basic(clusterName, networkName, subnetworkName),
5223+
},
5224+
{
5225+
ResourceName: "google_container_cluster.primary",
5226+
ImportState: true,
5227+
ImportStateVerify: true,
5228+
ImportStateVerifyIgnore: []string{"deletion_protection"},
5229+
},
5230+
{
5231+
Config: testAccContainerCluster_withDNSConfig(clusterName, "CLOUD_DNS", domainName, "DNS_SCOPE_UNSPECIFIED", networkName, subnetworkName),
5232+
},
5233+
{
5234+
ResourceName: "google_container_cluster.primary",
5235+
ImportState: true,
5236+
ImportStateVerify: true,
5237+
ImportStateVerifyIgnore: []string{"deletion_protection"},
5238+
},
5239+
},
5240+
})
5241+
}
5242+
52095243
func TestAccContainerCluster_withGatewayApiConfig(t *testing.T) {
52105244
t.Parallel()
52115245
clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10))

mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ linux_node_config {
14271427

14281428
* `cluster_dns` - (Optional) Which in-cluster DNS provider should be used. `PROVIDER_UNSPECIFIED` (default) or `PLATFORM_DEFAULT` or `CLOUD_DNS`.
14291429

1430-
* `cluster_dns_scope` - (Optional) The scope of access to cluster DNS records. `DNS_SCOPE_UNSPECIFIED` (default) or `CLUSTER_SCOPE` or `VPC_SCOPE`.
1430+
* `cluster_dns_scope` - (Optional) The scope of access to cluster DNS records. `DNS_SCOPE_UNSPECIFIED` or `CLUSTER_SCOPE` or `VPC_SCOPE`.
14311431

14321432
* `cluster_dns_domain` - (Optional) The suffix used for all cluster service records.
14331433

0 commit comments

Comments
 (0)