Differences in Tags are not calculated correctly #6363
Labels
bug
Addresses a defect in current functionality.
service/ec2
Issues and PRs that pertain to the ec2 service.
Milestone
Community Note
Hi,
terraform seems to recreate all Tags on an instance, even Tags that were unchanged.
This is a problem if recreation of a tag is not allowed by IAM permissions and in general unnecessary behavior. The aws API seems to silently succeed when creating duplicate tags.
Terraform Version
$ terraform -v
Terraform v0.11.10
Affected Resource(s)
Terraform Configuration Files
Start with
then add another tag "Testtag" to the instance as per
Debug Output
2018-11-05T18:21:17.617+0100 [DEBUG] plugin.terraform-provider-aws_v1.42.0_x4: 2018/11/05 18:21:17 [DEBUG] Creating tags: [{ 2018-11-05T18:21:17.617+0100 [DEBUG] plugin.terraform-provider-aws_v1.42.0_x4: Key: "Origin", 2018-11-05T18:21:17.617+0100 [DEBUG] plugin.terraform-provider-aws_v1.42.0_x4: Value: "Terraform" 2018-11-05T18:21:17.617+0100 [DEBUG] plugin.terraform-provider-aws_v1.42.0_x4: } { 2018-11-05T18:21:17.617+0100 [DEBUG] plugin.terraform-provider-aws_v1.42.0_x4: Key: "Testtag", 2018-11-05T18:21:17.617+0100 [DEBUG] plugin.terraform-provider-aws_v1.42.0_x4: Value: "Testy" 2018-11-05T18:21:17.617+0100 [DEBUG] plugin.terraform-provider-aws_v1.42.0_x4: }] for <instance_id>
Expected Behavior
Only the Tag "Testtag" should be created.
Actual Behavior
Terraform creates both Tags anew, aborting if (re-)creation of the old Tag is forbidden.
Steps to Reproduce
Modify the Tag list of an instance after creating it, then
terraform apply
Important Factoids
I only tested and verified this with EC2 Instances, but the source code makes me believe that many more, if not all, taggable elements on aws have this issue. I cant think of an element where this behavior is desirable/required.
I also have the faulty method fixed already, I will make a pull request tomorrow. I just want to make sure this is indeed a bug and Im not overlooking something.
The text was updated successfully, but these errors were encountered: