Skip to content

Commit 30af35e

Browse files
committed
feat: add support for private_endpoint_subnetwork in beta submodules
1 parent b4f2e14 commit 30af35e

File tree

17 files changed

+89
-36
lines changed

17 files changed

+89
-36
lines changed

autogen/main/cluster.tf.tmpl

+8-6
Original file line numberDiff line numberDiff line change
@@ -569,15 +569,17 @@ resource "google_container_cluster" "primary" {
569569
{% if private_cluster %}
570570
dynamic "private_cluster_config" {
571571
for_each = var.enable_private_nodes ? [{
572-
enable_private_nodes = var.enable_private_nodes,
573-
enable_private_endpoint = var.enable_private_endpoint
574-
master_ipv4_cidr_block = var.master_ipv4_cidr_block
572+
enable_private_nodes = var.enable_private_nodes,
573+
enable_private_endpoint = var.enable_private_endpoint
574+
master_ipv4_cidr_block = var.master_ipv4_cidr_block
575+
private_endpoint_subnetwork = var.private_endpoint_subnetwork
575576
}] : []
576577

577578
content {
578-
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
579-
enable_private_nodes = private_cluster_config.value.enable_private_nodes
580-
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
579+
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
580+
enable_private_nodes = private_cluster_config.value.enable_private_nodes
581+
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
582+
private_endpoint_subnetwork = private_cluster_config.value.private_endpoint_subnetwork
581583
dynamic "master_global_access_config" {
582584
for_each = var.master_global_access_enabled ? [var.master_global_access_enabled] : []
583585
content {

autogen/main/variables.tf.tmpl

+6
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,12 @@ variable "master_ipv4_cidr_block" {
469469
{% endif %}
470470
}
471471

472+
variable "private_endpoint_subnetwork" {
473+
type = string
474+
description = "The subnetwork to use for the hosted master network."
475+
default = null
476+
}
477+
472478
variable "master_global_access_enabled" {
473479
type = bool
474480
description = "Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint."

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

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ Then perform the following commands on the root folder:
132132
| 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 |
133133
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
134134
| notification\_filter\_event\_type | Choose what type of notifications you want to receive. If no filters are applied, you'll receive all notification types. Can be used to filter what notifications are sent. Accepted values are UPGRADE\_AVAILABLE\_EVENT, UPGRADE\_EVENT, and SECURITY\_BULLETIN\_EVENT. | `list(string)` | `[]` | no |
135+
| private\_endpoint\_subnetwork | The subnetwork to use for the hosted master network. | `string` | `null` | no |
135136
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
136137
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
137138
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |

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

+8-6
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,17 @@ resource "google_container_cluster" "primary" {
262262

263263
dynamic "private_cluster_config" {
264264
for_each = var.enable_private_nodes ? [{
265-
enable_private_nodes = var.enable_private_nodes,
266-
enable_private_endpoint = var.enable_private_endpoint
267-
master_ipv4_cidr_block = var.master_ipv4_cidr_block
265+
enable_private_nodes = var.enable_private_nodes,
266+
enable_private_endpoint = var.enable_private_endpoint
267+
master_ipv4_cidr_block = var.master_ipv4_cidr_block
268+
private_endpoint_subnetwork = var.private_endpoint_subnetwork
268269
}] : []
269270

270271
content {
271-
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
272-
enable_private_nodes = private_cluster_config.value.enable_private_nodes
273-
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
272+
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
273+
enable_private_nodes = private_cluster_config.value.enable_private_nodes
274+
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
275+
private_endpoint_subnetwork = private_cluster_config.value.private_endpoint_subnetwork
274276
dynamic "master_global_access_config" {
275277
for_each = var.master_global_access_enabled ? [var.master_global_access_enabled] : []
276278
content {

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

+6
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ variable "master_ipv4_cidr_block" {
288288
default = null
289289
}
290290

291+
variable "private_endpoint_subnetwork" {
292+
type = string
293+
description = "The subnetwork to use for the hosted master network."
294+
default = null
295+
}
296+
291297
variable "master_global_access_enabled" {
292298
type = bool
293299
description = "Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint."

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

+1
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ Then perform the following commands on the root folder:
273273
| 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 |
274274
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
275275
| notification\_filter\_event\_type | Choose what type of notifications you want to receive. If no filters are applied, you'll receive all notification types. Can be used to filter what notifications are sent. Accepted values are UPGRADE\_AVAILABLE\_EVENT, UPGRADE\_EVENT, and SECURITY\_BULLETIN\_EVENT. | `list(string)` | `[]` | no |
276+
| private\_endpoint\_subnetwork | The subnetwork to use for the hosted master network. | `string` | `null` | no |
276277
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
277278
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
278279
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |

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

+8-6
Original file line numberDiff line numberDiff line change
@@ -490,15 +490,17 @@ resource "google_container_cluster" "primary" {
490490

491491
dynamic "private_cluster_config" {
492492
for_each = var.enable_private_nodes ? [{
493-
enable_private_nodes = var.enable_private_nodes,
494-
enable_private_endpoint = var.enable_private_endpoint
495-
master_ipv4_cidr_block = var.master_ipv4_cidr_block
493+
enable_private_nodes = var.enable_private_nodes,
494+
enable_private_endpoint = var.enable_private_endpoint
495+
master_ipv4_cidr_block = var.master_ipv4_cidr_block
496+
private_endpoint_subnetwork = var.private_endpoint_subnetwork
496497
}] : []
497498

498499
content {
499-
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
500-
enable_private_nodes = private_cluster_config.value.enable_private_nodes
501-
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
500+
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
501+
enable_private_nodes = private_cluster_config.value.enable_private_nodes
502+
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
503+
private_endpoint_subnetwork = private_cluster_config.value.private_endpoint_subnetwork
502504
dynamic "master_global_access_config" {
503505
for_each = var.master_global_access_enabled ? [var.master_global_access_enabled] : []
504506
content {

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

+6
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,12 @@ variable "master_ipv4_cidr_block" {
452452
default = "10.0.0.0/28"
453453
}
454454

455+
variable "private_endpoint_subnetwork" {
456+
type = string
457+
description = "The subnetwork to use for the hosted master network."
458+
default = null
459+
}
460+
455461
variable "master_global_access_enabled" {
456462
type = bool
457463
description = "Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint."

modules/beta-private-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ Then perform the following commands on the root folder:
251251
| 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 |
252252
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
253253
| notification\_filter\_event\_type | Choose what type of notifications you want to receive. If no filters are applied, you'll receive all notification types. Can be used to filter what notifications are sent. Accepted values are UPGRADE\_AVAILABLE\_EVENT, UPGRADE\_EVENT, and SECURITY\_BULLETIN\_EVENT. | `list(string)` | `[]` | no |
254+
| private\_endpoint\_subnetwork | The subnetwork to use for the hosted master network. | `string` | `null` | no |
254255
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
255256
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
256257
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |

modules/beta-private-cluster/cluster.tf

+8-6
Original file line numberDiff line numberDiff line change
@@ -490,15 +490,17 @@ resource "google_container_cluster" "primary" {
490490

491491
dynamic "private_cluster_config" {
492492
for_each = var.enable_private_nodes ? [{
493-
enable_private_nodes = var.enable_private_nodes,
494-
enable_private_endpoint = var.enable_private_endpoint
495-
master_ipv4_cidr_block = var.master_ipv4_cidr_block
493+
enable_private_nodes = var.enable_private_nodes,
494+
enable_private_endpoint = var.enable_private_endpoint
495+
master_ipv4_cidr_block = var.master_ipv4_cidr_block
496+
private_endpoint_subnetwork = var.private_endpoint_subnetwork
496497
}] : []
497498

498499
content {
499-
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
500-
enable_private_nodes = private_cluster_config.value.enable_private_nodes
501-
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
500+
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
501+
enable_private_nodes = private_cluster_config.value.enable_private_nodes
502+
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
503+
private_endpoint_subnetwork = private_cluster_config.value.private_endpoint_subnetwork
502504
dynamic "master_global_access_config" {
503505
for_each = var.master_global_access_enabled ? [var.master_global_access_enabled] : []
504506
content {

modules/beta-private-cluster/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,12 @@ variable "master_ipv4_cidr_block" {
452452
default = "10.0.0.0/28"
453453
}
454454

455+
variable "private_endpoint_subnetwork" {
456+
type = string
457+
description = "The subnetwork to use for the hosted master network."
458+
default = null
459+
}
460+
455461
variable "master_global_access_enabled" {
456462
type = bool
457463
description = "Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint."

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

+1
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ Then perform the following commands on the root folder:
258258
| 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 |
259259
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
260260
| notification\_filter\_event\_type | Choose what type of notifications you want to receive. If no filters are applied, you'll receive all notification types. Can be used to filter what notifications are sent. Accepted values are UPGRADE\_AVAILABLE\_EVENT, UPGRADE\_EVENT, and SECURITY\_BULLETIN\_EVENT. | `list(string)` | `[]` | no |
261+
| private\_endpoint\_subnetwork | The subnetwork to use for the hosted master network. | `string` | `null` | no |
261262
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
262263
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
263264
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |

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

+8-6
Original file line numberDiff line numberDiff line change
@@ -436,15 +436,17 @@ resource "google_container_cluster" "primary" {
436436

437437
dynamic "private_cluster_config" {
438438
for_each = var.enable_private_nodes ? [{
439-
enable_private_nodes = var.enable_private_nodes,
440-
enable_private_endpoint = var.enable_private_endpoint
441-
master_ipv4_cidr_block = var.master_ipv4_cidr_block
439+
enable_private_nodes = var.enable_private_nodes,
440+
enable_private_endpoint = var.enable_private_endpoint
441+
master_ipv4_cidr_block = var.master_ipv4_cidr_block
442+
private_endpoint_subnetwork = var.private_endpoint_subnetwork
442443
}] : []
443444

444445
content {
445-
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
446-
enable_private_nodes = private_cluster_config.value.enable_private_nodes
447-
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
446+
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
447+
enable_private_nodes = private_cluster_config.value.enable_private_nodes
448+
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
449+
private_endpoint_subnetwork = private_cluster_config.value.private_endpoint_subnetwork
448450
dynamic "master_global_access_config" {
449451
for_each = var.master_global_access_enabled ? [var.master_global_access_enabled] : []
450452
content {

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

+6
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,12 @@ variable "master_ipv4_cidr_block" {
446446
default = "10.0.0.0/28"
447447
}
448448

449+
variable "private_endpoint_subnetwork" {
450+
type = string
451+
description = "The subnetwork to use for the hosted master network."
452+
default = null
453+
}
454+
449455
variable "master_global_access_enabled" {
450456
type = bool
451457
description = "Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint."

modules/private-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ 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
| notification\_filter\_event\_type | Choose what type of notifications you want to receive. If no filters are applied, you'll receive all notification types. Can be used to filter what notifications are sent. Accepted values are UPGRADE\_AVAILABLE\_EVENT, UPGRADE\_EVENT, and SECURITY\_BULLETIN\_EVENT. | `list(string)` | `[]` | no |
239+
| private\_endpoint\_subnetwork | The subnetwork to use for the hosted master network. | `string` | `null` | no |
239240
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
240241
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
241242
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | `bool` | `true` | no |

modules/private-cluster/cluster.tf

+8-6
Original file line numberDiff line numberDiff line change
@@ -436,15 +436,17 @@ resource "google_container_cluster" "primary" {
436436

437437
dynamic "private_cluster_config" {
438438
for_each = var.enable_private_nodes ? [{
439-
enable_private_nodes = var.enable_private_nodes,
440-
enable_private_endpoint = var.enable_private_endpoint
441-
master_ipv4_cidr_block = var.master_ipv4_cidr_block
439+
enable_private_nodes = var.enable_private_nodes,
440+
enable_private_endpoint = var.enable_private_endpoint
441+
master_ipv4_cidr_block = var.master_ipv4_cidr_block
442+
private_endpoint_subnetwork = var.private_endpoint_subnetwork
442443
}] : []
443444

444445
content {
445-
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
446-
enable_private_nodes = private_cluster_config.value.enable_private_nodes
447-
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
446+
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
447+
enable_private_nodes = private_cluster_config.value.enable_private_nodes
448+
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
449+
private_endpoint_subnetwork = private_cluster_config.value.private_endpoint_subnetwork
448450
dynamic "master_global_access_config" {
449451
for_each = var.master_global_access_enabled ? [var.master_global_access_enabled] : []
450452
content {

modules/private-cluster/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,12 @@ variable "master_ipv4_cidr_block" {
446446
default = "10.0.0.0/28"
447447
}
448448

449+
variable "private_endpoint_subnetwork" {
450+
type = string
451+
description = "The subnetwork to use for the hosted master network."
452+
default = null
453+
}
454+
449455
variable "master_global_access_enabled" {
450456
type = bool
451457
description = "Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint."

0 commit comments

Comments
 (0)