Skip to content

Commit 6011c80

Browse files
authored
feat: expose timeouts
1 parent 4bba52f commit 6011c80

File tree

29 files changed

+163
-54
lines changed

29 files changed

+163
-54
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ Then perform the following commands on the root folder:
191191
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
192192
| 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 |
193193
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
194+
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
194195
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
195196
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
196197

autogen/main/cluster.tf.tmpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,9 @@ resource "google_container_cluster" "primary" {
276276
{% endif %}
277277

278278
timeouts {
279-
create = "45m"
280-
update = "45m"
281-
delete = "45m"
279+
create = lookup(var.timeouts, "create", "45m")
280+
update = lookup(var.timeouts, "update", "45m")
281+
delete = lookup(var.timeouts, "delete", "45m")
282282
}
283283
{% if autopilot_cluster != true %}
284284
node_pool {
@@ -718,9 +718,9 @@ resource "google_container_node_pool" "pools" {
718718
}
719719

720720
timeouts {
721-
create = "45m"
722-
update = "45m"
723-
delete = "45m"
721+
create = lookup(var.timeouts, "create", "45m")
722+
update = lookup(var.timeouts, "update", "45m")
723+
delete = lookup(var.timeouts, "delete", "45m")
724724
}
725725
}
726726
{% endif %}

autogen/main/variables.tf.tmpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,16 @@ variable "node_metadata" {
573573
}
574574
}
575575
{% endif %}
576+
577+
variable "timeouts" {
578+
type = map(string)
579+
description = "Timeout for cluster operations."
580+
default = {}
581+
validation {
582+
condition = !contains([for t in keys(var.timeouts): contains(["create", "update", "delete"],t)], false)
583+
error_message = "Only create, update, delete timeouts can be specified."
584+
}
585+
}
576586
{% if beta_cluster and autopilot_cluster != true %}
577587

578588
variable "enable_kubernetes_alpha" {

cluster.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ resource "google_container_cluster" "primary" {
155155
}
156156

157157
timeouts {
158-
create = "45m"
159-
update = "45m"
160-
delete = "45m"
158+
create = lookup(var.timeouts, "create", "45m")
159+
update = lookup(var.timeouts, "update", "45m")
160+
delete = lookup(var.timeouts, "delete", "45m")
161161
}
162162
node_pool {
163163
name = "default-pool"
@@ -383,8 +383,8 @@ resource "google_container_node_pool" "pools" {
383383
}
384384

385385
timeouts {
386-
create = "45m"
387-
update = "45m"
388-
delete = "45m"
386+
create = lookup(var.timeouts, "create", "45m")
387+
update = lookup(var.timeouts, "update", "45m")
388+
delete = lookup(var.timeouts, "delete", "45m")
389389
}
390390
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ Then perform the following commands on the root folder:
127127
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
128128
| 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 |
129129
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
130+
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
130131
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
131132
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
132133

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ resource "google_container_cluster" "primary" {
126126

127127

128128
timeouts {
129-
create = "45m"
130-
update = "45m"
131-
delete = "45m"
129+
create = lookup(var.timeouts, "create", "45m")
130+
update = lookup(var.timeouts, "update", "45m")
131+
delete = lookup(var.timeouts, "delete", "45m")
132132
}
133133

134134
dynamic "resource_usage_export_config" {

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,13 @@ variable "database_encryption" {
382382
}]
383383
}
384384

385+
386+
variable "timeouts" {
387+
type = map(string)
388+
description = "Timeout for cluster operations."
389+
default = {}
390+
validation {
391+
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
392+
error_message = "Only create, update, delete timeouts can be specified."
393+
}
394+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ Then perform the following commands on the root folder:
116116
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
117117
| 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 |
118118
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
119+
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
119120
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
120121
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |
121122

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ resource "google_container_cluster" "primary" {
126126

127127

128128
timeouts {
129-
create = "45m"
130-
update = "45m"
131-
delete = "45m"
129+
create = lookup(var.timeouts, "create", "45m")
130+
update = lookup(var.timeouts, "update", "45m")
131+
delete = lookup(var.timeouts, "delete", "45m")
132132
}
133133

134134
dynamic "resource_usage_export_config" {

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,13 @@ variable "database_encryption" {
351351
}]
352352
}
353353

354+
355+
variable "timeouts" {
356+
type = map(string)
357+
description = "Timeout for cluster operations."
358+
default = {}
359+
validation {
360+
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
361+
error_message = "Only create, update, delete timeouts can be specified."
362+
}
363+
}

0 commit comments

Comments
 (0)