From 365c6fedabf6369072ac4fadb122e00904f31ab4 Mon Sep 17 00:00:00 2001 From: Pratik Mallya Date: Wed, 19 Sep 2018 10:15:04 -0700 Subject: [PATCH] Remove intermediary variables They seem to cause errors when the master_authorized_networks_config is empty --- main.tf | 26 ++++++++++---------------- outputs.tf | 2 +- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/main.tf b/main.tf index c6f6ee6125..b7cb7341bf 100644 --- a/main.tf +++ b/main.tf @@ -73,11 +73,6 @@ locals { zonal = "${element(concat(google_container_cluster.zonal_primary.*.min_master_version, list("")), 0)}" } - cluster_type_output_master_authorized_networks_config = { - regional = "${element(concat(google_container_cluster.primary.*.master_authorized_networks_config, list("")), 0)}" - zonal = "${element(concat(google_container_cluster.zonal_primary.*.master_authorized_networks_config, list("")), 0)}" - } - cluster_type_output_network_policy_enabled = { regional = "${element(concat(google_container_cluster.primary.*.addons_config.0.network_policy_config.0.disabled, list("")), 0)}" zonal = "${element(concat(google_container_cluster.zonal_primary.*.addons_config.0.network_policy_config.0.disabled, list("")), 0)}" @@ -113,17 +108,16 @@ locals { cluster_master_auth_map = "${local.cluster_master_auth_list_layer2[0]}" # cluster locals - cluster_name = "${local.cluster_type_output_name[local.cluster_type]}" - cluster_location = "${local.cluster_type_output_location[local.cluster_type]}" - cluster_region = "${local.cluster_type_output_region[local.cluster_type]}" - cluster_zones = "${sort(local.cluster_type_output_zones[local.cluster_type])}" - cluster_endpoint = "${local.cluster_type_output_endpoint[local.cluster_type]}" - cluster_ca_certificate = "${lookup(local.cluster_master_auth_map, "cluster_ca_certificate")}" - cluster_master_version = "${local.cluster_type_output_master_version[local.cluster_type]}" - cluster_min_master_version = "${local.cluster_type_output_min_master_version[local.cluster_type]}" - cluster_master_authorized_networks_config = "${local.cluster_type_output_master_authorized_networks_config[local.cluster_type]}" - cluster_node_pools_names = "${local.cluster_type_output_node_pools_names[local.cluster_type]}" - cluster_node_pools_versions = "${local.cluster_type_output_node_pools_versions[local.cluster_type]}" + cluster_name = "${local.cluster_type_output_name[local.cluster_type]}" + cluster_location = "${local.cluster_type_output_location[local.cluster_type]}" + cluster_region = "${local.cluster_type_output_region[local.cluster_type]}" + cluster_zones = "${sort(local.cluster_type_output_zones[local.cluster_type])}" + cluster_endpoint = "${local.cluster_type_output_endpoint[local.cluster_type]}" + cluster_ca_certificate = "${lookup(local.cluster_master_auth_map, "cluster_ca_certificate")}" + cluster_master_version = "${local.cluster_type_output_master_version[local.cluster_type]}" + cluster_min_master_version = "${local.cluster_type_output_min_master_version[local.cluster_type]}" + cluster_node_pools_names = "${local.cluster_type_output_node_pools_names[local.cluster_type]}" + cluster_node_pools_versions = "${local.cluster_type_output_node_pools_versions[local.cluster_type]}" cluster_network_policy_enabled = "${local.cluster_type_output_network_policy_enabled[local.cluster_type] ? false : true}" cluster_http_load_balancing_enabled = "${local.cluster_type_output_http_load_balancing_enabled[local.cluster_type] ? false : true}" diff --git a/outputs.tf b/outputs.tf index 8a8c0c9f3d..0ce689569f 100644 --- a/outputs.tf +++ b/outputs.tf @@ -52,7 +52,7 @@ output "min_master_version" { output "master_authorized_networks_config" { description = "Networks from which access to master is permitted" - value = "${local.cluster_master_authorized_networks_config}" + value = "${var.master_authorized_networks_config}" } output "master_version" {