From a20425f74b084ef58abb1560662ef1d83f3beee5 Mon Sep 17 00:00:00 2001 From: Gabriel Totusek Date: Mon, 3 Feb 2020 08:05:16 -0800 Subject: [PATCH] Fix: Change for_each splat syntax on update variants, closes #414 (#415) * Fix iterating over splat in google_container_node_pool with for_each * Regenerate private-cluster-update-variant submodules --- README.md | 3 +-- autogen/main/cluster.tf.tmpl | 2 +- modules/beta-private-cluster-update-variant/cluster.tf | 2 +- modules/private-cluster-update-variant/cluster.tf | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 023cddb08..74644fdab 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,7 @@ Sub modules are provided from creating private clusters, beta private clusters, ## Compatibility -This module is meant for use with Terraform 0.12. -If you haven't +This module is meant for use with Terraform 0.12. If you haven't [upgraded][terraform-0.12-upgrade] and need a Terraform 0.11.x-compatible version of this module, the last released version intended for Terraform 0.11.x is [3.0.0]. diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 526a961f6..15bf8d642 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -343,7 +343,7 @@ resource "google_container_node_pool" "pools" { {% endif %} for_each = local.node_pools {% if update_variant %} - name = random_id.name.*.hex[each.key] + name = {for k, v in random_id.name : k => v.hex}[each.key] {% else %} name = each.key {% endif %} diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index ba247b6a1..961b18073 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -310,7 +310,7 @@ resource "random_id" "name" { resource "google_container_node_pool" "pools" { provider = google-beta for_each = local.node_pools - name = random_id.name.*.hex[each.key] + name = { for k, v in random_id.name : k => v.hex }[each.key] project = var.project_id location = local.location // use node_locations if provided, defaults to cluster level node_locations if not specified diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 041f2f9f8..f4abd61db 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -210,7 +210,7 @@ resource "random_id" "name" { resource "google_container_node_pool" "pools" { provider = google for_each = local.node_pools - name = random_id.name.*.hex[each.key] + name = { for k, v in random_id.name : k => v.hex }[each.key] project = var.project_id location = local.location