Tags and tags_all: removes tags

Hello,
i noticed that every time the code runs it either removes all tags or adds all of them.
Not sure why.

the simplified code is like this:

locals {
  base_tags = {
    Client                = var.Client_abbr
    ...
  }
}

...

resource "aws_instance" "this" {
  for_each = var.vms
  ...
  tags_all = merge(
    {
      ...
      ProductFamily = ${each.value.tag_productfamily}
      ...
    },
    local.base_tags
  )
}

The reason for using tags_all is to add provider level tags should I have them ( currently not defined).

Thank you for looking.

According to Terraform Registry tags_all is an attribute, not an argument - it is not supposed to be set at all, only referenced.

I’m surprised this configuration doesn’t produce an error.

Since tags_all is not intended to be set, the answer is to not try to do so.

1 Like

ah… it is “default_tags”, not “tags_all” I was thinking about ( this was the source of the confusion) Terraform Registry

Thank you @maxb - you are absolutely right.