Skip to content

Commit b7413b3

Browse files
author
Robert Kozak
authored
feat: Allow override of timeouts in node_groups (#1552)
1 parent c2490c5 commit b7413b3

File tree

8 files changed

+25
-1
lines changed

8 files changed

+25
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf
267267
| <a name="input_permissions_boundary"></a> [permissions\_boundary](#input\_permissions\_boundary) | If provided, all IAM roles will be created with this permissions boundary attached. | `string` | `null` | no |
268268
| <a name="input_subnets"></a> [subnets](#input\_subnets) | A list of subnets to place the EKS cluster and workers within. | `list(string)` | n/a | yes |
269269
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources. Tags added to launch configuration or templates override these values for ASG Tags only. | `map(string)` | `{}` | no |
270+
| <a name="input_timeouts"></a> [timeouts](#input\_timeouts) | A map of timeouts for create/update/delete operations. | `map(string)` | `{}` | no |
270271
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC where the cluster and workers will be deployed. | `string` | n/a | yes |
271272
| <a name="input_wait_for_cluster_timeout"></a> [wait\_for\_cluster\_timeout](#input\_wait\_for\_cluster\_timeout) | A timeout (in seconds) to wait for cluster to be available. | `number` | `300` | no |
272273
| <a name="input_worker_additional_security_group_ids"></a> [worker\_additional\_security\_group\_ids](#input\_worker\_additional\_security\_group\_ids) | A list of additional security group ids to attach to worker instances | `list(string)` | `[]` | no |

local.tf

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ locals {
9696
additional_ebs_volumes = [] # A list of additional volumes to be attached to the instances on this Auto Scaling group. Each volume should be an object with the following: block_device_name (required), volume_size, volume_type, iops, throughput, encrypted, kms_key_id (only on launch-template), delete_on_termination. Optional values are grabbed from root volume or from defaults
9797
additional_instance_store_volumes = [] # A list of additional instance store (local disk) volumes to be attached to the instances on this Auto Scaling group. Each volume should be an object with the following: block_device_name (required), virtual_name.
9898
warm_pool = null # If this block is configured, add a Warm Pool to the specified Auto Scaling group.
99+
timeouts = {} # A map of timeouts for create/update/delete operations
99100

100101
# Settings for launch templates
101102
root_block_device_name = concat(data.aws_ami.eks_worker.*.root_device_name, [""])[0] # Root device name for Linux workers. If not provided, will assume default Linux AMI was used.

modules/node_groups/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ The role ARN specified in `var.default_iam_role_arn` will be used by default. In
4848
| subnets | Subnets to contain workers | list(string) | `var.workers_group_defaults[subnets]` |
4949
| version | Kubernetes version | string | Provider default behavior |
5050
| taints | Kubernetes node taints | list(map) | empty |
51+
| timeouts | A map of timeouts for create/update/delete operations. | `map(string)` | Provider default behavior |
5152
| update_default_version | Whether or not to set the new launch template version the Default | bool | `true` |
5253

5354
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
@@ -89,6 +90,7 @@ No modules.
8990
| <a name="input_node_groups"></a> [node\_groups](#input\_node\_groups) | Map of maps of `eks_node_groups` to create. See "`node_groups` and `node_groups_defaults` keys" section in README.md for more details | `any` | `{}` | no |
9091
| <a name="input_node_groups_defaults"></a> [node\_groups\_defaults](#input\_node\_groups\_defaults) | map of maps of node groups to create. See "`node_groups` and `node_groups_defaults` keys" section in README.md for more details | `any` | n/a | yes |
9192
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | n/a | yes |
93+
| <a name="input_timeouts"></a> [timeouts](#input\_timeouts) | A map of timeouts for create/update/delete operations. | `map(string)` | n/a | yes |
9294
| <a name="input_worker_additional_security_group_ids"></a> [worker\_additional\_security\_group\_ids](#input\_worker\_additional\_security\_group\_ids) | A list of additional security group ids to attach to worker instances | `list(string)` | `[]` | no |
9395
| <a name="input_worker_security_group_id"></a> [worker\_security\_group\_id](#input\_worker\_security\_group\_id) | If provided, all workers will be attached to this security group. If not given, a security group will be created with necessary ingress/egress to work with the EKS cluster. | `string` | `""` | no |
9496
| <a name="input_workers_group_defaults"></a> [workers\_group\_defaults](#input\_workers\_group\_defaults) | Workers group defaults from parent | `any` | n/a | yes |

modules/node_groups/locals.tf

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ locals {
2424
pre_userdata = var.workers_group_defaults["pre_userdata"]
2525
additional_security_group_ids = var.workers_group_defaults["additional_security_group_ids"]
2626
taints = []
27+
timeouts = var.workers_group_defaults["timeouts"]
2728
update_default_version = true
2829
ebs_optimized = null
2930
},

modules/node_groups/node_groups.tf

+6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ resource "aws_eks_node_group" "workers" {
6969
}
7070
}
7171

72+
timeouts {
73+
create = lookup(each.value["timeouts"], "create", null)
74+
update = lookup(each.value["timeouts"], "update", null)
75+
delete = lookup(each.value["timeouts"], "delete", null)
76+
}
77+
7278
version = lookup(each.value, "version", null)
7379

7480
labels = merge(

modules/node_groups/variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ variable "tags" {
3636
type = map(string)
3737
}
3838

39+
variable "timeouts" {
40+
description = "A map of timeouts for create/update/delete operations."
41+
type = map(string)
42+
}
43+
3944
variable "node_groups_defaults" {
4045
description = "map of maps of node groups to create. See \"`node_groups` and `node_groups_defaults` keys\" section in README.md for more details"
4146
type = any

node_groups.tf

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module "node_groups" {
77
worker_security_group_id = local.worker_security_group_id
88
worker_additional_security_group_ids = var.worker_additional_security_group_ids
99
tags = var.tags
10+
timeouts = var.timeouts
1011
node_groups_defaults = var.node_groups_defaults
1112
node_groups = var.node_groups
1213
ebs_optimized_not_supported = local.ebs_optimized_not_supported

variables.tf

+8-1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ variable "cluster_tags" {
104104
default = {}
105105
}
106106

107+
variable "timeouts" {
108+
description = "A map of timeouts for create/update/delete operations."
109+
type = map(string)
110+
default = {}
111+
}
112+
107113
variable "vpc_id" {
108114
description = "VPC where the cluster and workers will be deployed."
109115
type = string
@@ -404,4 +410,5 @@ variable "openid_connect_audiences" {
404410
description = "List of OpenID Connect audience client IDs to add to the IRSA provider."
405411
type = list(string)
406412
default = []
407-
}
413+
}
414+

0 commit comments

Comments
 (0)