Skip to content

Commit 0c07c4d

Browse files
committed
introduce cluster_resource_labels map var
add resource_labels param to cluster_regional and zonal resource templates +squash, commit changes from 40d77b7 via make generate best practice +squash - empty map var commit formatting changes from make generate
1 parent b4aec9b commit 0c07c4d

File tree

11 files changed

+32
-2
lines changed

11 files changed

+32
-2
lines changed

autogen/cluster_regional.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ resource "google_container_cluster" "primary" {
2525
name = "${var.name}"
2626
description = "${var.description}"
2727
project = "${var.project_id}"
28+
resource_labels = "${var.cluster_resource_labels}"
2829

2930
region = "${var.region}"
3031
additional_zones = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]

autogen/cluster_zonal.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ resource "google_container_cluster" "zonal_primary" {
2525
name = "${var.name}"
2626
description = "${var.description}"
2727
project = "${var.project_id}"
28+
resource_labels = "${var.cluster_resource_labels}"
2829

2930
zone = "${var.zones[0]}"
3031
additional_zones = ["${slice(var.zones,1,length(var.zones))}"]

autogen/variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ variable "description" {
2929
default = ""
3030
}
3131

32+
variable "cluster_resource_labels" {
33+
type = "map"
34+
description = "Map containing cluster labels. Maximum of 64 labels"
35+
36+
default = {
37+
}
38+
}
39+
3240
variable "regional" {
3341
description = "Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!)"
3442
default = true

cluster_regional.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ resource "google_container_cluster" "primary" {
2525
name = "${var.name}"
2626
description = "${var.description}"
2727
project = "${var.project_id}"
28+
resource_labels = "${var.cluster_resource_labels}"
2829

2930
region = "${var.region}"
3031
additional_zones = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]

cluster_zonal.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ resource "google_container_cluster" "zonal_primary" {
2525
name = "${var.name}"
2626
description = "${var.description}"
2727
project = "${var.project_id}"
28+
resource_labels = "${var.cluster_resource_labels}"
2829

2930
zone = "${var.zones[0]}"
3031
additional_zones = ["${slice(var.zones,1,length(var.zones))}"]

modules/private-cluster/cluster_regional.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ resource "google_container_cluster" "primary" {
2525
name = "${var.name}"
2626
description = "${var.description}"
2727
project = "${var.project_id}"
28+
resource_labels = "${var.cluster_resource_labels}"
2829

2930
region = "${var.region}"
3031
additional_zones = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]

modules/private-cluster/cluster_zonal.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ resource "google_container_cluster" "zonal_primary" {
2525
name = "${var.name}"
2626
description = "${var.description}"
2727
project = "${var.project_id}"
28+
resource_labels = "${var.cluster_resource_labels}"
2829

2930
zone = "${var.zones[0]}"
3031
additional_zones = ["${slice(var.zones,1,length(var.zones))}"]

modules/private-cluster/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,4 @@ output "node_pools_versions" {
111111
output "service_account" {
112112
description = "The service account to default running nodes as if not overridden in `node_pools`."
113113
value = "${local.service_account}"
114-
}
114+
}

modules/private-cluster/variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ variable "description" {
2929
default = ""
3030
}
3131

32+
variable "cluster_resource_labels" {
33+
type = "map"
34+
description = "Map containing cluster labels. Maximum of 64 labels"
35+
36+
default = {
37+
}
38+
}
39+
3240
variable "regional" {
3341
description = "Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!)"
3442
default = true

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,4 @@ output "node_pools_versions" {
111111
output "service_account" {
112112
description = "The service account to default running nodes as if not overridden in `node_pools`."
113113
value = "${local.service_account}"
114-
}
114+
}

variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ variable "description" {
2929
default = ""
3030
}
3131

32+
variable "cluster_resource_labels" {
33+
type = "map"
34+
description = "Map containing cluster labels. Maximum of 64 labels"
35+
36+
default = {
37+
}
38+
}
39+
3240
variable "regional" {
3341
description = "Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!)"
3442
default = true

0 commit comments

Comments
 (0)