Skip to content

Commit

Permalink
Fix explicitly setting the default network + subnetwork in GKE
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
rileykarson authored and modular-magician committed Apr 26, 2019
1 parent 13b49cf commit 4e6d398
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions google/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,14 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er
return err
}

// When parsing a subnetwork by name, we expect region or zone to be set.
// Users may have set location to either value, so set that value.
if isZone(location) {
d.Set("zone", location)
} else {
d.Set("region", location)
}

clusterName := d.Get("name").(string)

cluster := &containerBeta.Cluster{
Expand Down
3 changes: 3 additions & 0 deletions google/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,9 @@ resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1-a"
initial_node_count = 3
network = "default"
subnetwork = "default"
}`, name)
}

Expand Down

0 comments on commit 4e6d398

Please sign in to comment.