DEV Community

Discussion on: Default Tags for Terraform AWS Provider is finally here

Collapse
 
svasylenko profile image
Serhii Vasylenko

Some things to add:

The tags_all is a new attribute that is added to each resource, hence the state file will be changed even if the tags remain the same

If you try to specify the same list of tags globally (in provider configuration) and in the resource configuration, Terraform will throw an error:

Error: "tags" are identical to those in the "default_tags" configuration block of the provider: please de-duplicate and try again
Enter fullscreen mode Exit fullscreen mode

Tags from default_tags are inherited by child modules. But if the child module has its own provider configuration for some resources, these resources will not inherit the default_tags from the root module.

The default_tags section supports variables:

  default_tags {
    tags = {
      Division    = var.test_tag
      Environment = "qa"
    }
  }
Enter fullscreen mode Exit fullscreen mode