From 532226e64e61328b25426cabc27e4009e085154f Mon Sep 17 00:00:00 2001 From: Ivan Ka <5395690+ivankatliarchuk@users.noreply.github.com> Date: Fri, 19 Jul 2024 15:19:00 +0100 Subject: [PATCH] feat: Enable support for ignore_failed_scaling_activities (#3104) * feat(issue-3102): added support for ignore_failed_scaling_activities Signed-off-by: ivan katliarchuk * Update node_groups.tf Co-authored-by: Bryant Biggs * Update modules/self-managed-node-group/variables.tf Co-authored-by: Bryant Biggs * feat(issue-3102): pre-commit checks sorted Signed-off-by: ivan katliarchuk --------- Signed-off-by: ivan katliarchuk Co-authored-by: Bryant Biggs --- modules/self-managed-node-group/README.md | 1 + modules/self-managed-node-group/main.tf | 2 ++ modules/self-managed-node-group/variables.tf | 6 ++++++ node_groups.tf | 2 ++ 4 files changed, 11 insertions(+) diff --git a/modules/self-managed-node-group/README.md b/modules/self-managed-node-group/README.md index 25b045f691..0f45ddf244 100644 --- a/modules/self-managed-node-group/README.md +++ b/modules/self-managed-node-group/README.md @@ -140,6 +140,7 @@ module "self_managed_node_group" { | [iam\_role\_policy\_statements](#input\_iam\_role\_policy\_statements) | A list of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) - used for adding specific IAM permissions as needed | `any` | `[]` | no | | [iam\_role\_tags](#input\_iam\_role\_tags) | A map of additional tags to add to the IAM role created | `map(string)` | `{}` | no | | [iam\_role\_use\_name\_prefix](#input\_iam\_role\_use\_name\_prefix) | Determines whether cluster IAM role name (`iam_role_name`) is used as a prefix | `bool` | `true` | no | +| [ignore\_failed\_scaling\_activities](#input\_ignore\_failed\_scaling\_activities) | Whether to ignore failed Auto Scaling scaling activities while waiting for capacity. | `bool` | `null` | no | | [initial\_lifecycle\_hooks](#input\_initial\_lifecycle\_hooks) | One or more Lifecycle Hooks to attach to the Auto Scaling Group before instances are launched. The syntax is exactly the same as the separate `aws_autoscaling_lifecycle_hook` resource, without the `autoscaling_group_name` attribute. Please note that this will only work when creating a new Auto Scaling Group. For all other use-cases, please use `aws_autoscaling_lifecycle_hook` resource | `list(map(string))` | `[]` | no | | [instance\_initiated\_shutdown\_behavior](#input\_instance\_initiated\_shutdown\_behavior) | Shutdown behavior for the instance. Can be `stop` or `terminate`. (Default: `stop`) | `string` | `null` | no | | [instance\_maintenance\_policy](#input\_instance\_maintenance\_policy) | If this block is configured, add a instance maintenance policy to the specified Auto Scaling group | `any` | `{}` | no | diff --git a/modules/self-managed-node-group/main.tf b/modules/self-managed-node-group/main.tf index ea1bd8c4ce..02d3384c64 100644 --- a/modules/self-managed-node-group/main.tf +++ b/modules/self-managed-node-group/main.tf @@ -565,6 +565,8 @@ resource "aws_autoscaling_group" "this" { min_elb_capacity = var.min_elb_capacity min_size = var.min_size + ignore_failed_scaling_activities = var.ignore_failed_scaling_activities + dynamic "mixed_instances_policy" { for_each = var.use_mixed_instances_policy ? [var.mixed_instances_policy] : [] diff --git a/modules/self-managed-node-group/variables.tf b/modules/self-managed-node-group/variables.tf index a3a207050f..f3424784a3 100644 --- a/modules/self-managed-node-group/variables.tf +++ b/modules/self-managed-node-group/variables.tf @@ -408,6 +408,12 @@ variable "desired_size" { default = 1 } +variable "ignore_failed_scaling_activities" { + description = "Whether to ignore failed Auto Scaling scaling activities while waiting for capacity." + type = bool + default = null +} + variable "context" { description = "Reserved" type = string diff --git a/node_groups.tf b/node_groups.tf index 2118c6aaab..e3615bd3ee 100644 --- a/node_groups.tf +++ b/node_groups.tf @@ -448,6 +448,8 @@ module "self_managed_node_group" { health_check_type = try(each.value.health_check_type, var.self_managed_node_group_defaults.health_check_type, null) health_check_grace_period = try(each.value.health_check_grace_period, var.self_managed_node_group_defaults.health_check_grace_period, null) + ignore_failed_scaling_activities = try(each.value.ignore_failed_scaling_activities, var.self_managed_node_group_defaults.ignore_failed_scaling_activities, null) + force_delete = try(each.value.force_delete, var.self_managed_node_group_defaults.force_delete, null) force_delete_warm_pool = try(each.value.force_delete_warm_pool, var.self_managed_node_group_defaults.force_delete_warm_pool, null) termination_policies = try(each.value.termination_policies, var.self_managed_node_group_defaults.termination_policies, [])