File tree 1 file changed +31
-1
lines changed
1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,16 @@ func TestAccContainerCluster_withNetworkPolicyEnabled(t *testing.T) {
146
146
),
147
147
},
148
148
{
149
- Config : testAccContainerCluster_withNetworkPolicyDisabled (clusterName ),
149
+ Config : testAccContainerCluster_withNetworkPolicyConfigDisabled (clusterName ),
150
+ Check : resource .ComposeTestCheckFunc (
151
+ testAccCheckContainerCluster (
152
+ "google_container_cluster.with_network_policy_enabled" ),
153
+ resource .TestCheckResourceAttr ("google_container_cluster.with_network_policy_enabled" ,
154
+ "addons_config.0.network_policy_config.0.disabled" , "true" ),
155
+ ),
156
+ },
157
+ {
158
+ Config : testAccContainerCluster_withNetworkPolicyConfigDisabled (clusterName ),
150
159
PlanOnly : true ,
151
160
ExpectNonEmptyPlan : false ,
152
161
},
@@ -1121,6 +1130,11 @@ resource "google_container_cluster" "with_network_policy_enabled" {
1121
1130
enabled = true
1122
1131
provider = "CALICO"
1123
1132
}
1133
+ addons_config {
1134
+ network_policy_config {
1135
+ disabled = false
1136
+ }
1137
+ }
1124
1138
}` , clusterName )
1125
1139
}
1126
1140
@@ -1144,6 +1158,22 @@ resource "google_container_cluster" "with_network_policy_enabled" {
1144
1158
}` , clusterName )
1145
1159
}
1146
1160
1161
+ func testAccContainerCluster_withNetworkPolicyConfigDisabled (clusterName string ) string {
1162
+ return fmt .Sprintf (`
1163
+ resource "google_container_cluster" "with_network_policy_enabled" {
1164
+ name = "%s"
1165
+ zone = "us-central1-a"
1166
+ initial_node_count = 1
1167
+
1168
+ network_policy = {}
1169
+ addons_config {
1170
+ network_policy_config {
1171
+ disabled = true
1172
+ }
1173
+ }
1174
+ }` , clusterName )
1175
+ }
1176
+
1147
1177
func testAccContainerCluster_withMasterAuthorizedNetworksConfig (clusterName string , cidrs []string ) string {
1148
1178
1149
1179
cidrBlocks := ""
You can’t perform that action at this time.
0 commit comments