Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: AWS terraform provider does not recognize changes for autoscale_group #36532

Open
EugenKon opened this issue Mar 22, 2024 · 2 comments
Open
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service.

Comments

@EugenKon
Copy link

Terraform Core Version

1.7.4

AWS Provider Version

4.67.0

Affected Resource(s)

  • aws_autoscaling_group

Expected Behavior

terraform should notice both changes.

Actual Behavior

terraform plan notices only one change:
image

Where I did two changes:
image

I suppose this happened because for worker-autoscale group current version is equal to latest version:
image

But please note even if it is numerically equal to latest, but it is not the same as $Latest.
Look at the plan with $Latest value:

resource "aws_autoscaling_group" "worker" {
  name                      = "worker-autoscale"
  desired_capacity          = 2
  ...
  launch_template {
    id      = aws_launch_template.worker.id
    version = "$Latest"
  }
$ terraform plan -target aws_autoscaling_group.worker -out wg
...
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated
with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_autoscaling_group.worker will be updated in-place
  ~ resource "aws_autoscaling_group" "worker" {
      ~ desired_capacity          = 3 -> 2
        id                        = "worker-autoscale"
        name                      = "worker-autoscale"
        # (24 unchanged attributes hidden)

      - timeouts {}

        # (4 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

I expect to see from the output above next change:
version = "3" -> "$Latest"

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

described above. It looks like this part should be logically upper.

Steps to Reproduce

described above

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@EugenKon EugenKon added the bug Addresses a defect in current functionality. label Mar 22, 2024
@github-actions github-actions bot added the service/autoscaling Issues and PRs that pertain to the autoscaling service. label Mar 22, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 22, 2024
@EugenKon
Copy link
Author

And, possibly this is a different bug, but I can not apply changes only to one resource. TF suggest to change 4 resources, instead of just one requested!

terraform plan -target aws_autoscaling_group.www -out wg1
data.aws_iam_policy_document.ec2-assume-role-policy: Reading...
aws_vpc.prd_plntr: Refreshing state... [id=vpc-***]
data.aws_iam_policy_document.ec2-assume-role-policy: Read complete after 0s [id=***]
aws_iam_role.www: Refreshing state... [id=www-***]
aws_iam_instance_profile.www: Refreshing state... [id=www-***]
aws_security_group.internal_traffic: Refreshing state... [id=sg-***]
aws_security_group.ssh_for_all: Refreshing state... [id=sg-***]
aws_lb_target_group.www-https: Refreshing state... [id=arn:a***]
aws_lb_target_group.www-http: Refreshing state... [id=arn:a***]
aws_subnet.b_prd_plntr: Refreshing state... [id=subnet-***]
aws_security_group.all_egress: Refreshing state... [id=sg-**]
aws_security_group.www: Refreshing state... [id=sg-**]
aws_lb_target_group.www-https-autoscale: Refreshing state... [id=ar***]
aws_security_group.etcd: Refreshing state... [id=sg-**]
aws_launch_template.www: Refreshing state... [id=lt-***]
aws_autoscaling_group.www: Refreshing state... [id=www-autoscale]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated
with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_autoscaling_group.www will be updated in-place
  ~ resource "aws_autoscaling_group" "www" {
        id                        = "www-autoscale"
        name                      = "www-autoscale"
        # (25 unchanged attributes hidden)

      ~ launch_template {
            id      = "lt-***"
            name    = "www-autoscale"
          ~ version = "$Latest" -> "4"
        }

        # (3 unchanged blocks hidden)
    }

  # aws_lb_target_group.www-http will be updated in-place
  ~ resource "aws_lb_target_group" "www-http" {
        id                                 = "****"
        name                               = "www-http"
        tags                               = {}
        # (16 unchanged attributes hidden)

      ~ health_check {
          ~ matcher             = "200-299" -> "200-399"
            # (8 unchanged attributes hidden)
        }

        # (2 unchanged blocks hidden)
    }

  # aws_lb_target_group.www-https will be updated in-place
  ~ resource "aws_lb_target_group" "www-https" {
        id                                 = "arn:aws:***"
        name                               = "www-https"
        tags                               = {}
        # (16 unchanged attributes hidden)

      ~ health_check {
          ~ matcher             = "200-299" -> "200-399"
            # (8 unchanged attributes hidden)
        }

      ~ stickiness {
          ~ cookie_duration = 10 -> 300
            # (2 unchanged attributes hidden)
        }

        # (1 unchanged block hidden)
    }

  # aws_lb_target_group.www-https-autoscale will be updated in-place
  ~ resource "aws_lb_target_group" "www-https-autoscale" {
      + connection_termination             = false
        id                                 = "arn:aws:****:us-east-1:***"
      + lambda_multi_value_headers_enabled = false
        name                               = "www-https-autoscale"
      + proxy_protocol_v2                  = false
        tags                               = {}
        # (13 unchanged attributes hidden)

      ~ health_check {
          ~ matcher             = "200-299" -> "200"
            # (8 unchanged attributes hidden)
        }

      ~ stickiness {
          ~ cookie_duration = 10 -> 86400
          ~ enabled         = true -> false
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 4 to change, 0 to destroy.
╷
│ Warning: Resource targeting is in effect
│
│ You are creating a plan with the -target option, which means that the result of this plan may not represent
│ all of the changes requested by the current configuration.
│
│ The -target option is not for routine use, and is provided only for exceptional situations such as recovering
│ from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.
╵

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service.
Projects
None yet
Development

No branches or pull requests

2 participants