From d2316652073e42e81341831c595d5a487091497c Mon Sep 17 00:00:00 2001 From: Sam Naser Date: Thu, 31 Mar 2022 10:13:15 -0700 Subject: [PATCH] Use values(...) to fix glob expression --- autogen/main/main.tf.tmpl | 2 +- main.tf | 2 +- modules/beta-private-cluster-update-variant/main.tf | 2 +- modules/beta-private-cluster/main.tf | 2 +- modules/beta-public-cluster-update-variant/main.tf | 2 +- modules/beta-public-cluster/main.tf | 2 +- modules/private-cluster-update-variant/main.tf | 2 +- modules/private-cluster/main.tf | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autogen/main/main.tf.tmpl b/autogen/main/main.tf.tmpl index be3b2f4a67..8e224b10ba 100644 --- a/autogen/main/main.tf.tmpl +++ b/autogen/main/main.tf.tmpl @@ -177,7 +177,7 @@ locals { cluster_name = local.cluster_output_name {% if autopilot_cluster != true %} // node pool ID is in the form project/location/cluster/name - cluster_name_computed = element(split("/", element(google_container_node_pool.pools[*].id, 0)), length(split("/", element(google_container_node_pool.pools[*].id, 0))) - 2) + cluster_name_computed = element(split("/", element(values(google_container_node_pool.pools)[*].id, 0)), length(split("/", element(values(google_container_node_pool.pools)[*].id, 0))) - 3) {% else %} // cluster ID is in the form project/location/name cluster_name_computed = element(split("/", local.cluster_id), length(split("/", local.cluster_id)) - 1) diff --git a/main.tf b/main.tf index a93c28e2df..24a313f9f7 100644 --- a/main.tf +++ b/main.tf @@ -126,7 +126,7 @@ locals { cluster_name = local.cluster_output_name // node pool ID is in the form project/location/cluster/name - cluster_name_computed = element(split("/", element(google_container_node_pool.pools[*].id, 0)), length(split("/", element(google_container_node_pool.pools[*].id, 0))) - 2) + cluster_name_computed = element(split("/", element(values(google_container_node_pool.pools)[*].id, 0)), length(split("/", element(values(google_container_node_pool.pools)[*].id, 0))) - 3) cluster_network_tag = "gke-${var.name}" cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"] cluster_master_version = local.cluster_output_master_version diff --git a/modules/beta-private-cluster-update-variant/main.tf b/modules/beta-private-cluster-update-variant/main.tf index e49e6007cf..d90dae0fb4 100644 --- a/modules/beta-private-cluster-update-variant/main.tf +++ b/modules/beta-private-cluster-update-variant/main.tf @@ -149,7 +149,7 @@ locals { cluster_name = local.cluster_output_name // node pool ID is in the form project/location/cluster/name - cluster_name_computed = element(split("/", element(google_container_node_pool.pools[*].id, 0)), length(split("/", element(google_container_node_pool.pools[*].id, 0))) - 2) + cluster_name_computed = element(split("/", element(values(google_container_node_pool.pools)[*].id, 0)), length(split("/", element(values(google_container_node_pool.pools)[*].id, 0))) - 3) cluster_network_tag = "gke-${var.name}" cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"] cluster_master_version = local.cluster_output_master_version diff --git a/modules/beta-private-cluster/main.tf b/modules/beta-private-cluster/main.tf index e49e6007cf..d90dae0fb4 100644 --- a/modules/beta-private-cluster/main.tf +++ b/modules/beta-private-cluster/main.tf @@ -149,7 +149,7 @@ locals { cluster_name = local.cluster_output_name // node pool ID is in the form project/location/cluster/name - cluster_name_computed = element(split("/", element(google_container_node_pool.pools[*].id, 0)), length(split("/", element(google_container_node_pool.pools[*].id, 0))) - 2) + cluster_name_computed = element(split("/", element(values(google_container_node_pool.pools)[*].id, 0)), length(split("/", element(values(google_container_node_pool.pools)[*].id, 0))) - 3) cluster_network_tag = "gke-${var.name}" cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"] cluster_master_version = local.cluster_output_master_version diff --git a/modules/beta-public-cluster-update-variant/main.tf b/modules/beta-public-cluster-update-variant/main.tf index 7585647393..be335c1715 100644 --- a/modules/beta-public-cluster-update-variant/main.tf +++ b/modules/beta-public-cluster-update-variant/main.tf @@ -148,7 +148,7 @@ locals { cluster_name = local.cluster_output_name // node pool ID is in the form project/location/cluster/name - cluster_name_computed = element(split("/", element(google_container_node_pool.pools[*].id, 0)), length(split("/", element(google_container_node_pool.pools[*].id, 0))) - 2) + cluster_name_computed = element(split("/", element(values(google_container_node_pool.pools)[*].id, 0)), length(split("/", element(values(google_container_node_pool.pools)[*].id, 0))) - 3) cluster_network_tag = "gke-${var.name}" cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"] cluster_master_version = local.cluster_output_master_version diff --git a/modules/beta-public-cluster/main.tf b/modules/beta-public-cluster/main.tf index 7585647393..be335c1715 100644 --- a/modules/beta-public-cluster/main.tf +++ b/modules/beta-public-cluster/main.tf @@ -148,7 +148,7 @@ locals { cluster_name = local.cluster_output_name // node pool ID is in the form project/location/cluster/name - cluster_name_computed = element(split("/", element(google_container_node_pool.pools[*].id, 0)), length(split("/", element(google_container_node_pool.pools[*].id, 0))) - 2) + cluster_name_computed = element(split("/", element(values(google_container_node_pool.pools)[*].id, 0)), length(split("/", element(values(google_container_node_pool.pools)[*].id, 0))) - 3) cluster_network_tag = "gke-${var.name}" cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"] cluster_master_version = local.cluster_output_master_version diff --git a/modules/private-cluster-update-variant/main.tf b/modules/private-cluster-update-variant/main.tf index 63855f9915..cd2a89e89b 100644 --- a/modules/private-cluster-update-variant/main.tf +++ b/modules/private-cluster-update-variant/main.tf @@ -127,7 +127,7 @@ locals { cluster_name = local.cluster_output_name // node pool ID is in the form project/location/cluster/name - cluster_name_computed = element(split("/", element(google_container_node_pool.pools[*].id, 0)), length(split("/", element(google_container_node_pool.pools[*].id, 0))) - 2) + cluster_name_computed = element(split("/", element(values(google_container_node_pool.pools)[*].id, 0)), length(split("/", element(values(google_container_node_pool.pools)[*].id, 0))) - 3) cluster_network_tag = "gke-${var.name}" cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"] cluster_master_version = local.cluster_output_master_version diff --git a/modules/private-cluster/main.tf b/modules/private-cluster/main.tf index 63855f9915..cd2a89e89b 100644 --- a/modules/private-cluster/main.tf +++ b/modules/private-cluster/main.tf @@ -127,7 +127,7 @@ locals { cluster_name = local.cluster_output_name // node pool ID is in the form project/location/cluster/name - cluster_name_computed = element(split("/", element(google_container_node_pool.pools[*].id, 0)), length(split("/", element(google_container_node_pool.pools[*].id, 0))) - 2) + cluster_name_computed = element(split("/", element(values(google_container_node_pool.pools)[*].id, 0)), length(split("/", element(values(google_container_node_pool.pools)[*].id, 0))) - 3) cluster_network_tag = "gke-${var.name}" cluster_ca_certificate = local.cluster_master_auth_map["cluster_ca_certificate"] cluster_master_version = local.cluster_output_master_version