Skip to content

Commit

Permalink
Fix: Change for_each splat syntax on update variants, closes #414 (#415)
Browse files Browse the repository at this point in the history
* Fix iterating over splat in google_container_node_pool with for_each

* Regenerate private-cluster-update-variant submodules
  • Loading branch information
skinlayers committed Feb 3, 2020
1 parent 4c7b399 commit a20425f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down
2 changes: 1 addition & 1 deletion autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a20425f

Please sign in to comment.