Skip to content

Commit 7f31e96

Browse files
arthurpangapeabody
andauthored
feat: extend enable_secret_manager_addon to beta-autopilot clusters (#2017)
Co-authored-by: Andrew Peabody <andrewpeabody@google.com>
1 parent c0f05fb commit 7f31e96

File tree

16 files changed

+86
-65
lines changed

16 files changed

+86
-65
lines changed

Diff for: autogen/main/cluster.tf.tmpl

+7-7
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,6 @@ resource "google_container_cluster" "primary" {
228228
enable_intranode_visibility = var.enable_intranode_visibility
229229

230230
{% if beta_cluster %}
231-
dynamic "secret_manager_config" {
232-
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
233-
content {
234-
enabled = secret_manager_config.value
235-
}
236-
}
237-
238231
dynamic "pod_security_policy_config" {
239232
for_each = var.enable_pod_security_policy ? [var.enable_pod_security_policy] : []
240233
content {
@@ -249,6 +242,13 @@ resource "google_container_cluster" "primary" {
249242
enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy
250243

251244
{% if beta_cluster %}
245+
dynamic "secret_manager_config" {
246+
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
247+
content {
248+
enabled = secret_manager_config.value
249+
}
250+
}
251+
252252
enable_fqdn_network_policy = var.enable_fqdn_network_policy
253253
{% endif %}
254254
{% if autopilot_cluster %}

Diff for: autogen/main/variables.tf.tmpl

+5-6
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,11 @@ variable "enable_fqdn_network_policy" {
593593
default = null
594594
}
595595

596+
variable "enable_secret_manager_addon" {
597+
description = "(Beta) Enable the Secret Manager add-on for this cluster"
598+
type = bool
599+
default = false
600+
}
596601
{% endif %}
597602

598603
variable "enable_cilium_clusterwide_network_policy" {
@@ -889,12 +894,6 @@ variable "enable_pod_security_policy" {
889894
default = false
890895
}
891896

892-
variable "enable_secret_manager_addon" {
893-
description = "(Beta) Enable the Secret Manager add-on for this cluster"
894-
type = bool
895-
default = false
896-
}
897-
898897
variable "sandbox_enabled" {
899898
type = bool
900899
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."

Diff for: modules/beta-autopilot-private-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Then perform the following commands on the root folder:
9797
| enable\_private\_endpoint | Whether the master's internal IP address is used as the cluster endpoint | `bool` | `false` | no |
9898
| enable\_private\_nodes | Whether nodes have internal IP addresses only | `bool` | `false` | no |
9999
| enable\_resource\_consumption\_export | Whether to enable resource consumption metering on this cluster. When enabled, a table will be created in the resource export BigQuery dataset to store resource consumption data. The resulting table can be joined with the resource usage table or with BigQuery billing export. | `bool` | `true` | no |
100+
| enable\_secret\_manager\_addon | (Beta) Enable the Secret Manager add-on for this cluster | `bool` | `false` | no |
100101
| enable\_tpu | Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive! | `bool` | `false` | no |
101102
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | `bool` | `true` | no |
102103
| firewall\_inbound\_ports | List of TCP ports for admission/webhook controllers. Either flag `add_master_webhook_firewall_rules` or `add_cluster_firewall_rules` (also adds egress rules) must be set to `true` for inbound-ports firewall rules to be applied. | `list(string)` | <pre>[<br> "8443",<br> "9443",<br> "15017"<br>]</pre> | no |

Diff for: modules/beta-autopilot-private-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ resource "google_container_cluster" "primary" {
8989

9090
enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy
9191

92+
dynamic "secret_manager_config" {
93+
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
94+
content {
95+
enabled = secret_manager_config.value
96+
}
97+
}
98+
9299
enable_fqdn_network_policy = var.enable_fqdn_network_policy
93100
enable_autopilot = true
94101
dynamic "master_authorized_networks_config" {

Diff for: modules/beta-autopilot-private-cluster/variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,11 @@ variable "enable_fqdn_network_policy" {
399399
default = null
400400
}
401401

402+
variable "enable_secret_manager_addon" {
403+
description = "(Beta) Enable the Secret Manager add-on for this cluster"
404+
type = bool
405+
default = false
406+
}
402407

403408
variable "enable_cilium_clusterwide_network_policy" {
404409
type = bool

Diff for: modules/beta-autopilot-public-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Then perform the following commands on the root folder:
8888
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `bool` | `false` | no |
8989
| enable\_network\_egress\_export | Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | `bool` | `false` | no |
9090
| enable\_resource\_consumption\_export | Whether to enable resource consumption metering on this cluster. When enabled, a table will be created in the resource export BigQuery dataset to store resource consumption data. The resulting table can be joined with the resource usage table or with BigQuery billing export. | `bool` | `true` | no |
91+
| enable\_secret\_manager\_addon | (Beta) Enable the Secret Manager add-on for this cluster | `bool` | `false` | no |
9192
| enable\_tpu | Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive! | `bool` | `false` | no |
9293
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | `bool` | `true` | no |
9394
| firewall\_inbound\_ports | List of TCP ports for admission/webhook controllers. Either flag `add_master_webhook_firewall_rules` or `add_cluster_firewall_rules` (also adds egress rules) must be set to `true` for inbound-ports firewall rules to be applied. | `list(string)` | <pre>[<br> "8443",<br> "9443",<br> "15017"<br>]</pre> | no |

Diff for: modules/beta-autopilot-public-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ resource "google_container_cluster" "primary" {
8989

9090
enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy
9191

92+
dynamic "secret_manager_config" {
93+
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
94+
content {
95+
enabled = secret_manager_config.value
96+
}
97+
}
98+
9299
enable_fqdn_network_policy = var.enable_fqdn_network_policy
93100
enable_autopilot = true
94101
dynamic "master_authorized_networks_config" {

Diff for: modules/beta-autopilot-public-cluster/variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,11 @@ variable "enable_fqdn_network_policy" {
369369
default = null
370370
}
371371

372+
variable "enable_secret_manager_addon" {
373+
description = "(Beta) Enable the Secret Manager add-on for this cluster"
374+
type = bool
375+
default = false
376+
}
372377

373378
variable "enable_cilium_clusterwide_network_policy" {
374379
type = bool

Diff for: modules/beta-private-cluster-update-variant/cluster.tf

+7-7
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,6 @@ resource "google_container_cluster" "primary" {
191191
enable_tpu = var.enable_tpu
192192
enable_intranode_visibility = var.enable_intranode_visibility
193193

194-
dynamic "secret_manager_config" {
195-
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
196-
content {
197-
enabled = secret_manager_config.value
198-
}
199-
}
200-
201194
dynamic "pod_security_policy_config" {
202195
for_each = var.enable_pod_security_policy ? [var.enable_pod_security_policy] : []
203196
content {
@@ -209,6 +202,13 @@ resource "google_container_cluster" "primary" {
209202

210203
enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy
211204

205+
dynamic "secret_manager_config" {
206+
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
207+
content {
208+
enabled = secret_manager_config.value
209+
}
210+
}
211+
212212
enable_fqdn_network_policy = var.enable_fqdn_network_policy
213213
dynamic "master_authorized_networks_config" {
214214
for_each = local.master_authorized_networks_config

Diff for: modules/beta-private-cluster-update-variant/variables.tf

+5-6
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,11 @@ variable "enable_fqdn_network_policy" {
568568
default = null
569569
}
570570

571+
variable "enable_secret_manager_addon" {
572+
description = "(Beta) Enable the Secret Manager add-on for this cluster"
573+
type = bool
574+
default = false
575+
}
571576

572577
variable "enable_cilium_clusterwide_network_policy" {
573578
type = bool
@@ -849,12 +854,6 @@ variable "enable_pod_security_policy" {
849854
default = false
850855
}
851856

852-
variable "enable_secret_manager_addon" {
853-
description = "(Beta) Enable the Secret Manager add-on for this cluster"
854-
type = bool
855-
default = false
856-
}
857-
858857
variable "sandbox_enabled" {
859858
type = bool
860859
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."

Diff for: modules/beta-private-cluster/cluster.tf

+7-7
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,6 @@ resource "google_container_cluster" "primary" {
191191
enable_tpu = var.enable_tpu
192192
enable_intranode_visibility = var.enable_intranode_visibility
193193

194-
dynamic "secret_manager_config" {
195-
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
196-
content {
197-
enabled = secret_manager_config.value
198-
}
199-
}
200-
201194
dynamic "pod_security_policy_config" {
202195
for_each = var.enable_pod_security_policy ? [var.enable_pod_security_policy] : []
203196
content {
@@ -209,6 +202,13 @@ resource "google_container_cluster" "primary" {
209202

210203
enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy
211204

205+
dynamic "secret_manager_config" {
206+
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
207+
content {
208+
enabled = secret_manager_config.value
209+
}
210+
}
211+
212212
enable_fqdn_network_policy = var.enable_fqdn_network_policy
213213
dynamic "master_authorized_networks_config" {
214214
for_each = local.master_authorized_networks_config

Diff for: modules/beta-private-cluster/variables.tf

+5-6
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,11 @@ variable "enable_fqdn_network_policy" {
568568
default = null
569569
}
570570

571+
variable "enable_secret_manager_addon" {
572+
description = "(Beta) Enable the Secret Manager add-on for this cluster"
573+
type = bool
574+
default = false
575+
}
571576

572577
variable "enable_cilium_clusterwide_network_policy" {
573578
type = bool
@@ -849,12 +854,6 @@ variable "enable_pod_security_policy" {
849854
default = false
850855
}
851856

852-
variable "enable_secret_manager_addon" {
853-
description = "(Beta) Enable the Secret Manager add-on for this cluster"
854-
type = bool
855-
default = false
856-
}
857-
858857
variable "sandbox_enabled" {
859858
type = bool
860859
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."

Diff for: modules/beta-public-cluster-update-variant/cluster.tf

+7-7
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,6 @@ resource "google_container_cluster" "primary" {
191191
enable_tpu = var.enable_tpu
192192
enable_intranode_visibility = var.enable_intranode_visibility
193193

194-
dynamic "secret_manager_config" {
195-
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
196-
content {
197-
enabled = secret_manager_config.value
198-
}
199-
}
200-
201194
dynamic "pod_security_policy_config" {
202195
for_each = var.enable_pod_security_policy ? [var.enable_pod_security_policy] : []
203196
content {
@@ -209,6 +202,13 @@ resource "google_container_cluster" "primary" {
209202

210203
enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy
211204

205+
dynamic "secret_manager_config" {
206+
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
207+
content {
208+
enabled = secret_manager_config.value
209+
}
210+
}
211+
212212
enable_fqdn_network_policy = var.enable_fqdn_network_policy
213213
dynamic "master_authorized_networks_config" {
214214
for_each = local.master_authorized_networks_config

Diff for: modules/beta-public-cluster-update-variant/variables.tf

+5-6
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,11 @@ variable "enable_fqdn_network_policy" {
538538
default = null
539539
}
540540

541+
variable "enable_secret_manager_addon" {
542+
description = "(Beta) Enable the Secret Manager add-on for this cluster"
543+
type = bool
544+
default = false
545+
}
541546

542547
variable "enable_cilium_clusterwide_network_policy" {
543548
type = bool
@@ -819,12 +824,6 @@ variable "enable_pod_security_policy" {
819824
default = false
820825
}
821826

822-
variable "enable_secret_manager_addon" {
823-
description = "(Beta) Enable the Secret Manager add-on for this cluster"
824-
type = bool
825-
default = false
826-
}
827-
828827
variable "sandbox_enabled" {
829828
type = bool
830829
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."

Diff for: modules/beta-public-cluster/cluster.tf

+7-7
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,6 @@ resource "google_container_cluster" "primary" {
191191
enable_tpu = var.enable_tpu
192192
enable_intranode_visibility = var.enable_intranode_visibility
193193

194-
dynamic "secret_manager_config" {
195-
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
196-
content {
197-
enabled = secret_manager_config.value
198-
}
199-
}
200-
201194
dynamic "pod_security_policy_config" {
202195
for_each = var.enable_pod_security_policy ? [var.enable_pod_security_policy] : []
203196
content {
@@ -209,6 +202,13 @@ resource "google_container_cluster" "primary" {
209202

210203
enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy
211204

205+
dynamic "secret_manager_config" {
206+
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
207+
content {
208+
enabled = secret_manager_config.value
209+
}
210+
}
211+
212212
enable_fqdn_network_policy = var.enable_fqdn_network_policy
213213
dynamic "master_authorized_networks_config" {
214214
for_each = local.master_authorized_networks_config

Diff for: modules/beta-public-cluster/variables.tf

+5-6
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,11 @@ variable "enable_fqdn_network_policy" {
538538
default = null
539539
}
540540

541+
variable "enable_secret_manager_addon" {
542+
description = "(Beta) Enable the Secret Manager add-on for this cluster"
543+
type = bool
544+
default = false
545+
}
541546

542547
variable "enable_cilium_clusterwide_network_policy" {
543548
type = bool
@@ -819,12 +824,6 @@ variable "enable_pod_security_policy" {
819824
default = false
820825
}
821826

822-
variable "enable_secret_manager_addon" {
823-
description = "(Beta) Enable the Secret Manager add-on for this cluster"
824-
type = bool
825-
default = false
826-
}
827-
828827
variable "sandbox_enabled" {
829828
type = bool
830829
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."

0 commit comments

Comments
 (0)