Skip to content

Commit

Permalink
Fix cluster endpoint ouput when enable_private_nodes is false
Browse files Browse the repository at this point in the history
  • Loading branch information
morgante committed Dec 4, 2019
1 parent 29f72c9 commit 94d4677
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 15 deletions.
5 changes: 2 additions & 3 deletions autogen/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ locals {
cluster_output_zones = local.cluster_output_regional_zones

{% if private_cluster %}
cluster_output_endpoint = var.deploy_using_private_endpoint ? google_container_cluster.primary.private_cluster_config.0.private_endpoint : google_container_cluster.primary.private_cluster_config.0.public_endpoint
cluster_endpoint = var.enable_private_nodes ? (var.deploy_using_private_endpoint ? google_container_cluster.primary.private_cluster_config.0.private_endpoint : google_container_cluster.primary.private_cluster_config.0.public_endpoint) : google_container_cluster.primary.endpoint
{% else %}
cluster_output_endpoint = google_container_cluster.primary.endpoint
cluster_endpoint = google_container_cluster.primary.endpoint
{% endif %}

cluster_output_master_auth = concat(google_container_cluster.primary.*.master_auth, [])
Expand Down Expand Up @@ -141,7 +141,6 @@ locals {
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
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
cluster_min_master_version = local.cluster_output_min_master_version
Expand Down
3 changes: 1 addition & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ locals {
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones

cluster_output_endpoint = google_container_cluster.primary.endpoint
cluster_endpoint = google_container_cluster.primary.endpoint

cluster_output_master_auth = concat(google_container_cluster.primary.*.master_auth, [])
cluster_output_master_version = google_container_cluster.primary.master_version
Expand Down Expand Up @@ -96,7 +96,6 @@ locals {
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
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
cluster_min_master_version = local.cluster_output_min_master_version
Expand Down
3 changes: 1 addition & 2 deletions modules/beta-private-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ locals {
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones

cluster_output_endpoint = var.deploy_using_private_endpoint ? google_container_cluster.primary.private_cluster_config.0.private_endpoint : google_container_cluster.primary.private_cluster_config.0.public_endpoint
cluster_endpoint = var.enable_private_nodes ? (var.deploy_using_private_endpoint ? google_container_cluster.primary.private_cluster_config.0.private_endpoint : google_container_cluster.primary.private_cluster_config.0.public_endpoint) : google_container_cluster.primary.endpoint

cluster_output_master_auth = concat(google_container_cluster.primary.*.master_auth, [])
cluster_output_master_version = google_container_cluster.primary.master_version
Expand Down Expand Up @@ -127,7 +127,6 @@ locals {
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
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
cluster_min_master_version = local.cluster_output_min_master_version
Expand Down
3 changes: 1 addition & 2 deletions modules/beta-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ locals {
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones

cluster_output_endpoint = var.deploy_using_private_endpoint ? google_container_cluster.primary.private_cluster_config.0.private_endpoint : google_container_cluster.primary.private_cluster_config.0.public_endpoint
cluster_endpoint = var.enable_private_nodes ? (var.deploy_using_private_endpoint ? google_container_cluster.primary.private_cluster_config.0.private_endpoint : google_container_cluster.primary.private_cluster_config.0.public_endpoint) : google_container_cluster.primary.endpoint

cluster_output_master_auth = concat(google_container_cluster.primary.*.master_auth, [])
cluster_output_master_version = google_container_cluster.primary.master_version
Expand Down Expand Up @@ -127,7 +127,6 @@ locals {
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
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
cluster_min_master_version = local.cluster_output_min_master_version
Expand Down
3 changes: 1 addition & 2 deletions modules/beta-public-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ locals {
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones

cluster_output_endpoint = google_container_cluster.primary.endpoint
cluster_endpoint = google_container_cluster.primary.endpoint

cluster_output_master_auth = concat(google_container_cluster.primary.*.master_auth, [])
cluster_output_master_version = google_container_cluster.primary.master_version
Expand Down Expand Up @@ -127,7 +127,6 @@ locals {
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
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
cluster_min_master_version = local.cluster_output_min_master_version
Expand Down
3 changes: 1 addition & 2 deletions modules/private-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ locals {
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones

cluster_output_endpoint = var.deploy_using_private_endpoint ? google_container_cluster.primary.private_cluster_config.0.private_endpoint : google_container_cluster.primary.private_cluster_config.0.public_endpoint
cluster_endpoint = var.enable_private_nodes ? (var.deploy_using_private_endpoint ? google_container_cluster.primary.private_cluster_config.0.private_endpoint : google_container_cluster.primary.private_cluster_config.0.public_endpoint) : google_container_cluster.primary.endpoint

cluster_output_master_auth = concat(google_container_cluster.primary.*.master_auth, [])
cluster_output_master_version = google_container_cluster.primary.master_version
Expand Down Expand Up @@ -96,7 +96,6 @@ locals {
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
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
cluster_min_master_version = local.cluster_output_min_master_version
Expand Down
3 changes: 1 addition & 2 deletions modules/private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ locals {
cluster_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
cluster_output_zones = local.cluster_output_regional_zones

cluster_output_endpoint = var.deploy_using_private_endpoint ? google_container_cluster.primary.private_cluster_config.0.private_endpoint : google_container_cluster.primary.private_cluster_config.0.public_endpoint
cluster_endpoint = var.enable_private_nodes ? (var.deploy_using_private_endpoint ? google_container_cluster.primary.private_cluster_config.0.private_endpoint : google_container_cluster.primary.private_cluster_config.0.public_endpoint) : google_container_cluster.primary.endpoint

cluster_output_master_auth = concat(google_container_cluster.primary.*.master_auth, [])
cluster_output_master_version = google_container_cluster.primary.master_version
Expand Down Expand Up @@ -96,7 +96,6 @@ locals {
cluster_zones = sort(local.cluster_output_zones)

cluster_name = local.cluster_output_name
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
cluster_min_master_version = local.cluster_output_min_master_version
Expand Down

0 comments on commit 94d4677

Please sign in to comment.