From 6011c80f139abeecccaeb157e0a93ab28ceb7aab Mon Sep 17 00:00:00 2001 From: Bharath KKB Date: Wed, 1 Jun 2022 13:07:33 -0500 Subject: [PATCH] feat: expose timeouts --- README.md | 1 + autogen/main/cluster.tf.tmpl | 12 ++++++------ autogen/main/variables.tf.tmpl | 10 ++++++++++ cluster.tf | 12 ++++++------ modules/beta-autopilot-private-cluster/README.md | 1 + modules/beta-autopilot-private-cluster/cluster.tf | 6 +++--- modules/beta-autopilot-private-cluster/variables.tf | 10 ++++++++++ modules/beta-autopilot-public-cluster/README.md | 1 + modules/beta-autopilot-public-cluster/cluster.tf | 6 +++--- modules/beta-autopilot-public-cluster/variables.tf | 10 ++++++++++ .../beta-private-cluster-update-variant/README.md | 1 + .../beta-private-cluster-update-variant/cluster.tf | 12 ++++++------ .../beta-private-cluster-update-variant/variables.tf | 10 ++++++++++ modules/beta-private-cluster/README.md | 1 + modules/beta-private-cluster/cluster.tf | 12 ++++++------ modules/beta-private-cluster/variables.tf | 10 ++++++++++ modules/beta-public-cluster-update-variant/README.md | 1 + .../beta-public-cluster-update-variant/cluster.tf | 12 ++++++------ .../beta-public-cluster-update-variant/variables.tf | 10 ++++++++++ modules/beta-public-cluster/README.md | 1 + modules/beta-public-cluster/cluster.tf | 12 ++++++------ modules/beta-public-cluster/variables.tf | 10 ++++++++++ modules/private-cluster-update-variant/README.md | 1 + modules/private-cluster-update-variant/cluster.tf | 12 ++++++------ modules/private-cluster-update-variant/variables.tf | 10 ++++++++++ modules/private-cluster/README.md | 1 + modules/private-cluster/cluster.tf | 12 ++++++------ modules/private-cluster/variables.tf | 10 ++++++++++ variables.tf | 10 ++++++++++ 29 files changed, 163 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index a1331a25d..0f338e286 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,7 @@ Then perform the following commands on the root folder: | skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no | | 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 | | subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes | +| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no | | upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no | | zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no | diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 6e9653671..8bdee3ffe 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -276,9 +276,9 @@ resource "google_container_cluster" "primary" { {% endif %} timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } {% if autopilot_cluster != true %} node_pool { @@ -718,9 +718,9 @@ resource "google_container_node_pool" "pools" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } } {% endif %} diff --git a/autogen/main/variables.tf.tmpl b/autogen/main/variables.tf.tmpl index 1c7c2cf7d..93f2a0192 100644 --- a/autogen/main/variables.tf.tmpl +++ b/autogen/main/variables.tf.tmpl @@ -573,6 +573,16 @@ variable "node_metadata" { } } {% endif %} + +variable "timeouts" { + type = map(string) + description = "Timeout for cluster operations." + default = {} + validation { + condition = !contains([for t in keys(var.timeouts): contains(["create", "update", "delete"],t)], false) + error_message = "Only create, update, delete timeouts can be specified." + } +} {% if beta_cluster and autopilot_cluster != true %} variable "enable_kubernetes_alpha" { diff --git a/cluster.tf b/cluster.tf index aecf1f118..61518b6da 100644 --- a/cluster.tf +++ b/cluster.tf @@ -155,9 +155,9 @@ resource "google_container_cluster" "primary" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } node_pool { name = "default-pool" @@ -383,8 +383,8 @@ resource "google_container_node_pool" "pools" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } } diff --git a/modules/beta-autopilot-private-cluster/README.md b/modules/beta-autopilot-private-cluster/README.md index fa0975dc3..94a3275ed 100644 --- a/modules/beta-autopilot-private-cluster/README.md +++ b/modules/beta-autopilot-private-cluster/README.md @@ -127,6 +127,7 @@ Then perform the following commands on the root folder: | skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no | | 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 | | subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes | +| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no | | upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no | | zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no | diff --git a/modules/beta-autopilot-private-cluster/cluster.tf b/modules/beta-autopilot-private-cluster/cluster.tf index 4240b0cb8..271bf900f 100644 --- a/modules/beta-autopilot-private-cluster/cluster.tf +++ b/modules/beta-autopilot-private-cluster/cluster.tf @@ -126,9 +126,9 @@ resource "google_container_cluster" "primary" { timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } dynamic "resource_usage_export_config" { diff --git a/modules/beta-autopilot-private-cluster/variables.tf b/modules/beta-autopilot-private-cluster/variables.tf index c89550671..0a554420c 100644 --- a/modules/beta-autopilot-private-cluster/variables.tf +++ b/modules/beta-autopilot-private-cluster/variables.tf @@ -382,3 +382,13 @@ variable "database_encryption" { }] } + +variable "timeouts" { + type = map(string) + description = "Timeout for cluster operations." + default = {} + validation { + condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false) + error_message = "Only create, update, delete timeouts can be specified." + } +} diff --git a/modules/beta-autopilot-public-cluster/README.md b/modules/beta-autopilot-public-cluster/README.md index 1fd93e290..4c9b0a9a4 100644 --- a/modules/beta-autopilot-public-cluster/README.md +++ b/modules/beta-autopilot-public-cluster/README.md @@ -116,6 +116,7 @@ Then perform the following commands on the root folder: | skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no | | 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 | | subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes | +| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no | | upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no | | zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no | diff --git a/modules/beta-autopilot-public-cluster/cluster.tf b/modules/beta-autopilot-public-cluster/cluster.tf index 241e013d3..b61d8a216 100644 --- a/modules/beta-autopilot-public-cluster/cluster.tf +++ b/modules/beta-autopilot-public-cluster/cluster.tf @@ -126,9 +126,9 @@ resource "google_container_cluster" "primary" { timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } dynamic "resource_usage_export_config" { diff --git a/modules/beta-autopilot-public-cluster/variables.tf b/modules/beta-autopilot-public-cluster/variables.tf index 59586b73b..c35bb86a2 100644 --- a/modules/beta-autopilot-public-cluster/variables.tf +++ b/modules/beta-autopilot-public-cluster/variables.tf @@ -351,3 +351,13 @@ variable "database_encryption" { }] } + +variable "timeouts" { + type = map(string) + description = "Timeout for cluster operations." + default = {} + validation { + condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false) + error_message = "Only create, update, delete timeouts can be specified." + } +} diff --git a/modules/beta-private-cluster-update-variant/README.md b/modules/beta-private-cluster-update-variant/README.md index 198261873..48a12f031 100644 --- a/modules/beta-private-cluster-update-variant/README.md +++ b/modules/beta-private-cluster-update-variant/README.md @@ -251,6 +251,7 @@ Then perform the following commands on the root folder: | skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no | | 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 | | subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes | +| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no | | upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no | | zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no | diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index 25868a019..d01efa3b3 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -240,9 +240,9 @@ resource "google_container_cluster" "primary" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } node_pool { name = "default-pool" @@ -641,8 +641,8 @@ resource "google_container_node_pool" "pools" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } } diff --git a/modules/beta-private-cluster-update-variant/variables.tf b/modules/beta-private-cluster-update-variant/variables.tf index a36617596..a88bd877e 100644 --- a/modules/beta-private-cluster-update-variant/variables.tf +++ b/modules/beta-private-cluster-update-variant/variables.tf @@ -544,6 +544,16 @@ variable "node_metadata" { } } +variable "timeouts" { + type = map(string) + description = "Timeout for cluster operations." + default = {} + validation { + condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false) + error_message = "Only create, update, delete timeouts can be specified." + } +} + variable "enable_kubernetes_alpha" { type = bool description = "Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days." diff --git a/modules/beta-private-cluster/README.md b/modules/beta-private-cluster/README.md index 7adb7a271..a3ce1ece4 100644 --- a/modules/beta-private-cluster/README.md +++ b/modules/beta-private-cluster/README.md @@ -229,6 +229,7 @@ Then perform the following commands on the root folder: | skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no | | 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 | | subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes | +| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no | | upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no | | zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no | diff --git a/modules/beta-private-cluster/cluster.tf b/modules/beta-private-cluster/cluster.tf index bc424421d..31448a1df 100644 --- a/modules/beta-private-cluster/cluster.tf +++ b/modules/beta-private-cluster/cluster.tf @@ -240,9 +240,9 @@ resource "google_container_cluster" "primary" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } node_pool { name = "default-pool" @@ -553,8 +553,8 @@ resource "google_container_node_pool" "pools" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } } diff --git a/modules/beta-private-cluster/variables.tf b/modules/beta-private-cluster/variables.tf index a36617596..a88bd877e 100644 --- a/modules/beta-private-cluster/variables.tf +++ b/modules/beta-private-cluster/variables.tf @@ -544,6 +544,16 @@ variable "node_metadata" { } } +variable "timeouts" { + type = map(string) + description = "Timeout for cluster operations." + default = {} + validation { + condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false) + error_message = "Only create, update, delete timeouts can be specified." + } +} + variable "enable_kubernetes_alpha" { type = bool description = "Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days." diff --git a/modules/beta-public-cluster-update-variant/README.md b/modules/beta-public-cluster-update-variant/README.md index 5fb644722..30c05a0a0 100644 --- a/modules/beta-public-cluster-update-variant/README.md +++ b/modules/beta-public-cluster-update-variant/README.md @@ -240,6 +240,7 @@ Then perform the following commands on the root folder: | skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no | | 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 | | subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes | +| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no | | upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no | | zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no | diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index e51ff7e94..bb0a47122 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -240,9 +240,9 @@ resource "google_container_cluster" "primary" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } node_pool { name = "default-pool" @@ -622,8 +622,8 @@ resource "google_container_node_pool" "pools" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } } diff --git a/modules/beta-public-cluster-update-variant/variables.tf b/modules/beta-public-cluster-update-variant/variables.tf index 7ed1614d3..dbd988544 100644 --- a/modules/beta-public-cluster-update-variant/variables.tf +++ b/modules/beta-public-cluster-update-variant/variables.tf @@ -513,6 +513,16 @@ variable "node_metadata" { } } +variable "timeouts" { + type = map(string) + description = "Timeout for cluster operations." + default = {} + validation { + condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false) + error_message = "Only create, update, delete timeouts can be specified." + } +} + variable "enable_kubernetes_alpha" { type = bool description = "Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days." diff --git a/modules/beta-public-cluster/README.md b/modules/beta-public-cluster/README.md index 91766a636..352db8988 100644 --- a/modules/beta-public-cluster/README.md +++ b/modules/beta-public-cluster/README.md @@ -218,6 +218,7 @@ Then perform the following commands on the root folder: | skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no | | 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 | | subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes | +| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no | | upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no | | zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no | diff --git a/modules/beta-public-cluster/cluster.tf b/modules/beta-public-cluster/cluster.tf index c65dd4fcf..46450cbf4 100644 --- a/modules/beta-public-cluster/cluster.tf +++ b/modules/beta-public-cluster/cluster.tf @@ -240,9 +240,9 @@ resource "google_container_cluster" "primary" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } node_pool { name = "default-pool" @@ -534,8 +534,8 @@ resource "google_container_node_pool" "pools" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } } diff --git a/modules/beta-public-cluster/variables.tf b/modules/beta-public-cluster/variables.tf index 7ed1614d3..dbd988544 100644 --- a/modules/beta-public-cluster/variables.tf +++ b/modules/beta-public-cluster/variables.tf @@ -513,6 +513,16 @@ variable "node_metadata" { } } +variable "timeouts" { + type = map(string) + description = "Timeout for cluster operations." + default = {} + validation { + condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false) + error_message = "Only create, update, delete timeouts can be specified." + } +} + variable "enable_kubernetes_alpha" { type = bool description = "Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days." diff --git a/modules/private-cluster-update-variant/README.md b/modules/private-cluster-update-variant/README.md index 5604ed3f0..c9e0c619b 100644 --- a/modules/private-cluster-update-variant/README.md +++ b/modules/private-cluster-update-variant/README.md @@ -223,6 +223,7 @@ Then perform the following commands on the root folder: | skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no | | 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 | | subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes | +| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no | | upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no | | zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no | diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 1177f7c55..15291397a 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -155,9 +155,9 @@ resource "google_container_cluster" "primary" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } node_pool { name = "default-pool" @@ -483,8 +483,8 @@ resource "google_container_node_pool" "pools" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } } diff --git a/modules/private-cluster-update-variant/variables.tf b/modules/private-cluster-update-variant/variables.tf index 6656854ad..2a7ff1efc 100644 --- a/modules/private-cluster-update-variant/variables.tf +++ b/modules/private-cluster-update-variant/variables.tf @@ -489,3 +489,13 @@ variable "node_metadata" { error_message = "The node_metadata value must be one of GKE_METADATA, GCE_METADATA or UNSPECIFIED." } } + +variable "timeouts" { + type = map(string) + description = "Timeout for cluster operations." + default = {} + validation { + condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false) + error_message = "Only create, update, delete timeouts can be specified." + } +} diff --git a/modules/private-cluster/README.md b/modules/private-cluster/README.md index 7d7e394cb..7d30994a2 100644 --- a/modules/private-cluster/README.md +++ b/modules/private-cluster/README.md @@ -201,6 +201,7 @@ Then perform the following commands on the root folder: | skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no | | 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 | | subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes | +| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no | | upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no | | zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no | diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index d40cce9d8..6a222bc9b 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -155,9 +155,9 @@ resource "google_container_cluster" "primary" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } node_pool { name = "default-pool" @@ -396,8 +396,8 @@ resource "google_container_node_pool" "pools" { } timeouts { - create = "45m" - update = "45m" - delete = "45m" + create = lookup(var.timeouts, "create", "45m") + update = lookup(var.timeouts, "update", "45m") + delete = lookup(var.timeouts, "delete", "45m") } } diff --git a/modules/private-cluster/variables.tf b/modules/private-cluster/variables.tf index 6656854ad..2a7ff1efc 100644 --- a/modules/private-cluster/variables.tf +++ b/modules/private-cluster/variables.tf @@ -489,3 +489,13 @@ variable "node_metadata" { error_message = "The node_metadata value must be one of GKE_METADATA, GCE_METADATA or UNSPECIFIED." } } + +variable "timeouts" { + type = map(string) + description = "Timeout for cluster operations." + default = {} + validation { + condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false) + error_message = "Only create, update, delete timeouts can be specified." + } +} diff --git a/variables.tf b/variables.tf index 37059c0ff..70684d7d4 100644 --- a/variables.tf +++ b/variables.tf @@ -465,3 +465,13 @@ variable "node_metadata" { error_message = "The node_metadata value must be one of GKE_METADATA, GCE_METADATA or UNSPECIFIED." } } + +variable "timeouts" { + type = map(string) + description = "Timeout for cluster operations." + default = {} + validation { + condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false) + error_message = "Only create, update, delete timeouts can be specified." + } +}