Skip to content

Commit a20425f

Browse files
authored
Fix: Change for_each splat syntax on update variants, closes terraform-google-modules#414 (terraform-google-modules#415)
* Fix iterating over splat in google_container_node_pool with for_each * Regenerate private-cluster-update-variant submodules
1 parent 4c7b399 commit a20425f

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ Sub modules are provided from creating private clusters, beta private clusters,
1212

1313
## Compatibility
1414

15-
This module is meant for use with Terraform 0.12.
16-
If you haven't
15+
This module is meant for use with Terraform 0.12. If you haven't
1716
[upgraded][terraform-0.12-upgrade] and need a Terraform
1817
0.11.x-compatible version of this module, the last released version
1918
intended for Terraform 0.11.x is [3.0.0].

autogen/main/cluster.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ resource "google_container_node_pool" "pools" {
343343
{% endif %}
344344
for_each = local.node_pools
345345
{% if update_variant %}
346-
name = random_id.name.*.hex[each.key]
346+
name = {for k, v in random_id.name : k => v.hex}[each.key]
347347
{% else %}
348348
name = each.key
349349
{% endif %}

modules/beta-private-cluster-update-variant/cluster.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ resource "random_id" "name" {
310310
resource "google_container_node_pool" "pools" {
311311
provider = google-beta
312312
for_each = local.node_pools
313-
name = random_id.name.*.hex[each.key]
313+
name = { for k, v in random_id.name : k => v.hex }[each.key]
314314
project = var.project_id
315315
location = local.location
316316
// use node_locations if provided, defaults to cluster level node_locations if not specified

modules/private-cluster-update-variant/cluster.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ resource "random_id" "name" {
210210
resource "google_container_node_pool" "pools" {
211211
provider = google
212212
for_each = local.node_pools
213-
name = random_id.name.*.hex[each.key]
213+
name = { for k, v in random_id.name : k => v.hex }[each.key]
214214
project = var.project_id
215215
location = local.location
216216

0 commit comments

Comments
 (0)