diff --git a/examples/managed_node_groups/main.tf b/examples/managed_node_groups/main.tf index 4c8b3fed6c..b619314756 100644 --- a/examples/managed_node_groups/main.tf +++ b/examples/managed_node_groups/main.tf @@ -95,6 +95,9 @@ module "eks" { effect = "NO_SCHEDULE" } ] + update_config = { + max_unavailable_percentage = 50 # or set `max_unavailable` + } } } diff --git a/modules/node_groups/README.md b/modules/node_groups/README.md index 4811e1a709..685c6e5533 100644 --- a/modules/node_groups/README.md +++ b/modules/node_groups/README.md @@ -40,6 +40,8 @@ The role ARN specified in `var.default_iam_role_arn` will be used by default. In | launch\_template_version | The version of the LT to use | string | none | | max\_capacity | Max number of workers | number | `var.workers_group_defaults[asg_max_size]` | | min\_capacity | Min number of workers | number | `var.workers_group_defaults[asg_min_size]` | +| update_config.max\_unavailable\_percentage | Max percentage of unavailable nodes during update. (e.g. 25, 50, etc) | number | `null` if `update_config.max_unavailable` is set | +| update_config.max\_unavailable | Max number of unavailable nodes during update | number | `null` if `update_config.max_unavailable_percentage` is set | | name | Name of the node group. If you don't really need this, we recommend you to use `name_prefix` instead. | string | Will use the autogenerate name prefix | | name_prefix | Name prefix of the node group | string | Auto generated | | pre_userdata | userdata to pre-append to the default userdata. Require `create_launch_template` to be `true`| string | "" | diff --git a/modules/node_groups/node_groups.tf b/modules/node_groups/node_groups.tf index 865f3ae634..134d38345c 100644 --- a/modules/node_groups/node_groups.tf +++ b/modules/node_groups/node_groups.tf @@ -69,6 +69,15 @@ resource "aws_eks_node_group" "workers" { } } + dynamic "update_config" { + for_each = try(each.value.update_config.max_unavailable_percentage > 0, each.value.update_config.max_unavailable > 0, false) ? [true] : [] + + content { + max_unavailable_percentage = try(each.value.update_config.max_unavailable_percentage, null) + max_unavailable = try(each.value.update_config.max_unavailable, null) + } + } + timeouts { create = lookup(each.value["timeouts"], "create", null) update = lookup(each.value["timeouts"], "update", null)