!tags
The !tags YAML function returns the current component's own metadata.tags as a typed list
([]string), without the !template '{{ toJson .metadata.tags }}' boilerplate normally needed
to get a properly-typed value out of a template expression.
Availability and evaluation
Supported locations:
- Resolved stack values: after inheritance, merging, and component template processing.
Automatic evaluation requires native YAML tags from edition 2026-10-20, including unpinned projects. Quoted function strings remain literal; earlier editions retain legacy string-form behavior.
See YAML function scope for field restrictions, import timing, and native tags versus quoted strings.
Usage
The !tags function takes no parameters:
components:
terraform:
vpc:
metadata:
tags: [production, networking, tier-1]
vars:
tags: !tags
Arguments
This function takes no arguments. It reads metadata.tags from the component it's used on.
How It Works
When processing the !tags YAML function, Atmos reads the tags field from the component's own
metadata section (the same metadata.tags used for atmos list components --tags filtering)
and returns it as a []string. If metadata.tags is unset, !tags returns an empty list rather
than an error, consistent with tags being optional everywhere in Atmos.
Examples
Basic Usage
No Tags Set
Related Functions
- !labels - Get the current component's own
metadata.labelsas a map - !labels.keys - Get the current component's
metadata.labelskeys - !labels.values - Get the current component's
metadata.labelsvalues