GorillaStack/auto-tag

do not tag already tagged resources

balihb opened this issue · 2 comments

I'm using Terraform in tandem with user created resources in AWS. The problem is, that I can't tell AutoTag to not tag resources that I already tagged, so Terraform will detect changes on the resources it created and it is bloating the code seriously if I have to exclude AutoTag tags on every resource I created. Maybe it would also be possible to include a tag, that tells AutoTag not to tag a certain resource.

I've started looking at the code but haven't found a single point where I could check the already existing tags on every resource and skip tagging if needed.

The only solution I'm aware of is to add this code to those terraform resources that are being tagged.

lifecycle {
    ignore_changes = [
      "tags.AutoTag_CreateTime",
      "tags.AutoTag_Creator",
      "tags.AutoTag_InvokedBy",
      "tags.%"
    ]
  }

We don't check to see if the tag exists before we add it so there is no simple way to do this.

back when I reported this terraform was unable to ignore changes on individual tags, but it is still fairly annoying to exclude tags on all the resources that have tags. oh well...