File tree 2 files changed +24
-3
lines changed
2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -1771,7 +1771,9 @@ func expandMasterAuth(configured interface{}) *containerBeta.MasterAuth {
1771
1771
func expandMasterAuthorizedNetworksConfig (configured interface {}) * containerBeta.MasterAuthorizedNetworksConfig {
1772
1772
l := configured .([]interface {})
1773
1773
if len (l ) == 0 {
1774
- return nil
1774
+ return & containerBeta.MasterAuthorizedNetworksConfig {
1775
+ Enabled : false ,
1776
+ }
1775
1777
}
1776
1778
result := & containerBeta.MasterAuthorizedNetworksConfig {
1777
1779
Enabled : true ,
@@ -1990,7 +1992,7 @@ func flattenMasterAuth(ma *containerBeta.MasterAuth) []map[string]interface{} {
1990
1992
}
1991
1993
1992
1994
func flattenMasterAuthorizedNetworksConfig (c * containerBeta.MasterAuthorizedNetworksConfig ) []map [string ]interface {} {
1993
- if c == nil {
1995
+ if c == nil || ! c . Enabled {
1994
1996
return nil
1995
1997
}
1996
1998
result := make (map [string ]interface {})
Original file line number Diff line number Diff line change @@ -390,6 +390,15 @@ func TestAccContainerCluster_withMasterAuthorizedNetworksConfig(t *testing.T) {
390
390
ImportState : true ,
391
391
ImportStateVerify : true ,
392
392
},
393
+ {
394
+ Config : testAccContainerCluster_removeMasterAuthorizedNetworksConfig (clusterName ),
395
+ },
396
+ {
397
+ ResourceName : "google_container_cluster.with_master_authorized_networks" ,
398
+ ImportStateIdPrefix : "us-central1-a/" ,
399
+ ImportState : true ,
400
+ ImportStateVerify : true ,
401
+ },
393
402
},
394
403
})
395
404
}
@@ -1463,7 +1472,7 @@ func testAccContainerCluster_withMasterAuthorizedNetworksConfig(clusterName stri
1463
1472
return fmt .Sprintf (`
1464
1473
resource "google_container_cluster" "with_master_authorized_networks" {
1465
1474
name = "%s"
1466
- zone = "us-central1-a"
1475
+ location = "us-central1-a"
1467
1476
initial_node_count = 1
1468
1477
1469
1478
master_authorized_networks_config {
@@ -1472,6 +1481,16 @@ resource "google_container_cluster" "with_master_authorized_networks" {
1472
1481
}` , clusterName , cidrBlocks )
1473
1482
}
1474
1483
1484
+ func testAccContainerCluster_removeMasterAuthorizedNetworksConfig (clusterName string ) string {
1485
+
1486
+ return fmt .Sprintf (`
1487
+ resource "google_container_cluster" "with_master_authorized_networks" {
1488
+ name = "%s"
1489
+ location = "us-central1-a"
1490
+ initial_node_count = 1
1491
+ }` , clusterName )
1492
+ }
1493
+
1475
1494
func testAccContainerCluster_regional (clusterName string ) string {
1476
1495
return fmt .Sprintf (`
1477
1496
resource "google_container_cluster" "regional" {
You can’t perform that action at this time.
0 commit comments