Skip to content

Commit 79d454f

Browse files
committed
Fix syntax for guest_accelerator
dynamic can not be used as guest_accelerator is an attribute as a block. https://www.terraform.io/docs/configuration/attr-as-blocks.html
1 parent a3db4d8 commit 79d454f

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

autogen/cluster_regional.tf

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,15 @@ resource "google_container_node_pool" "pools" {
271271
var.node_pools_oauth_scopes[var.node_pools[count.index]["name"]]
272272
)
273273

274-
dynamic "guest_accelerator" {
275-
for_each = lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
274+
guest_accelerator = [
275+
for guest_accelerator in lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
276276
type = lookup(var.node_pools[count.index], "accelerator_type", "")
277277
count = lookup(var.node_pools[count.index], "accelerator_count", 0)
278-
}] : []
279-
content {
280-
type = guest_accelerator.value.type
281-
count = guest_accelerator.value.count
278+
}] : [] : {
279+
type = guest_accelerator["type"]
280+
count = guest_accelerator["count"]
282281
}
283-
}
282+
]
284283
{% if beta_cluster %}
285284

286285
dynamic "workload_metadata_config" {

autogen/cluster_zonal.tf

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,16 +268,15 @@ resource "google_container_node_pool" "zonal_pools" {
268268
var.node_pools_oauth_scopes[var.node_pools[count.index]["name"]],
269269
)
270270

271-
dynamic "guest_accelerator" {
272-
for_each = lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
271+
guest_accelerator = [
272+
for guest_accelerator in lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
273273
type = lookup(var.node_pools[count.index], "accelerator_type", "")
274274
count = lookup(var.node_pools[count.index], "accelerator_count", 0)
275-
}] : []
276-
content {
277-
type = guest_accelerator.value.type
278-
count = guest_accelerator.value.count
275+
}] : [] : {
276+
type = guest_accelerator["type"]
277+
count = guest_accelerator["count"]
279278
}
280-
}
279+
]
281280
{% if beta_cluster %}
282281

283282
dynamic "workload_metadata_config" {

0 commit comments

Comments
 (0)