Skip to content

Commit 4a85321

Browse files
authored
feat: added notification_config block to beta submodules (#752)
* feat: added notification_config block * fix: terraform fmt * fix: required_providers set to 3.42.0 * fix: google-beta only * fix: removed `enable_notification_config` * fix: terraform fmt
1 parent 166fb24 commit 4a85321

File tree

31 files changed

+111
-5
lines changed

31 files changed

+111
-5
lines changed

autogen/main/cluster.tf.tmpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,13 @@ resource "google_container_cluster" "primary" {
306306
security_group = authenticator_groups_config.value.security_group
307307
}
308308
}
309+
310+
notification_config {
311+
pubsub {
312+
enabled = var.notification_config_topic != "" ? true : false
313+
topic = var.notification_config_topic
314+
}
315+
}
309316
{% endif %}
310317
}
311318

autogen/main/variables.tf.tmpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,3 +574,11 @@ variable "impersonate_service_account" {
574574
description = "An optional service account to impersonate for gcloud commands. If this service account is not specified, the module will use Application Default Credentials."
575575
default = ""
576576
}
577+
578+
{% if beta_cluster %}
579+
variable "notification_config_topic" {
580+
type = string
581+
description = "The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}."
582+
default = ""
583+
}
584+
{% endif %}

autogen/main/versions.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ terraform {
1919

2020
required_providers {
2121
{% if beta_cluster %}
22-
google-beta = ">= 3.32.0, <4.0.0"
22+
google-beta = ">= 3.42.0, <4.0.0"
2323
{% else %}
2424
google = ">= 3.39.0, <4.0.0"
2525
{% endif %}

autogen/safer-cluster/main.tf.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,6 @@ module "gke" {
166166
skip_provisioners = var.skip_provisioners
167167

168168
gce_pd_csi_driver = var.gce_pd_csi_driver
169+
170+
notification_config_topic = var.notification_config_topic
169171
}

autogen/safer-cluster/variables.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,3 +369,9 @@ variable "disable_default_snat" {
369369
description = "Whether to disable the default SNAT to support the private use of public IP addresses"
370370
default = false
371371
}
372+
373+
variable "notification_config_topic" {
374+
type = string
375+
description = "The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}."
376+
default = ""
377+
}

examples/safer_cluster/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,14 @@ module "gke" {
6161

6262
istio = true
6363
cloudrun = true
64+
65+
notification_config_topic = google_pubsub_topic.updates.id
6466
}
6567

6668
data "google_client_config" "default" {
6769
}
6870

71+
resource "google_pubsub_topic" "updates" {
72+
name = "cluster-updates-${random_string.suffix.result}"
73+
project = var.project_id
74+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ Then perform the following commands on the root folder:
214214
| node\_pools\_tags | Map of lists containing node network tags by node-pool name | `map(list(string))` | <pre>{<br> "all": [],<br> "default-node-pool": []<br>}</pre> | no |
215215
| node\_pools\_taints | Map of lists containing node taints by node-pool name | `map(list(object({ key = string, value = string, effect = string })))` | <pre>{<br> "all": [],<br> "default-node-pool": []<br>}</pre> | no |
216216
| 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 |
217+
| notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no |
217218
| project\_id | The project ID to host the cluster in (required) | `string` | n/a | yes |
218219
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | `string` | `null` | no |
219220
| 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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,13 @@ resource "google_container_cluster" "primary" {
276276
security_group = authenticator_groups_config.value.security_group
277277
}
278278
}
279+
280+
notification_config {
281+
pubsub {
282+
enabled = var.notification_config_topic != "" ? true : false
283+
topic = var.notification_config_topic
284+
}
285+
}
279286
}
280287

281288
/******************************************

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,3 +556,9 @@ variable "impersonate_service_account" {
556556
description = "An optional service account to impersonate for gcloud commands. If this service account is not specified, the module will use Application Default Credentials."
557557
default = ""
558558
}
559+
560+
variable "notification_config_topic" {
561+
type = string
562+
description = "The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}."
563+
default = ""
564+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ terraform {
1818
required_version = ">=0.12.6, <0.14"
1919

2020
required_providers {
21-
google-beta = ">= 3.32.0, <4.0.0"
21+
google-beta = ">= 3.42.0, <4.0.0"
2222
}
2323
}

0 commit comments

Comments
 (0)