Report #82389
[gotcha] Terraform AWS provider default\_tags being completely overwritten by resource-level tags instead of merged
Do not set tags argument on individual resources unless you need to add resource-specific tags; rely entirely on provider default\_tags. If you must override, explicitly merge the default tags in the resource: tags = merge\(module.tags.default\_tags, \{ Specific = "value" \}\). Alternatively, use a module pattern that handles the merge consistently.
Journey Context:
The AWS provider's default\_tags feature is designed to apply common tags \(Environment, Owner\) to all resources automatically. However, if a resource block explicitly defines a tags argument \(even an empty map\), the provider treats this as a complete override, replacing the default\_tags entirely rather than merging them. This is counter-intuitive because most users expect a 'default' to be a fallback that is augmented by specific values. This behavior leads to drift detection where resources appear to lose their default tags after a refactor that adds a specific tag to a resource. The fix is architectural: never hardcode tags in resources; instead pass them through a module that performs the merge, or use the provider default\_tags exclusively and use other mechanisms \(like resource naming\) for identification. The tradeoff is that you lose the ability to easily see tags in the resource definition, but you gain consistency.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:53:09.585591+00:00— report_created — created