Skip to content

Commit 146b2e7

Browse files
christiangonrebharathkkb
andauthoredMay 11, 2023
feat: Add timeouts variable for safer cluster module (#1613)
Co-authored-by: Bharath KKB <bharathkrishnakb@gmail.com>
1 parent e957469 commit 146b2e7

File tree

8 files changed

+38
-0
lines changed

8 files changed

+38
-0
lines changed
 

‎autogen/safer-cluster/main.tf.tmpl

+2
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,6 @@ module "gke" {
193193
filestore_csi_driver = var.filestore_csi_driver
194194

195195
notification_config_topic = var.notification_config_topic
196+
197+
timeouts = var.timeouts
196198
}

‎autogen/safer-cluster/variables.tf.tmpl

+10
Original file line numberDiff line numberDiff line change
@@ -474,3 +474,13 @@ variable "notification_config_topic" {
474474
description = "The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}."
475475
default = ""
476476
}
477+
478+
variable "timeouts" {
479+
type = map(string)
480+
description = "Timeout for cluster operations."
481+
default = {}
482+
validation {
483+
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
484+
error_message = "Only create, update, delete timeouts can be specified."
485+
}
486+
}

‎modules/safer-cluster-update-variant/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ For simplicity, we suggest using `roles/container.admin` and
267267
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it). | `bool` | `false` | no |
268268
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |
269269
| subnetwork | The subnetwork to host the cluster in | `string` | n/a | yes |
270+
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
270271
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
271272
| windows\_node\_pools | List of maps containing node pools | `list(map(string))` | `[]` | no |
272273
| zones | The zones to host the cluster in | `list(string)` | `[]` | no |

‎modules/safer-cluster-update-variant/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,6 @@ module "gke" {
189189
filestore_csi_driver = var.filestore_csi_driver
190190

191191
notification_config_topic = var.notification_config_topic
192+
193+
timeouts = var.timeouts
192194
}

‎modules/safer-cluster-update-variant/variables.tf

+10
Original file line numberDiff line numberDiff line change
@@ -474,3 +474,13 @@ variable "notification_config_topic" {
474474
description = "The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}."
475475
default = ""
476476
}
477+
478+
variable "timeouts" {
479+
type = map(string)
480+
description = "Timeout for cluster operations."
481+
default = {}
482+
validation {
483+
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
484+
error_message = "Only create, update, delete timeouts can be specified."
485+
}
486+
}

‎modules/safer-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ For simplicity, we suggest using `roles/container.admin` and
267267
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it). | `bool` | `false` | no |
268268
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |
269269
| subnetwork | The subnetwork to host the cluster in | `string` | n/a | yes |
270+
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
270271
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
271272
| windows\_node\_pools | List of maps containing node pools | `list(map(string))` | `[]` | no |
272273
| zones | The zones to host the cluster in | `list(string)` | `[]` | no |

‎modules/safer-cluster/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,6 @@ module "gke" {
189189
filestore_csi_driver = var.filestore_csi_driver
190190

191191
notification_config_topic = var.notification_config_topic
192+
193+
timeouts = var.timeouts
192194
}

‎modules/safer-cluster/variables.tf

+10
Original file line numberDiff line numberDiff line change
@@ -474,3 +474,13 @@ variable "notification_config_topic" {
474474
description = "The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}."
475475
default = ""
476476
}
477+
478+
variable "timeouts" {
479+
type = map(string)
480+
description = "Timeout for cluster operations."
481+
default = {}
482+
validation {
483+
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
484+
error_message = "Only create, update, delete timeouts can be specified."
485+
}
486+
}

0 commit comments

Comments
 (0)