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_autoscaling_group unable to handle change in launch template name #33912

Closed
dhrkumar opened this issue Oct 12, 2023 · 3 comments · Fixed by #34086
Closed

[Bug]: aws_autoscaling_group unable to handle change in launch template name #33912

dhrkumar opened this issue Oct 12, 2023 · 3 comments · Fixed by #34086
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service.
Milestone

Comments

@dhrkumar
Copy link
Contributor

Terraform Core Version

1.3.6

AWS Provider Version

5.8.0

Affected Resource(s)

  • aws_autoscaling_group

Expected Behavior

Auto Scaling group should be update with new launch template name.

Actual Behavior

Update Auto Scaling group was tried with old launch template id.

Relevant Error/Panic Output Snippet

│ Error: updating Auto Scaling Group (terraform-20231012132653541600000001): ValidationError: The specified launch template, with template ID lt-08ef3d2659a169d64, does not exist.
│       status code: 400, request id: 5a5130ef-0776-4fa8-aecb-fc5d85c0b03f

Terraform Configuration Files

resource "aws_iam_role" "role" {
  assume_role_policy = jsonencode({
    Version   = "2012-10-17"
    Statement = [
      {
        Action    = "sts:AssumeRole"
        Effect    = "Allow"
        Principal = {
          Service = "ec2.amazonaws.com"
        }
      },
    ]
  })
  name = "launch-template-ec2-role"
  path = "/ec2/instance/"
}
resource "aws_iam_instance_profile" "instance_profile" {
  name = "ec2-instance-profile"
  path = "/ec2/instance/"
  role = aws_iam_role.role.name
}

resource "aws_launch_template" "lt" {
  description             = "Launch template for ec2"
  image_id                = "ami-06ca3ca175f37dd66"
  instance_type           = "t3.nano"
  name                    = "ec2-linux"
  iam_instance_profile {
    arn = aws_iam_instance_profile.instance_profile.arn
  }
}

resource "aws_autoscaling_group" "asg" {
  launch_template {
    name = aws_launch_template.lt.name
    version = "$Latest"
  }
  max_size = 1
  min_size = 1
  availability_zones = ["us-east-1a"]
}

Steps to Reproduce

  1. Apply the configuration
  2. Change launch template name and apply the update configuration

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

Yes

@dhrkumar dhrkumar added the bug Addresses a defect in current functionality. label Oct 12, 2023
@github-actions github-actions bot added the service/autoscaling Issues and PRs that pertain to the autoscaling service. label Oct 12, 2023
@github-actions
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.

@github-actions github-actions bot added service/ec2 Issues and PRs that pertain to the ec2 service. service/iam Issues and PRs that pertain to the iam service. labels Oct 12, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 12, 2023
@ewbankkit ewbankkit removed service/iam Issues and PRs that pertain to the iam service. service/ec2 Issues and PRs that pertain to the ec2 service. needs-triage Waiting for first response or review from a maintainer. labels Oct 20, 2023
@github-actions github-actions bot added this to the v5.23.0 milestone Oct 25, 2023
@github-actions
Copy link

This functionality has been released in v5.23.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service.
Projects
None yet
2 participants