Skip to main content
EXAMPLE

Tagging with AWS Default Tags

Define shared AWS provider tags once and add an environment tag in each stack.

StacksComponents
cloudposse / atmos

Try it out

Copy the example into a new directory and make it your own:

atmos init examples/tagging-default-tags
cd tagging-default-tags

Follow the README for prerequisites and next steps.

See it in action

RECORDED DEMO
tagging-default-tags
 
Recorded from this example
Real commands. Real output.
README.md2.0 KB
View on GitHub

Tagging with AWS Default Tags

Define shared tags once. Each stack inherits them and adds its own environment tag. Atmos merges the maps into the AWS provider's default_tags configuration.

FileTags
stacks/catalog/app.yamlmanaged-by: atmos, owner: platform
stacks/dev.yamlenvironment: dev
stacks/prod.yamlenvironment: prod

Try It

atmos init examples/tagging-default-tags
cd tagging-default-tags

atmos describe component app -s dev --query .providers.aws.default_tags.tags
atmos describe component app -s prod --query .providers.aws.default_tags.tags

The dev stack resolves to:

environment: dev
managed-by: atmos
owner: platform

The prod stack has the same shared tags, with environment: prod. These commands and atmos test need no AWS credentials and create no resources.

How the Resource Gets Its Tags

The component contains an S3 bucket with no tags argument. During Terraform operations, Atmos writes the merged provider configuration to providers_override.tf.json, and the AWS provider applies the default tags to the bucket. Planning or applying requires the AWS provider and AWS credentials; applying creates a real bucket.

Default tags apply to supported, taggable AWS resources. Some resources, such as aws_autoscaling_group, need resource-specific tagging configuration.

For source-control tags, CI overrides, and a larger organizational hierarchy, see the tagging strategy tutorial. For module-based tagging, see tagging-null-label.