Skip to content

Commit 666d140

Browse files
committed
Flatten vars
Signed-off-by: Edvin Norling <[email protected]>
1 parent afd5591 commit 666d140

File tree

16 files changed

+67
-93
lines changed

16 files changed

+67
-93
lines changed

autogen/main/cluster.tf.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,9 @@ resource "google_container_cluster" "primary" {
318318

319319
protect_config {
320320
workload_config {
321-
audit_mode = var.protect_config.workload_config.audit_mode
321+
audit_mode = var.workload_config_audit_mode
322322
}
323-
workload_vulnerability_mode = var.protect_config.workload_vulnerability_mode
323+
workload_vulnerability_mode = var.workload_vulnerability_mode
324324
}
325325
{% endif %}
326326
ip_allocation_policy {

autogen/main/variables.tf.tmpl

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -767,22 +767,16 @@ variable "enable_identity_service" {
767767
default = false
768768
}
769769

770-
variable "protect_config" {
771-
description = "(beta) Enable/Disable Protect API features for the cluster."
772-
type = object({
773-
workload_vulnerability_mode = string,
774-
workload_config = object({
775-
audit_mode = string
776-
})
777-
}
778-
)
770+
variable "workload_vulnerability_mode" {
771+
description = "(beta) Vulnerability mode."
772+
type = string
773+
default = ""
774+
}
779775

780-
default = {
781-
workload_vulnerability_mode = ""
782-
workload_config = {
783-
audit_mode = "MODE_UNSPECIFIED"
784-
}
785-
}
776+
variable "workload_config_audit_mode" {
777+
description = "(beta) Worload config audit mode."
778+
type = string
779+
default = "DISABLED"
786780
}
787781
{% endif %}
788782
{% endif %}

modules/beta-autopilot-private-cluster/cluster.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ resource "google_container_cluster" "primary" {
131131

132132
protect_config {
133133
workload_config {
134-
audit_mode = var.protect_config.workload_config.audit_mode
134+
audit_mode = var.workload_config_audit_mode
135135
}
136-
workload_vulnerability_mode = var.protect_config.workload_vulnerability_mode
136+
workload_vulnerability_mode = var.workload_vulnerability_mode
137137
}
138138
ip_allocation_policy {
139139
cluster_secondary_range_name = var.ip_range_pods

modules/beta-autopilot-public-cluster/cluster.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ resource "google_container_cluster" "primary" {
131131

132132
protect_config {
133133
workload_config {
134-
audit_mode = var.protect_config.workload_config.audit_mode
134+
audit_mode = var.workload_config_audit_mode
135135
}
136-
workload_vulnerability_mode = var.protect_config.workload_vulnerability_mode
136+
workload_vulnerability_mode = var.workload_vulnerability_mode
137137
}
138138
ip_allocation_policy {
139139
cluster_secondary_range_name = var.ip_range_pods

modules/beta-private-cluster-update-variant/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ Then perform the following commands on the root folder:
247247
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` | <pre>[<br> "10.0.0.0/8",<br> "172.16.0.0/12",<br> "192.168.0.0/16"<br>]</pre> | no |
248248
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
249249
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
250-
| protect\_config | (beta) Enable/Disable Protect API features for the cluster. | <pre>object({<br> workload_vulnerability_mode = string,<br> workload_config = object({<br> audit_mode = string<br> })<br> }<br> )</pre> | <pre>{<br> "workload_config": {<br> "audit_mode": "MODE_UNSPECIFIED"<br> },<br> "workload_vulnerability_mode": ""<br>}</pre> | no |
251250
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
252251
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |
253252
| registry\_project\_ids | Projects holding Google Container Registries. If empty, we use the cluster project. If a service account is created and the `grant_registry_access` variable is set to `true`, the `storage.objectViewer` and `artifactregsitry.reader` roles are assigned on these projects. | `list(string)` | `[]` | no |
@@ -265,6 +264,8 @@ Then perform the following commands on the root folder:
265264
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
266265
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
267266
| windows\_node\_pools | List of maps containing Windows node pools | `list(map(string))` | `[]` | no |
267+
| workload\_config\_audit\_mode | (beta) Worload config audit mode. | `string` | `"DISABLED"` | no |
268+
| workload\_vulnerability\_mode | (beta) Vulnerability mode. | `string` | `""` | no |
268269
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
269270

270271
## Outputs

modules/beta-private-cluster-update-variant/cluster.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ resource "google_container_cluster" "primary" {
259259

260260
protect_config {
261261
workload_config {
262-
audit_mode = var.protect_config.workload_config.audit_mode
262+
audit_mode = var.workload_config_audit_mode
263263
}
264-
workload_vulnerability_mode = var.protect_config.workload_vulnerability_mode
264+
workload_vulnerability_mode = var.workload_vulnerability_mode
265265
}
266266
ip_allocation_policy {
267267
cluster_secondary_range_name = var.ip_range_pods

modules/beta-private-cluster-update-variant/variables.tf

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -726,20 +726,14 @@ variable "enable_identity_service" {
726726
default = false
727727
}
728728

729-
variable "protect_config" {
730-
description = "(beta) Enable/Disable Protect API features for the cluster."
731-
type = object({
732-
workload_vulnerability_mode = string,
733-
workload_config = object({
734-
audit_mode = string
735-
})
736-
}
737-
)
729+
variable "workload_vulnerability_mode" {
730+
description = "(beta) Vulnerability mode."
731+
type = string
732+
default = ""
733+
}
738734

739-
default = {
740-
workload_vulnerability_mode = ""
741-
workload_config = {
742-
audit_mode = "MODE_UNSPECIFIED"
743-
}
744-
}
735+
variable "workload_config_audit_mode" {
736+
description = "(beta) Worload config audit mode."
737+
type = string
738+
default = "DISABLED"
745739
}

modules/beta-private-cluster/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ Then perform the following commands on the root folder:
225225
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` | <pre>[<br> "10.0.0.0/8",<br> "172.16.0.0/12",<br> "192.168.0.0/16"<br>]</pre> | no |
226226
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
227227
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
228-
| protect\_config | (beta) Enable/Disable Protect API features for the cluster. | <pre>object({<br> workload_vulnerability_mode = string,<br> workload_config = object({<br> audit_mode = string<br> })<br> }<br> )</pre> | <pre>{<br> "workload_config": {<br> "audit_mode": "MODE_UNSPECIFIED"<br> },<br> "workload_vulnerability_mode": ""<br>}</pre> | no |
229228
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
230229
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |
231230
| registry\_project\_ids | Projects holding Google Container Registries. If empty, we use the cluster project. If a service account is created and the `grant_registry_access` variable is set to `true`, the `storage.objectViewer` and `artifactregsitry.reader` roles are assigned on these projects. | `list(string)` | `[]` | no |
@@ -243,6 +242,8 @@ Then perform the following commands on the root folder:
243242
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
244243
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
245244
| windows\_node\_pools | List of maps containing Windows node pools | `list(map(string))` | `[]` | no |
245+
| workload\_config\_audit\_mode | (beta) Worload config audit mode. | `string` | `"DISABLED"` | no |
246+
| workload\_vulnerability\_mode | (beta) Vulnerability mode. | `string` | `""` | no |
246247
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
247248

248249
## Outputs

modules/beta-private-cluster/cluster.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ resource "google_container_cluster" "primary" {
259259

260260
protect_config {
261261
workload_config {
262-
audit_mode = var.protect_config.workload_config.audit_mode
262+
audit_mode = var.workload_config_audit_mode
263263
}
264-
workload_vulnerability_mode = var.protect_config.workload_vulnerability_mode
264+
workload_vulnerability_mode = var.workload_vulnerability_mode
265265
}
266266
ip_allocation_policy {
267267
cluster_secondary_range_name = var.ip_range_pods

modules/beta-private-cluster/variables.tf

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -726,20 +726,14 @@ variable "enable_identity_service" {
726726
default = false
727727
}
728728

729-
variable "protect_config" {
730-
description = "(beta) Enable/Disable Protect API features for the cluster."
731-
type = object({
732-
workload_vulnerability_mode = string,
733-
workload_config = object({
734-
audit_mode = string
735-
})
736-
}
737-
)
729+
variable "workload_vulnerability_mode" {
730+
description = "(beta) Vulnerability mode."
731+
type = string
732+
default = ""
733+
}
738734

739-
default = {
740-
workload_vulnerability_mode = ""
741-
workload_config = {
742-
audit_mode = "MODE_UNSPECIFIED"
743-
}
744-
}
735+
variable "workload_config_audit_mode" {
736+
description = "(beta) Worload config audit mode."
737+
type = string
738+
default = "DISABLED"
745739
}

modules/beta-public-cluster-update-variant/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ Then perform the following commands on the root folder:
236236
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` | <pre>[<br> "10.0.0.0/8",<br> "172.16.0.0/12",<br> "192.168.0.0/16"<br>]</pre> | no |
237237
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
238238
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
239-
| protect\_config | (beta) Enable/Disable Protect API features for the cluster. | <pre>object({<br> workload_vulnerability_mode = string,<br> workload_config = object({<br> audit_mode = string<br> })<br> }<br> )</pre> | <pre>{<br> "workload_config": {<br> "audit_mode": "MODE_UNSPECIFIED"<br> },<br> "workload_vulnerability_mode": ""<br>}</pre> | no |
240239
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
241240
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |
242241
| registry\_project\_ids | Projects holding Google Container Registries. If empty, we use the cluster project. If a service account is created and the `grant_registry_access` variable is set to `true`, the `storage.objectViewer` and `artifactregsitry.reader` roles are assigned on these projects. | `list(string)` | `[]` | no |
@@ -254,6 +253,8 @@ Then perform the following commands on the root folder:
254253
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
255254
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
256255
| windows\_node\_pools | List of maps containing Windows node pools | `list(map(string))` | `[]` | no |
256+
| workload\_config\_audit\_mode | (beta) Worload config audit mode. | `string` | `"DISABLED"` | no |
257+
| workload\_vulnerability\_mode | (beta) Vulnerability mode. | `string` | `""` | no |
257258
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
258259

259260
## Outputs

modules/beta-public-cluster-update-variant/cluster.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ resource "google_container_cluster" "primary" {
259259

260260
protect_config {
261261
workload_config {
262-
audit_mode = var.protect_config.workload_config.audit_mode
262+
audit_mode = var.workload_config_audit_mode
263263
}
264-
workload_vulnerability_mode = var.protect_config.workload_vulnerability_mode
264+
workload_vulnerability_mode = var.workload_vulnerability_mode
265265
}
266266
ip_allocation_policy {
267267
cluster_secondary_range_name = var.ip_range_pods

modules/beta-public-cluster-update-variant/variables.tf

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -696,20 +696,14 @@ variable "enable_identity_service" {
696696
default = false
697697
}
698698

699-
variable "protect_config" {
700-
description = "(beta) Enable/Disable Protect API features for the cluster."
701-
type = object({
702-
workload_vulnerability_mode = string,
703-
workload_config = object({
704-
audit_mode = string
705-
})
706-
}
707-
)
699+
variable "workload_vulnerability_mode" {
700+
description = "(beta) Vulnerability mode."
701+
type = string
702+
default = ""
703+
}
708704

709-
default = {
710-
workload_vulnerability_mode = ""
711-
workload_config = {
712-
audit_mode = "MODE_UNSPECIFIED"
713-
}
714-
}
705+
variable "workload_config_audit_mode" {
706+
description = "(beta) Worload config audit mode."
707+
type = string
708+
default = "DISABLED"
715709
}

modules/beta-public-cluster/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ Then perform the following commands on the root folder:
214214
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` | <pre>[<br> "10.0.0.0/8",<br> "172.16.0.0/12",<br> "192.168.0.0/16"<br>]</pre> | no |
215215
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
216216
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
217-
| protect\_config | (beta) Enable/Disable Protect API features for the cluster. | <pre>object({<br> workload_vulnerability_mode = string,<br> workload_config = object({<br> audit_mode = string<br> })<br> }<br> )</pre> | <pre>{<br> "workload_config": {<br> "audit_mode": "MODE_UNSPECIFIED"<br> },<br> "workload_vulnerability_mode": ""<br>}</pre> | no |
218217
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
219218
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |
220219
| registry\_project\_ids | Projects holding Google Container Registries. If empty, we use the cluster project. If a service account is created and the `grant_registry_access` variable is set to `true`, the `storage.objectViewer` and `artifactregsitry.reader` roles are assigned on these projects. | `list(string)` | `[]` | no |
@@ -232,6 +231,8 @@ Then perform the following commands on the root folder:
232231
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
233232
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
234233
| windows\_node\_pools | List of maps containing Windows node pools | `list(map(string))` | `[]` | no |
234+
| workload\_config\_audit\_mode | (beta) Worload config audit mode. | `string` | `"DISABLED"` | no |
235+
| workload\_vulnerability\_mode | (beta) Vulnerability mode. | `string` | `""` | no |
235236
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
236237

237238
## Outputs

modules/beta-public-cluster/cluster.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ resource "google_container_cluster" "primary" {
259259

260260
protect_config {
261261
workload_config {
262-
audit_mode = var.protect_config.workload_config.audit_mode
262+
audit_mode = var.workload_config_audit_mode
263263
}
264-
workload_vulnerability_mode = var.protect_config.workload_vulnerability_mode
264+
workload_vulnerability_mode = var.workload_vulnerability_mode
265265
}
266266
ip_allocation_policy {
267267
cluster_secondary_range_name = var.ip_range_pods

modules/beta-public-cluster/variables.tf

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -696,20 +696,14 @@ variable "enable_identity_service" {
696696
default = false
697697
}
698698

699-
variable "protect_config" {
700-
description = "(beta) Enable/Disable Protect API features for the cluster."
701-
type = object({
702-
workload_vulnerability_mode = string,
703-
workload_config = object({
704-
audit_mode = string
705-
})
706-
}
707-
)
699+
variable "workload_vulnerability_mode" {
700+
description = "(beta) Vulnerability mode."
701+
type = string
702+
default = ""
703+
}
708704

709-
default = {
710-
workload_vulnerability_mode = ""
711-
workload_config = {
712-
audit_mode = "MODE_UNSPECIFIED"
713-
}
714-
}
705+
variable "workload_config_audit_mode" {
706+
description = "(beta) Worload config audit mode."
707+
type = string
708+
default = "DISABLED"
715709
}

0 commit comments

Comments
 (0)