Skip to content

Commit 121a505

Browse files
committed
Regenerate modules
1 parent 1313afc commit 121a505

File tree

12 files changed

+60
-64
lines changed

12 files changed

+60
-64
lines changed

cluster_regional.tf

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

216-
dynamic "guest_accelerator" {
217-
for_each = lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
216+
guest_accelerator = [
217+
for guest_accelerator in lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
218218
type = lookup(var.node_pools[count.index], "accelerator_type", "")
219219
count = lookup(var.node_pools[count.index], "accelerator_count", 0)
220-
}] : []
221-
content {
222-
type = guest_accelerator.value.type
223-
count = guest_accelerator.value.count
220+
}] : [] : {
221+
type = guest_accelerator["type"]
222+
count = guest_accelerator["count"]
224223
}
225-
}
224+
]
226225
}
227226

228227
lifecycle {

cluster_zonal.tf

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

214-
dynamic "guest_accelerator" {
215-
for_each = lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
214+
guest_accelerator = [
215+
for guest_accelerator in lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
216216
type = lookup(var.node_pools[count.index], "accelerator_type", "")
217217
count = lookup(var.node_pools[count.index], "accelerator_count", 0)
218-
}] : []
219-
content {
220-
type = guest_accelerator.value.type
221-
count = guest_accelerator.value.count
218+
}] : [] : {
219+
type = guest_accelerator["type"]
220+
count = guest_accelerator["count"]
222221
}
223-
}
222+
]
224223
}
225224

226225
lifecycle {

main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ locals {
3939
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
4040
upstream_nameservers_config = length(var.upstream_nameservers) > 0
4141
network_project_id = var.network_project_id != "" ? var.network_project_id : var.project_id
42+
zone_count = length(var.zones)
4243

4344
cluster_type = var.regional ? "regional" : "zonal"
4445

@@ -72,7 +73,7 @@ locals {
7273
}
7374

7475
cluster_type_output_regional_zones = flatten(google_container_cluster.primary.*.node_locations)
75-
cluster_type_output_zonal_zones = slice(var.zones, 1, length(var.zones))
76+
cluster_type_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
7677

7778
cluster_type_output_zones = {
7879
regional = local.cluster_type_output_regional_zones
@@ -266,7 +267,7 @@ data "google_container_engine_versions" "zone" {
266267
//
267268
// data.google_container_engine_versions.zone: Cannot determine zone: set in this resource, or set provider-level zone.
268269
//
269-
zone = var.zones[0] == "" ? data.google_compute_zones.available.names[0] : var.zones[0]
270+
zone = local.zone_count == 0 ? data.google_compute_zones.available.names[0] : var.zones[0]
270271

271272
project = var.project_id
272273
}

modules/beta-private-cluster/cluster_regional.tf

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

260-
dynamic "guest_accelerator" {
261-
for_each = lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
260+
guest_accelerator = [
261+
for guest_accelerator in lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
262262
type = lookup(var.node_pools[count.index], "accelerator_type", "")
263263
count = lookup(var.node_pools[count.index], "accelerator_count", 0)
264-
}] : []
265-
content {
266-
type = guest_accelerator.value.type
267-
count = guest_accelerator.value.count
264+
}] : [] : {
265+
type = guest_accelerator["type"]
266+
count = guest_accelerator["count"]
268267
}
269-
}
268+
]
270269

271270
dynamic "workload_metadata_config" {
272271
for_each = local.cluster_node_metadata_config

modules/beta-private-cluster/cluster_zonal.tf

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

257-
dynamic "guest_accelerator" {
258-
for_each = lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
257+
guest_accelerator = [
258+
for guest_accelerator in lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
259259
type = lookup(var.node_pools[count.index], "accelerator_type", "")
260260
count = lookup(var.node_pools[count.index], "accelerator_count", 0)
261-
}] : []
262-
content {
263-
type = guest_accelerator.value.type
264-
count = guest_accelerator.value.count
261+
}] : [] : {
262+
type = guest_accelerator["type"]
263+
count = guest_accelerator["count"]
265264
}
266-
}
265+
]
267266

