Skip to content

Commit 1fb2e80

Browse files
author
Sébastien GLON
committed
test improvement
1 parent f0e705f commit 1fb2e80

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

google/resource_container_cluster.go

+8
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,14 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
933933
},
934934
}
935935
}
936+
937+
if c.NetworkPolicyConfig != nil {
938+
result["network_policy"] = []map[string]interface{}{
939+
{
940+
"disabled": c.NetworkPolicyConfig.Disabled,
941+
},
942+
}
943+
}
936944
return []map[string]interface{}{result}
937945
}
938946

google/resource_container_cluster_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func TestAccContainerCluster_withAddons(t *testing.T) {
7272
"google_container_cluster.primary"),
7373
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.http_load_balancing.0.disabled", "true"),
7474
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.kubernetes_dashboard.0.disabled", "true"),
75+
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.network_policy.0.disabled", "false"),
7576
),
7677
},
7778
{
@@ -82,6 +83,7 @@ func TestAccContainerCluster_withAddons(t *testing.T) {
8283
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.horizontal_pod_autoscaling.0.disabled", "true"),
8384
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.http_load_balancing.0.disabled", "false"),
8485
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.kubernetes_dashboard.0.disabled", "true"),
86+
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.kubernetes_dashboard.0.disabled", "true"),
8587
),
8688
},
8789
},
@@ -920,7 +922,7 @@ resource "google_container_cluster" "primary" {
920922
addons_config {
921923
http_load_balancing { disabled = true }
922924
kubernetes_dashboard { disabled = true }
923-
network_policy { disabled = true }
925+
network_policy { disabled = false }
924926
}
925927
}`, clusterName)
926928
}
@@ -936,7 +938,7 @@ resource "google_container_cluster" "primary" {
936938
http_load_balancing { disabled = false }
937939
kubernetes_dashboard { disabled = true }
938940
horizontal_pod_autoscaling { disabled = true }
939-
network_policy { disabled = false }
941+
network_policy { disabled = true }
940942
}
941943
}`, clusterName)
942944
}

0 commit comments

Comments
 (0)