Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow override of timeouts in node_groups #1552

Merged
merged 10 commits into from
Sep 3, 2021
1 change: 1 addition & 0 deletions local.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ locals {
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
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.
warm_pool = null # If this block is configured, add a Warm Pool to the specified Auto Scaling group.
timeouts = {} # A map of timeouts for create/update/delete operations
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this have been:
timeouts = var.timeouts

The timeouts variable in the variable.tf file does not seem to actually be used during my testing


# Settings for launch templates
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.
Expand Down
1 change: 1 addition & 0 deletions modules/node_groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ The role ARN specified in `var.default_iam_role_arn` will be used by default. In
| subnets | Subnets to contain workers | list(string) | `var.workers_group_defaults[subnets]` |
| version | Kubernetes version | string | Provider default behavior |
| taints | Kubernetes node taints | list(map) | empty |
| timeouts | A map of timeouts for create/update/delete operations. | `map(string)` | Provider default behavior |
| update_default_version | Whether or not to set the new launch template version the Default | bool | `true` |

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Expand Down
1 change: 1 addition & 0 deletions modules/node_groups/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ locals {
pre_userdata = var.workers_group_defaults["pre_userdata"]
additional_security_group_ids = var.workers_group_defaults["additional_security_group_ids"]
taints = []
timeouts = var.workers_group_defaults["timeouts"]
update_default_version = true
ebs_optimized = null
},
Expand Down
6 changes: 6 additions & 0 deletions modules/node_groups/node_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ resource "aws_eks_node_group" "workers" {
}
}

timeouts {
create = lookup(each.value["timeouts"], "create", null)
update = lookup(each.value["timeouts"], "update", null)
delete = lookup(each.value["timeouts"], "delete", null)
}

version = lookup(each.value, "version", null)

labels = merge(
Expand Down
5 changes: 5 additions & 0 deletions modules/node_groups/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ variable "tags" {
type = map(string)
}

variable "timeouts" {
description = "A map of timeouts for create/update/delete operations."
type = map(string)
}

variable "node_groups_defaults" {
description = "map of maps of node groups to create. See \"`node_groups` and `node_groups_defaults` keys\" section in README.md for more details"
type = any
Expand Down
1 change: 1 addition & 0 deletions node_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module "node_groups" {
worker_security_group_id = local.worker_security_group_id
worker_additional_security_group_ids = var.worker_additional_security_group_ids
tags = var.tags
timeouts = var.timeouts
node_groups_defaults = var.node_groups_defaults
node_groups = var.node_groups
ebs_optimized_not_supported = local.ebs_optimized_not_supported
Expand Down
9 changes: 8 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ variable "tags" {
default = {}
}

variable "timeouts" {
description = "A map of timeouts for create/update/delete operations."
type = map(string)
default = {}
}

variable "vpc_id" {
description = "VPC where the cluster and workers will be deployed."
type = string
Expand Down Expand Up @@ -398,4 +404,5 @@ variable "openid_connect_audiences" {
description = "List of OpenID Connect audience client IDs to add to the IRSA provider."
type = list(string)
default = []
}
}