terraform-aws-modules / terraform-aws-autoscaling

Terraform module to create AWS Auto Scaling resources πŸ‡ΊπŸ‡¦
https://registry.terraform.io/modules/terraform-aws-modules/autoscaling/aws
Apache License 2.0
288 stars 552 forks source link

fix: Ignore changes to `load_balancers` and `target_group_arns` #252

Closed bryantbiggs closed 7 months ago

bryantbiggs commented 7 months ago

Description

Motivation and Context

Breaking Changes

How Has This Been Tested?

dusansusic commented 7 months ago

@antonbabenko because each plan wants to remove asg instances from target groups. Next run will join it. This obviously causing downtime.

  ~ resource "aws_autoscaling_group" "idc" {
        id                               = "xxx-production-core-asg-a"
        name                             = "xxx-production-core-asg-a"
      ~ target_group_arns                = [
          - "arn:aws:elasticloadbalancing:eu-central-1:xxxx:targetgroup/tf-20231112171053124800000007/588de2cd885d173f",
        ]

next run:

  ~ resource "aws_autoscaling_group" "idc" {
        id                               = "xxx-production-core-asg-a"
        name                             = "xxx-production-core-asg-a"
      ~ target_group_arns                = [
          + "arn:aws:elasticloadbalancing:eu-central-1:xxxx:targetgroup/tf-20231112171053124800000007/588de2cd885d173f",
        ]
dusansusic commented 7 months ago

also, @antonbabenko and @bryantbiggs from this doc we can find:

If aws_autoscaling_attachment resources reference your ASG configurations, you will need to add the lifecycle configuration block with an ignore_changes argument to prevent Terraform non-empty plans (i.e., forcing resource update) during the next state refresh.

antonbabenko commented 7 months ago

This PR is included in version 7.3.1 :tada:

bryantbiggs commented 7 months ago

ya'll beat me to it πŸ˜… - I was thinking about this a bit more last night and was going to add the TODOs, so I've added them in https://github.com/terraform-aws-modules/terraform-aws-autoscaling/pull/253 along with a bit more explanation of how and why we got here

kkumtree commented 7 months ago

I appreciate that my (but failed) pull request motivated you to make your pull request.

github-actions[bot] commented 6 months ago

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.