Skip to content

Commit d252579

Browse files
authored
feat!: Add protect_config beta feature (terraform-google-modules#1617)
feat!: add protect_config beta feature
1 parent 2fe1715 commit d252579

File tree

20 files changed

+138
-0
lines changed

20 files changed

+138
-0
lines changed

autogen/main/cluster.tf.tmpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,13 @@ resource "google_container_cluster" "primary" {
315315

316316
{% if beta_cluster %}
317317
networking_mode = "VPC_NATIVE"
318+
319+
protect_config {
320+
workload_config {
321+
audit_mode = var.workload_config_audit_mode
322+
}
323+
workload_vulnerability_mode = var.workload_vulnerability_mode
324+
}
318325
{% endif %}
319326
ip_allocation_policy {
320327
cluster_secondary_range_name = var.ip_range_pods

autogen/main/variables.tf.tmpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,17 @@ variable "enable_confidential_nodes" {
530530
description = "An optional flag to enable confidential node config."
531531
default = false
532532
}
533+
variable "workload_vulnerability_mode" {
534+
description = "(beta) Vulnerability mode."
535+
type = string
536+
default = ""
537+
}
538+
539+
variable "workload_config_audit_mode" {
540+
description = "(beta) Worload config audit mode."
541+
type = string
542+
default = "DISABLED"
543+
}
533544
{% endif %}
534545

535546
variable "disable_default_snat" {

modules/beta-autopilot-private-cluster/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ Then perform the following commands on the root folder:
129129
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
130130
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
131131
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
132+
| workload\_config\_audit\_mode | (beta) Worload config audit mode. | `string` | `"DISABLED"` | no |
133+
| workload\_vulnerability\_mode | (beta) Vulnerability mode. | `string` | `""` | no |
132134
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
133135

134136
## Outputs

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ resource "google_container_cluster" "primary" {
128128
}
129129

130130
networking_mode = "VPC_NATIVE"
131+
132+
protect_config {
133+
workload_config {
134+
audit_mode = var.workload_config_audit_mode
135+
}
136+
workload_vulnerability_mode = var.workload_vulnerability_mode
137+
}
131138
ip_allocation_policy {
132139
cluster_secondary_range_name = var.ip_range_pods
133140
services_secondary_range_name = var.ip_range_services

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,17 @@ variable "enable_confidential_nodes" {
366366
description = "An optional flag to enable confidential node config."
367367
default = false
368368
}
369+
variable "workload_vulnerability_mode" {
370+
description = "(beta) Vulnerability mode."
371+
type = string
372+
default = ""
373+
}
374+
375+
variable "workload_config_audit_mode" {
376+
description = "(beta) Worload config audit mode."
377+
type = string
378+
default = "DISABLED"
379+
}
369380

370381
variable "disable_default_snat" {
371382
type = bool

modules/beta-autopilot-public-cluster/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ Then perform the following commands on the root folder:
118118
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
119119
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
120120
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
121+
| workload\_config\_audit\_mode | (beta) Worload config audit mode. | `string` | `"DISABLED"` | no |
122+
| workload\_vulnerability\_mode | (beta) Vulnerability mode. | `string` | `""` | no |
121123
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
122124

123125
## Outputs

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ resource "google_container_cluster" "primary" {
128128
}
129129

130130
networking_mode = "VPC_NATIVE"
131+
132+
protect_config {
133+
workload_config {
134+
audit_mode = var.workload_config_audit_mode
135+
}
136+
workload_vulnerability_mode = var.workload_vulnerability_mode
137+
}
131138
ip_allocation_policy {
132139
cluster_secondary_range_name = var.ip_range_pods
133140
services_secondary_range_name = var.ip_range_services

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,17 @@ variable "enable_confidential_nodes" {
336336
description = "An optional flag to enable confidential node config."
337337
default = false
338338
}
339+
variable "workload_vulnerability_mode" {
340+
description = "(beta) Vulnerability mode."
341+
type = string
342+
default = ""
343+
}
344+
345+
variable "workload_config_audit_mode" {
346+
description = "(beta) Worload config audit mode."
347+
type = string
348+
default = "DISABLED"
349+
}
339350

340351
variable "disable_default_snat" {
341352
type = bool

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ Then perform the following commands on the root folder:
264264
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
265265
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
266266
| 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 |
267269
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
268270

269271
## Outputs

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ resource "google_container_cluster" "primary" {
256256
datapath_provider = var.datapath_provider
257257

258258
networking_mode = "VPC_NATIVE"
259+
260+
protect_config {
261+
workload_config {
262+
audit_mode = var.workload_config_audit_mode
263+
}
264+
workload_vulnerability_mode = var.workload_vulnerability_mode
265+
}
259266
ip_allocation_policy {
260267
cluster_secondary_range_name = var.ip_range_pods
261268
services_secondary_range_name = var.ip_range_services

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,17 @@ variable "enable_confidential_nodes" {
502502
description = "An optional flag to enable confidential node config."
503503
default = false
504504
}
505+
variable "workload_vulnerability_mode" {
506+
description = "(beta) Vulnerability mode."
507+
type = string
508+
default = ""
509+
}
510+
511+
variable "workload_config_audit_mode" {
512+
description = "(beta) Worload config audit mode."
513+
type = string
514+
default = "DISABLED"
515+
}
505516

506517
variable "disable_default_snat" {
507518
type = bool

modules/beta-private-cluster/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ Then perform the following commands on the root folder:
242242
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
243243
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
244244
| 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 |
245247
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
246248

247249
## Outputs

modules/beta-private-cluster/cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ resource "google_container_cluster" "primary" {
256256
datapath_provider = var.datapath_provider
257257

258258
networking_mode = "VPC_NATIVE"
259+
260+
protect_config {
261+
workload_config {
262+
audit_mode = var.workload_config_audit_mode
263+
}
264+
workload_vulnerability_mode = var.workload_vulnerability_mode
265+
}
259266
ip_allocation_policy {
260267
cluster_secondary_range_name = var.ip_range_pods
261268
services_secondary_range_name = var.ip_range_services

modules/beta-private-cluster/variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,17 @@ variable "enable_confidential_nodes" {
502502
description = "An optional flag to enable confidential node config."
503503
default = false
504504
}
505+
variable "workload_vulnerability_mode" {
506+
description = "(beta) Vulnerability mode."
507+
type = string
508+
default = ""
509+
}
510+
511+
variable "workload_config_audit_mode" {
512+
description = "(beta) Worload config audit mode."
513+
type = string
514+
default = "DISABLED"
515+
}
505516

506517
variable "disable_default_snat" {
507518
type = bool

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ Then perform the following commands on the root folder:
253253
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
254254
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
255255
| 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 |
256258
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
257259

258260
## Outputs

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ resource "google_container_cluster" "primary" {
256256
datapath_provider = var.datapath_provider
257257

258258
networking_mode = "VPC_NATIVE"
259+
260+
protect_config {
261+
workload_config {
262+
audit_mode = var.workload_config_audit_mode
263+
}
264+
workload_vulnerability_mode = var.workload_vulnerability_mode
265+
}
259266
ip_allocation_policy {
260267
cluster_secondary_range_name = var.ip_range_pods
261268
services_secondary_range_name = var.ip_range_services

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,17 @@ variable "enable_confidential_nodes" {
472472
description = "An optional flag to enable confidential node config."
473473
default = false
474474
}
475+
variable "workload_vulnerability_mode" {
476+
description = "(beta) Vulnerability mode."
477+
type = string
478+
default = ""
479+
}
480+
481+
variable "workload_config_audit_mode" {
482+
description = "(beta) Worload config audit mode."
483+
type = string
484+
default = "DISABLED"
485+
}
475486

476487
variable "disable_default_snat" {
477488
type = bool

modules/beta-public-cluster/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ Then perform the following commands on the root folder:
231231
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
232232
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
233233
| 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 |
234236
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
235237

236238
## Outputs

modules/beta-public-cluster/cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ resource "google_container_cluster" "primary" {
256256
datapath_provider = var.datapath_provider
257257

258258
networking_mode = "VPC_NATIVE"
259+
260+
protect_config {
261+
workload_config {
262+
audit_mode = var.workload_config_audit_mode
263+
}
264+
workload_vulnerability_mode = var.workload_vulnerability_mode
265+
}
259266
ip_allocation_policy {
260267
cluster_secondary_range_name = var.ip_range_pods
261268
services_secondary_range_name = var.ip_range_services

modules/beta-public-cluster/variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,17 @@ variable "enable_confidential_nodes" {
472472
description = "An optional flag to enable confidential node config."
473473
default = false
474474
}
475+
variable "workload_vulnerability_mode" {
476+
description = "(beta) Vulnerability mode."
477+
type = string
478+
default = ""
479+
}
480+
481+
variable "workload_config_audit_mode" {
482+
description = "(beta) Worload config audit mode."
483+
type = string
484+
default = "DISABLED"
485+
}
475486

476487
variable "disable_default_snat" {
477488
type = bool

0 commit comments

Comments
 (0)