!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.
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
stack.yaml
No Tags Set
stack.yaml
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