Open lisushka opened 11 months ago
Voting for Prioritization
Volunteering to Work on This Issue
Facing the same here and is a blocker for upgrading to provider v5.x for now. Have you found any solution to this?
I have verified that behavior changed between v4.67.0
and v5.0.0
if there are configured tag
values and additional tags are added external to Terraform, independent of the use of modules.
With v4.x, no changes are shown. With v5.x, the externally added tags are to be removed.
Relates https://github.com/hashicorp/terraform-provider-aws/pull/30842.
@lisushka / @hugo-barros You are correct that the behavior did change at v5.0.0 and the aws_autoscaling_group.tag
attribute now behaves like other resources' tags
attribute in that any manually/externally added tags will show as diffs in terraform plan
and be removed from the AutoScaling Group if the plan is applied.
To work around this you can use a provider-level ignore_tags
block:
provider "aws" {
...
ignore_tags {
keys = ["test-tag-03"]
}
}
or add tag
to lifecycle.ignore_changes
:
resource "aws_autoscaling_group" "asg" {
lifecycle {
create_before_destroy = true
ignore_changes = [desired_capacity, tag]
}
...
}
Terraform Core Version
1.5.2
AWS Provider Version
5.0.0, 5.14.0
Affected Resource(s)
aws_autoscaling_group
Expected Behavior
Externally-managed tags on ASGs should not be removed by Terraform
Actual Behavior
Externally-managed tags on ASGs are removed by Terraform
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Minimum ASG module to reproduce:
data.tf:
main.tf:
variables.tf:
State directory which calls the ASG module:
data.tf:
asg.tf:
versions.tf:
Steps to Reproduce
Stand up the ASG module, then manually add a tag to the auto-scaling group. Run a
terraform plan
- the new tag will be removed.Debug Output
When planning the above code, after manually adding a tag to the ASG, in version
4.67.0
:When planning the same directory on version
5.0.0
(the earliest version where we have observed this behaviour):The externally-applied tags are also removed on version
5.14.0
(the newest version that we've tried).Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None