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+
}

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

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

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ resource "google_container_cluster" "primary" {
240240
}
241241

242242
timeouts {
243-
create = "45m"
244-
update = "45m"
245-
delete = "45m"
243+
create = lookup(var.timeouts, "create", "45m")
244+
update = lookup(var.timeouts, "update", "45m")
245+
delete = lookup(var.timeouts, "delete", "45m")
246246
}
247247
node_pool {
248248
name = "default-pool"
@@ -641,8 +641,8 @@ resource "google_container_node_pool" "pools" {
641641
}
642642

643643
timeouts {
644-
create = "45m"
645-
update = "45m"
646-
delete = "45m"
644+
create = lookup(var.timeouts, "create", "45m")
645+
update = lookup(var.timeouts, "update", "45m")
646+
delete = lookup(var.timeouts, "delete", "45m")
647647
}
648648
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,16 @@ variable "node_metadata" {
544544
}
545545
}
546546

547+
variable "timeouts" {
548+
type = map(string)
549+
description = "Timeout for cluster operations."
550+
default = {}
551+
validation {
552+
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
553+
error_message = "Only create, update, delete timeouts can be specified."
554+
}
555+
}
556+
547557
variable "enable_kubernetes_alpha" {
548558
type = bool
549559
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."

modules/beta-private-cluster/README.md

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

modules/beta-private-cluster/cluster.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ resource "google_container_cluster" "primary" {
240240
}
241241

242242
timeouts {
243-
create = "45m"
244-
update = "45m"
245-
delete = "45m"
243+
create = lookup(var.timeouts, "create", "45m")
244+
update = lookup(var.timeouts, "update", "45m")
245+
delete = lookup(var.timeouts, "delete", "45m")
246246
}
247247
node_pool {
248248
name = "default-pool"
@@ -553,8 +553,8 @@ resource "google_container_node_pool" "pools" {
553553
}
554554

555555
timeouts {
556-
create = "45m"
557-
update = "45m"
558-
delete = "45m"
556+
create = lookup(var.timeouts, "create", "45m")
557+
update = lookup(var.timeouts, "update", "45m")
558+
delete = lookup(var.timeouts, "delete", "45m")
559559
}
560560
}

modules/beta-private-cluster/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,16 @@ variable "node_metadata" {
544544
}
545545
}
546546

547+
variable "timeouts" {
548+
type = map(string)
549+
description = "Timeout for cluster operations."
550+
default = {}
551+
validation {
552+
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
553+
error_message = "Only create, update, delete timeouts can be specified."
554+
}
555+
}
556+
547557
variable "enable_kubernetes_alpha" {
548558
type = bool
549559
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."

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

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

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ resource "google_container_cluster" "primary" {
240240
}
241241

242242
timeouts {
243-
create = "45m"
244-
update = "45m"
245-
delete = "45m"
243+
create = lookup(var.timeouts, "create", "45m")
244+
update = lookup(var.timeouts, "update", "45m")
245+
delete = lookup(var.timeouts, "delete", "45m")
246246
}
247247
node_pool {
248248
name = "default-pool"
@@ -622,8 +622,8 @@ resource "google_container_node_pool" "pools" {
622622
}
623623

624624
timeouts {
625-
create = "45m"
626-
update = "45m"
627-
delete = "45m"
625+
create = lookup(var.timeouts, "create", "45m")
626+
update = lookup(var.timeouts, "update", "45m")
627+
delete = lookup(var.timeouts, "delete", "45m")
628628
}
629629
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,16 @@ variable "node_metadata" {
513513
}
514514
}
515515

516+
variable "timeouts" {
517+
type = map(string)
518+
description = "Timeout for cluster operations."
519+
default = {}
520+
validation {
521+
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
522+
error_message = "Only create, update, delete timeouts can be specified."
523+
}
524+
}
525+
516526
variable "enable_kubernetes_alpha" {
517527
type = bool
518528
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."

modules/beta-public-cluster/README.md

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

modules/beta-public-cluster/cluster.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ resource "google_container_cluster" "primary" {
240240
}
241241

242242
timeouts {
243-
create = "45m"
244-
update = "45m"
245-
delete = "45m"
243+
create = lookup(var.timeouts, "create", "45m")
244+
update = lookup(var.timeouts, "update", "45m")
245+
delete = lookup(var.timeouts, "delete", "45m")
246246
}
247247
node_pool {
248248
name = "default-pool"
@@ -534,8 +534,8 @@ resource "google_container_node_pool" "pools" {
534534
}
535535

536536
timeouts {
537-
create = "45m"
538-
update = "45m"
539-
delete = "45m"
537+
create = lookup(var.timeouts, "create", "45m")
538+
update = lookup(var.timeouts, "update", "45m")
539+
delete = lookup(var.timeouts, "delete", "45m")
540540
}
541541
}

modules/beta-public-cluster/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,16 @@ variable "node_metadata" {
513513
}
514514
}
515515

516+
variable "timeouts" {
517+
type = map(string)
518+
description = "Timeout for cluster operations."
519+
default = {}
520+
validation {
521+
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
522+
error_message = "Only create, update, delete timeouts can be specified."
523+
}
524+
}
525+
516526
variable "enable_kubernetes_alpha" {
517527
type = bool
518528
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."

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

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

modules/private-cluster-update-variant/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"
@@ -483,8 +483,8 @@ resource "google_container_node_pool" "pools" {
483483
}
484484

485485
timeouts {
486-
create = "45m"
487-
update = "45m"
488-
delete = "45m"
486+
create = lookup(var.timeouts, "create", "45m")
487+
update = lookup(var.timeouts, "update", "45m")
488+
delete = lookup(var.timeouts, "delete", "45m")
489489
}
490490
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,3 +489,13 @@ variable "node_metadata" {
489489
error_message = "The node_metadata value must be one of GKE_METADATA, GCE_METADATA or UNSPECIFIED."
490490
}
491491
}
492+
493+
variable "timeouts" {
494+
type = map(string)
495+
description = "Timeout for cluster operations."
496+
default = {}
497+
validation {
498+
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
499+
error_message = "Only create, update, delete timeouts can be specified."
500+
}
501+
}

0 commit comments

Comments
 (0)