At the moment Terraform v1.1.7 is used to create AWS ASG's and a LB.
The LB TG's are attached to the ASG's via the following external attachment resource:
resource "aws_autoscaling_attachment" "gateway_lb_attachment" {
for_each = toset(local.asg_names)
autoscaling_group_name = each.value
lb_target_group_arn = aws_lb_target_group.gateway_tg.arn
}
Inside the ASG resource the following lifecycle rule exists:
lifecycle {
create_before_destroy = true
ignore_changes = [ load_balancers, target_group_arns ]
}
And inside the Launch Template there is:
lifecycle {
create_before_destroy = true
}
When the LB is destroyed, it triggers an ASG destroy. From the above config, my understanding is the ASG should remain in place.
Is there something missing?