Skip to content

Commit

Permalink
fix: Update the instance_refresh example to use a count when creating
Browse files Browse the repository at this point in the history
the aws_autoscaling_lifecycle_hook.
  • Loading branch information
Benjamin Ash committed May 19, 2021
1 parent fb61961 commit 5b422fd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions examples/instance_refresh/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,9 @@ resource "helm_release" "aws_node_termination_handler" {
# ensures that node termination does not require the lifecycle action to be completed,
# and thus allows the ASG to be destroyed cleanly.
resource "aws_autoscaling_lifecycle_hook" "aws_node_termination_handler" {
for_each = toset(module.eks.workers_asg_names)

count = length(module.eks.workers_asg_names)
name = "aws-node-termination-handler"
autoscaling_group_name = each.value
autoscaling_group_name = module.eks.workers_asg_names[count.index]
lifecycle_transition = "autoscaling:EC2_INSTANCE_TERMINATING"
heartbeat_timeout = 300
default_result = "CONTINUE"
Expand Down

0 comments on commit 5b422fd

Please sign in to comment.