Skip to content

Commit

Permalink
Merge pull request #362 from terraform-google-modules/bugfix/zonal-re…
Browse files Browse the repository at this point in the history
…gion

Compute region output for zonal clusters
  • Loading branch information
morgante committed Dec 3, 2019
2 parents 9132bbe + e11a822 commit bcc0960
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 42 deletions.
11 changes: 5 additions & 6 deletions autogen/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ locals {
{% endif %}

cluster_output_name = google_container_cluster.primary.name
cluster_output_location = google_container_cluster.primary.location
cluster_output_region = google_container_cluster.primary.region
cluster_output_regional_zones = google_container_cluster.primary.node_locations
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones
Expand Down Expand Up @@ -137,11 +135,12 @@ locals {
cluster_master_auth_list_layer1 = local.cluster_output_master_auth
cluster_master_auth_list_layer2 = local.cluster_master_auth_list_layer1[0]
cluster_master_auth_map = local.cluster_master_auth_list_layer2[0]
# cluster locals

cluster_location = google_container_cluster.primary.location
cluster_region = var.regional ? google_container_cluster.primary.region : join("-", slice(split("-", local.cluster_location), 0, 2))
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
cluster_location = local.cluster_output_location
cluster_region = local.cluster_output_region
cluster_zones = sort(local.cluster_output_zones)
cluster_endpoint = local.cluster_output_endpoint
cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"]
cluster_master_version = local.cluster_output_master_version
Expand Down
11 changes: 5 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ locals {


cluster_output_name = google_container_cluster.primary.name
cluster_output_location = google_container_cluster.primary.location
cluster_output_region = google_container_cluster.primary.region
cluster_output_regional_zones = google_container_cluster.primary.node_locations
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones
Expand All @@ -92,11 +90,12 @@ locals {
cluster_master_auth_list_layer1 = local.cluster_output_master_auth
cluster_master_auth_list_layer2 = local.cluster_master_auth_list_layer1[0]
cluster_master_auth_map = local.cluster_master_auth_list_layer2[0]
# cluster locals

cluster_location = google_container_cluster.primary.location
cluster_region = var.regional ? google_container_cluster.primary.region : join("-", slice(split("-", local.cluster_location), 0, 2))
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
cluster_location = local.cluster_output_location
cluster_region = local.cluster_output_region
cluster_zones = sort(local.cluster_output_zones)
cluster_endpoint = local.cluster_output_endpoint
cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"]
cluster_master_version = local.cluster_output_master_version
Expand Down
11 changes: 5 additions & 6 deletions modules/beta-private-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ locals {


cluster_output_name = google_container_cluster.primary.name
cluster_output_location = google_container_cluster.primary.location
cluster_output_region = google_container_cluster.primary.region
cluster_output_regional_zones = google_container_cluster.primary.node_locations
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones
Expand Down Expand Up @@ -123,11 +121,12 @@ locals {
cluster_master_auth_list_layer1 = local.cluster_output_master_auth
cluster_master_auth_list_layer2 = local.cluster_master_auth_list_layer1[0]
cluster_master_auth_map = local.cluster_master_auth_list_layer2[0]
# cluster locals

cluster_location = google_container_cluster.primary.location
cluster_region = var.regional ? google_container_cluster.primary.region : join("-", slice(split("-", local.cluster_location), 0, 2))
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
cluster_location = local.cluster_output_location
cluster_region = local.cluster_output_region
cluster_zones = sort(local.cluster_output_zones)
cluster_endpoint = local.cluster_output_endpoint
cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"]
cluster_master_version = local.cluster_output_master_version
Expand Down
11 changes: 5 additions & 6 deletions modules/beta-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ locals {


cluster_output_name = google_container_cluster.primary.name
cluster_output_location = google_container_cluster.primary.location
cluster_output_region = google_container_cluster.primary.region
cluster_output_regional_zones = google_container_cluster.primary.node_locations
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones
Expand Down Expand Up @@ -123,11 +121,12 @@ locals {
cluster_master_auth_list_layer1 = local.cluster_output_master_auth
cluster_master_auth_list_layer2 = local.cluster_master_auth_list_layer1[0]
cluster_master_auth_map = local.cluster_master_auth_list_layer2[0]
# cluster locals

cluster_location = google_container_cluster.primary.location
cluster_region = var.regional ? google_container_cluster.primary.region : join("-", slice(split("-", local.cluster_location), 0, 2))
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
cluster_location = local.cluster_output_location
cluster_region = local.cluster_output_region
cluster_zones = sort(local.cluster_output_zones)
cluster_endpoint = local.cluster_output_endpoint
cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"]
cluster_master_version = local.cluster_output_master_version
Expand Down
11 changes: 5 additions & 6 deletions modules/beta-public-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ locals {


cluster_output_name = google_container_cluster.primary.name
cluster_output_location = google_container_cluster.primary.location
cluster_output_region = google_container_cluster.primary.region
cluster_output_regional_zones = google_container_cluster.primary.node_locations
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones
Expand Down Expand Up @@ -123,11 +121,12 @@ locals {
cluster_master_auth_list_layer1 = local.cluster_output_master_auth
cluster_master_auth_list_layer2 = local.cluster_master_auth_list_layer1[0]
cluster_master_auth_map = local.cluster_master_auth_list_layer2[0]
# cluster locals

cluster_location = google_container_cluster.primary.location
cluster_region = var.regional ? google_container_cluster.primary.region : join("-", slice(split("-", local.cluster_location), 0, 2))
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
cluster_location = local.cluster_output_location
cluster_region = local.cluster_output_region
cluster_zones = sort(local.cluster_output_zones)
cluster_endpoint = local.cluster_output_endpoint
cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"]
cluster_master_version = local.cluster_output_master_version
Expand Down
11 changes: 5 additions & 6 deletions modules/private-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ locals {


cluster_output_name = google_container_cluster.primary.name
cluster_output_location = google_container_cluster.primary.location
cluster_output_region = google_container_cluster.primary.region
cluster_output_regional_zones = google_container_cluster.primary.node_locations
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones
Expand All @@ -92,11 +90,12 @@ locals {
cluster_master_auth_list_layer1 = local.cluster_output_master_auth
cluster_master_auth_list_layer2 = local.cluster_master_auth_list_layer1[0]
cluster_master_auth_map = local.cluster_master_auth_list_layer2[0]
# cluster locals

cluster_location = google_container_cluster.primary.location
cluster_region = var.regional ? google_container_cluster.primary.region : join("-", slice(split("-", local.cluster_location), 0, 2))
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
cluster_location = local.cluster_output_location
cluster_region = local.cluster_output_region
cluster_zones = sort(local.cluster_output_zones)
cluster_endpoint = local.cluster_output_endpoint
cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"]
cluster_master_version = local.cluster_output_master_version
Expand Down
11 changes: 5 additions & 6 deletions modules/private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ locals {


cluster_output_name = google_container_cluster.primary.name
cluster_output_location = google_container_cluster.primary.location
cluster_output_region = google_container_cluster.primary.region
cluster_output_regional_zones = google_container_cluster.primary.node_locations
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones
Expand All @@ -92,11 +90,12 @@ locals {
cluster_master_auth_list_layer1 = local.cluster_output_master_auth
cluster_master_auth_list_layer2 = local.cluster_master_auth_list_layer1[0]
cluster_master_auth_map = local.cluster_master_auth_list_layer2[0]
# cluster locals

cluster_location = google_container_cluster.primary.location
cluster_region = var.regional ? google_container_cluster.primary.region : join("-", slice(split("-", local.cluster_location), 0, 2))
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
cluster_location = local.cluster_output_location
cluster_region = local.cluster_output_region
cluster_zones = sort(local.cluster_output_zones)
cluster_endpoint = local.cluster_output_endpoint
cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"]
cluster_master_version = local.cluster_output_master_version
Expand Down

0 comments on commit bcc0960

Please sign in to comment.