@@ -119,10 +119,6 @@ resource "google_container_cluster" "primary" {
119
119
disabled = ! var.horizontal_pod_autoscaling
120
120
}
121
121
122
- kubernetes_dashboard {
123
- disabled = ! var.kubernetes_dashboard
124
- }
125
-
126
122
network_policy_config {
127
123
disabled = ! var.network_policy
128
124
}
@@ -252,10 +248,10 @@ resource "random_id" "name" {
252
248
labels = join(",",
253
249
sort(
254
250
concat(
255
- keys (var . node_pools_labels [" all" ]),
256
- values (var . node_pools_labels [" all" ]),
257
- keys (var . node_pools_labels [var . node_pools [count . index ][" name" ]]),
258
- values (var . node_pools_labels [var . node_pools [count . index ][" name" ]])
251
+ keys(local .node_pools_labels["all"]),
252
+ values(local .node_pools_labels["all"]),
253
+ keys(local .node_pools_labels[var.node_pools[count.index]["name"]]),
254
+ values(local .node_pools_labels[var.node_pools[count.index]["name"]])
259
255
)
260
256
)
261
257
)
@@ -264,10 +260,10 @@ resource "random_id" "name" {
264
260
metadata = join(",",
265
261
sort(
266
262
concat(
267
- keys (var . node_pools_metadata [" all" ]),
268
- values (var . node_pools_metadata [" all" ]),
269
- keys (var . node_pools_metadata [var . node_pools [count . index ][" name" ]]),
270
- values (var . node_pools_metadata [var . node_pools [count . index ][" name" ]])
263
+ keys(local .node_pools_metadata["all"]),
264
+ values(local .node_pools_metadata["all"]),
265
+ keys(local .node_pools_metadata[var.node_pools[count.index]["name"]]),
266
+ values(local .node_pools_metadata[var.node_pools[count.index]["name"]])
271
267
)
272
268
)
273
269
)
@@ -276,8 +272,8 @@ resource "random_id" "name" {
276
272
oauth_scopes = join(",",
277
273
sort(
278
274
concat(
279
- var . node_pools_oauth_scopes [" all" ],
280
- var . node_pools_oauth_scopes [var . node_pools [count . index ][" name" ]]
275
+ local .node_pools_oauth_scopes["all"],
276
+ local .node_pools_oauth_scopes[var.node_pools[count.index]["name"]]
281
277
)
282
278
)
283
279
)
@@ -286,8 +282,8 @@ resource "random_id" "name" {
286
282
tags = join(",",
287
283
sort(
288
284
concat(
289
- var . node_pools_tags [" all" ],
290
- var . node_pools_tags [var . node_pools [count . index ][" name" ]]
285
+ local .node_pools_tags["all"],
286
+ local .node_pools_tags[var.node_pools[count.index]["name"]]
291
287
)
292
288
)
293
289
)
@@ -314,7 +310,9 @@ resource "google_container_node_pool" "pools" {
314
310
// use node_locations if provided, defaults to cluster level node_locations if not specified
315
311
node_locations = lookup(var.node_pools[count.index], "node_locations", "") != "" ? split(",", var.node_pools[count.index]["node_locations"]) : null
316
312
{% endif %}
317
- cluster = google_container_cluster.primary.name
313
+
314
+ cluster = google_container_cluster.primary.name
315
+
318
316
version = lookup(var.node_pools[count.index], "auto_upgrade", false) ? "" : lookup(
319
317
var.node_pools[count.index],
320
318
"version",
@@ -350,25 +348,25 @@ resource "google_container_node_pool" "pools" {
350
348
image_type = lookup(var.node_pools[count.index], "image_type", "COS")
351
349
machine_type = lookup(var.node_pools[count.index], "machine_type", "n1-standard-2")
352
350
labels = merge(
353
- lookup (lookup (var . node_pools_labels , " default_values" , {}), " cluster_name" , true ) ? { " cluster_name" = var.name } : {},
354
- lookup (lookup (var . node_pools_labels , " default_values" , {}), " node_pool" , true ) ? { " node_pool" = var.node_pools[count.index][" name" ] } : {},
355
- var . node_pools_labels [" all" ],
356
- var . node_pools_labels [var . node_pools [count . index ][" name" ]],
351
+ lookup(lookup(local .node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
352
+ lookup(lookup(local .node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = var.node_pools[count.index]["name"] } : {},
353
+ local .node_pools_labels["all"],
354
+ local .node_pools_labels[var.node_pools[count.index]["name"]],
357
355
)
358
356
metadata = merge(
359
- lookup (lookup (var . node_pools_metadata , " default_values" , {}), " cluster_name" , true ) ? { " cluster_name" = var.name } : {},
360
- lookup (lookup (var . node_pools_metadata , " default_values" , {}), " node_pool" , true ) ? { " node_pool" = var.node_pools[count.index][" name" ] } : {},
361
- var . node_pools_metadata [" all" ],
362
- var . node_pools_metadata [var . node_pools [count . index ][" name" ]],
357
+ lookup(lookup(local .node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
358
+ lookup(lookup(local .node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = var.node_pools[count.index]["name"] } : {},
359
+ local .node_pools_metadata["all"],
360
+ local .node_pools_metadata[var.node_pools[count.index]["name"]],
363
361
{
364
362
"disable-legacy-endpoints" = var.disable_legacy_metadata_endpoints
365
363
},
366
364
)
367
365
{% if beta_cluster %}
368
366
dynamic "taint" {
369
367
for_each = concat(
370
- var . node_pools_taints [" all" ],
371
- var . node_pools_taints [var . node_pools [count . index ][" name" ]],
368
+ local .node_pools_taints["all"],
369
+ local .node_pools_taints[var.node_pools[count.index]["name"]],
372
370
)
373
371
content {
374
372
effect = taint.value.effect
@@ -378,14 +376,16 @@ resource "google_container_node_pool" "pools" {
378
376
}
379
377
{% endif %}
380
378
tags = concat(
381
- lookup (var . node_pools_tags , " default_values" , [true , true ])[0 ] ? [" gke-${ var . name } " ] : [],
382
- lookup (var . node_pools_tags , " default_values" , [true , true ])[1 ] ? [" gke-${ var . name } -${ var . node_pools [count . index ][" name" ]} " ] : [],
383
- var . node_pools_tags [" all" ],
384
- var . node_pools_tags [var . node_pools [count . index ][" name" ]],
379
+ lookup(local .node_pools_tags, "default_values", [true, true])[0] ? ["gke-${var.name}"] : [],
380
+ lookup(local .node_pools_tags, "default_values", [true, true])[1] ? ["gke-${var.name}-${var.node_pools[count.index]["name"]}"] : [],
381
+ local .node_pools_tags["all"],
382
+ local .node_pools_tags[var.node_pools[count.index]["name"]],
385
383
)
386
384
387
- disk_size_gb = lookup (var. node_pools [count . index ], " disk_size_gb" , 100 )
388
- disk_type = lookup (var. node_pools [count . index ], " disk_type" , " pd-standard" )
385
+ local_ssd_count = lookup(var.node_pools[count.index], "local_ssd_count", 0)
386
+ disk_size_gb = lookup(var.node_pools[count.index], "disk_size_gb", 100)
387
+ disk_type = lookup(var.node_pools[count.index], "disk_type", "pd-standard")
388
+
389
389
service_account = lookup(
390
390
var.node_pools[count.index],
391
391
"service_account",
@@ -394,8 +394,8 @@ resource "google_container_node_pool" "pools" {
394
394
preemptible = lookup(var.node_pools[count.index], "preemptible", false)
395
395
396
396
oauth_scopes = concat(
397
- var . node_pools_oauth_scopes [" all" ],
398
- var . node_pools_oauth_scopes [var . node_pools [count . index ][" name" ]],
397
+ local .node_pools_oauth_scopes["all"],
398
+ local .node_pools_oauth_scopes[var.node_pools[count.index]["name"]],
399
399
)
400
400
401
401
guest_accelerator = [
@@ -429,6 +429,7 @@ resource "google_container_node_pool" "pools" {
429
429
430
430
lifecycle {
431
431
ignore_changes = [initial_node_count]
432
+
432
433
{% if update_variant %}
433
434
create_before_destroy = true
434
435
{% endif %}
0 commit comments