After upgrading terraform to 3.64.2
, even though I haven't changed any code, terraform plan
reminds me that it will replace tag
with tag_all
. what's the difference between tags
and tags_all
?
~ resource "aws_lb_listener" "frontend_http_tcp" {
id = "xxxxx"
~ tags = {
- "environment" = "production" -> null
- "purpose" = "onboarding-integration" -> null
- "terraform" = "true" -> null
}
~ tags_all = {
- "environment" = "production"
- "purpose" = "onboarding-integration"
- "terraform" = "true"
} -> (known after apply)
# (4 unchanged attributes hidden)
# (1 unchanged block hidden)
}
In Terraform, you can define tags in top-level. tags_all
is basically individual resource tags
+ top level tags
For example;
# Terraform 0.12 and later syntax
provider "aws" {
# ... other configuration ...
default_tags {
tags = {
Environment = "Production"
Owner = "Ops"
}
}
}
resource "aws_vpc" "example" {
# ... other configuration ...
# This configuration by default will internally combine tags defined
# within the provider configuration block and those defined here
tags = {
Name = "MyVPC"
}
}
In above example; tags_all
will be
tags_all = {
Name = "MyVPC"
Environment = "Production"
Owner = "Ops"
}
while tag is
tags = {
Name = "MyVPC"
}
Reference = https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/resource-tagging
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With