268267
dynamic "workload_metadata_config" {
269268
for_each = local.cluster_node_metadata_config

modules/beta-private-cluster/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ locals {
3939
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
4040
upstream_nameservers_config = length(var.upstream_nameservers) > 0
4141
network_project_id = var.network_project_id != "" ? var.network_project_id : var.project_id
42+
zone_count = length(var.zones)
4243

4344
cluster_type = var.regional ? "regional" : "zonal"
4445

@@ -78,7 +79,7 @@ locals {
7879
}
7980

8081
cluster_type_output_regional_zones = flatten(google_container_cluster.primary.*.node_locations)
81-
cluster_type_output_zonal_zones = slice(var.zones, 1, length(var.zones))
82+
cluster_type_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
8283

8384
cluster_type_output_zones = {
8485
regional = local.cluster_type_output_regional_zones
@@ -286,7 +287,7 @@ data "google_container_engine_versions" "zone" {
286287
//
287288
// data.google_container_engine_versions.zone: Cannot determine zone: set in this resource, or set provider-level zone.
288289
//
289-
zone = var.zones[0] == "" ? data.google_compute_zones.available.names[0] : var.zones[0]
290+
zone = local.zone_count == 0 ? data.google_compute_zones.available.names[0] : var.zones[0]
290291

291292
project = var.project_id
292293
}

modules/beta-public-cluster/cluster_regional.tf

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

254-
dynamic "guest_accelerator" {
255-
for_each = lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
254+
guest_accelerator = [
255+
for guest_accelerator in lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
256256
type = lookup(var.node_pools[count.index], "accelerator_type", "")
257257
count = lookup(var.node_pools[count.index], "accelerator_count", 0)
258-
}] : []
259-
content {
260-
type = guest_accelerator.value.type
261-
count = guest_accelerator.value.count
258+
}] : [] : {
259+
type = guest_accelerator["type"]
260+
count = guest_accelerator["count"]
262261
}
263-
}
262+
]
264263

265264
dynamic "workload_metadata_config" {
266265
for_each = local.cluster_node_metadata_config

modules/beta-public-cluster/cluster_zonal.tf

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

252-
dynamic "guest_accelerator" {
253-
for_each = lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
252+
guest_accelerator = [
253+
for guest_accelerator in lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
254254
type = lookup(var.node_pools[count.index], "accelerator_type", "")
255255
count = lookup(var.node_pools[count.index], "accelerator_count", 0)
256-
}] : []
257-
content {
258-
type = guest_accelerator.value.type
259-
count = guest_accelerator.value.count
256+
}] : [] : {
257+
type = guest_accelerator["type"]
258+
count = guest_accelerator["count"]
260259
}
261-
}
260+
]
262261

263262
dynamic "workload_metadata_config" {
264263
for_each = local.cluster_node_metadata_config

modules/beta-public-cluster/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ locals {
3939
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
4040
upstream_nameservers_config = length(var.upstream_nameservers) > 0
4141
network_project_id = var.network_project_id != "" ? var.network_project_id : var.project_id
42+
zone_count = length(var.zones)
4243

4344
cluster_type = var.regional ? "regional" : "zonal"
4445

@@ -78,7 +79,7 @@ locals {
7879
}
7980

8081
cluster_type_output_regional_zones = flatten(google_container_cluster.primary.*.node_locations)
81-
cluster_type_output_zonal_zones = slice(var.zones, 1, length(var.zones))
82+
cluster_type_output_zonal_zones = local.zone_count > 1 ? slice(var.zones, 1, local.zone_count) : []
8283

8384
cluster_type_output_zones = {
8485
regional = local.cluster_type_output_regional_zones
@@ -288,7 +289,7 @@ data "google_container_engine_versions" "zone" {
288289
//
289290
// data.google_container_engine_versions.zone: Cannot determine zone: set in this resource, or set provider-level zone.
290291
//
291-
zone = var.zones[0] == "" ? data.google_compute_zones.available.names[0] : var.zones[0]
292+
zone = local.zone_count == 0 ? data.google_compute_zones.available.names[0] : var.zones[0]
292293

293294
project = var.project_id
294295
}

modules/private-cluster/cluster_regional.tf

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

222-
dynamic "guest_accelerator" {
223-
for_each = lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
222+
guest_accelerator = [
223+
for guest_accelerator in lookup(var.node_pools[count.index], "accelerator_count", 0) > 0 ? [{
224224
type = lookup(var.node_pools[count.index], "accelerator_type", "")
225225
count = lookup(var.node_pools[count.index], "accelerator_count", 0)
226-
}] : []
227-
content {
228-
type = guest_accelerator.value.type
229-
count = guest_accelerator.value.count
226+
}] : [] : {
227+
type = guest_accelerator["type"]
228+
count = guest_accelerator["count"]
230229
}
231-
}
230+
]
232231
}
233232

234233
lifecycle {

0 commit comments

Comments
 (0)