Fix explicitly setting the default network + subnetwork in GKE (#3492)

Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
The Magician 2019-04-26 15:31:16 -07:00 committed by Riley Karson
parent 13b49cfcb0
commit 4688b0d33f
2 changed files with 11 additions and 0 deletions

View File

@ -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{

View File

@ -1416,6 +1416,9 @@ resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1-a"
initial_node_count = 3
network = "default"
subnetwork = "default"
}`, name)
}