-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Autoscaling group tags are destroyed and recreated for an update in-place #14768
Comments
Hmm. The AWS EC2 Auto Scaling API has a method to create or update tags but our code isn't so subtle and for updated tags will delete the tag and then create it again. The current code is being refactored in #13868 to allow Auto Scaling tags to be handled the same as other service tags and it looks like this PR should fix this issue by updating the tag in-place (@bflad can you confirm?). |
Ha yeah, that was going to be my comment here. I believe #13868 will likely get this much closer to the desired behavior since its standardized and if it doesn't we should re-review things afterwards. 👍 |
The fix for this should be merged now and will release with version 3.5.0 of the Terraform AWS Provider, later this week. If its still causing trouble after that release, we can re-evaluate with the newer logic. |
This has been released in version 3.5.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 for triage. Thanks! |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This issue was originally opened by @Lynty as hashicorp/terraform#25949. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
Hello,
I have a Service Control Policy configured in an AWS account that denies creation and updating of an autoscaling group if it does not have some mandatory tags. I am using this AWS example to accomplish this. It uses a Null condition operator to check if a condition key is present at the time of authorization. If it is
true
(the key doesn't exist — it is null), the SCP prevents resource creation.The issue I am coming across is that regardless of a valid or invalid change to a tag, a
terraform plan
output shows a change in place for the autoscaling group resource but actually destroys and recreates the changed tag. Aterraform apply
will trigger the SCP and deny updating the autoscaling group due to the tag being momentarily destroyed/marked asnull
.Terraform Configuration Files
Service Control Policy Document
Expected Behavior
environment
is a mandatory tag. I should spin up an ec2 instance in an autoscaling group with tagenvironment:dev
. While the instance is running, I should be able to change the tag value to something likeenvironment:stage
without triggering the Service Control Policy with terraform.Actual Behavior
SCP is triggered and blocks autoscaling resource update due to seeing a tag being destroyed/marked as
null
.terraform plan
Steps to Reproduce
terraform init
terraform apply
terraform apply
The text was updated successfully, but these errors were encountered: