After enabling `default_tags` on the AWS provider, every plan shows tag changes on Auto Scaling groups or some resources. What do you do?
AdvancedScenarioWorkflow and Providers
Answer
Situation read → Some resources manage tags in a different way (inline tag blocks, or tags applied by another system), and default_tags overlaps with them.
What I'd do →
- Look at the plan to see whether the diff is on
tagsortags_all. - For ASGs, use
tagblocks withpropagate_at_launchor exclude the key from defaults. - Use the provider's
ignore_tagsfor tags owned by other tooling.
provider "aws" {
default_tags { tags = { Team = "platform", ManagedBy = "terraform" } }
ignore_tags { key_prefixes = ["kubernetes.io/cluster/"] }
}
Why → Two writers of the same tag key produce a permanent diff; define one owner per key.
Interview tip → Same-key conflict between default_tags and resource tags can cause errors; keep keys disjoint.
More on Workflow and Providers
A new teammate is about to run Terraform for the first time against a shared dev account. Which commands do you walk them through, and in what order?BeginnerYour manager asks why we bother with `terraform plan` when `apply` shows the same diff before asking for confirmation. What do you say?BeginnerTwo engineers get different provider versions and see different plans for the same code. How do you stop this?BeginnerSomeone committed the `.terraform/` directory to the repo. What should be in version control and what should not?BeginnerThe same configuration must create a VPC in `us-east-1` and a DR copy of a bucket in `eu-west-1`. How do you do it with one root module?IntermediateYou must deploy the same stack into 12 AWS accounts. How do you handle credentials and provider configuration?Intermediate