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

Differences in Tags are not calculated correctly #6363

Closed
fbreckle opened this issue Nov 5, 2018 · 3 comments
Closed

Differences in Tags are not calculated correctly #6363

fbreckle opened this issue Nov 5, 2018 · 3 comments
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@fbreckle
Copy link
Contributor

fbreckle commented Nov 5, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

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

  • provider.aws v1.42.0

Affected Resource(s)

  • aws_instance (but anything that is getting tagged probably)

Terraform Configuration Files

Start with

provider "aws" {
  region = "eu-west-1"
  version = "1.42"
}

resource "aws_instance" "web" {
  ami           = "ami-0a5e707736615003c"
  instance_type = "t2.micro"

  tags {
    Origin = "Terraform"
  }
}

then add another tag "Testtag" to the instance as per

tags {
    Origin = "Terraform"
    Testtag = "Testy"
  }

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.

@bflad bflad added bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. labels Nov 8, 2018
@bflad bflad added this to the v1.43.1 milestone Nov 8, 2018
@bflad
Copy link
Contributor

bflad commented Nov 8, 2018

The fix for this has been merged and will release with version 1.43.1 of the AWS provider, likely later today. 👍

@bflad bflad closed this as completed Nov 8, 2018
@bflad
Copy link
Contributor

bflad commented Nov 9, 2018

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

@ghost
Copy link

ghost commented Apr 2, 2020

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!

@ghost ghost locked and limited conversation to collaborators Apr 2, 2020
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/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

No branches or pull requests

2 participants