YAML functions: !terraform.state, !terraform.output, !store, !store.get, !env, !exec, !include, !template, !literal, !random, !aws.*, !cwd, !repo-root
YAML functions are the recommended way to add dynamic behavior to Atmos stack configurations.
They use YAML explicit tags (the ! prefix) and operate on structured data after YAML parsing.
They cannot break YAML syntax, are type-safe, and produce clear error messages.
All YAML functions support Go template expressions in their arguments. Atmos processes templates first, then executes the YAML functions.
| Function | Purpose |
|---|---|
!terraform.state | Read Terraform outputs directly from state backend (fastest, recommended) |
!terraform.output | Read Terraform outputs via terraform output (requires init, slower) |
!store | Read values from stores using component/stack/key pattern |
!store.get | Read arbitrary keys from stores (no naming convention required) |
!env |
Read environment variables (from stack env: sections or OS) |
!exec | Execute shell scripts and use the output |
!include | Include local or remote files (YAML, JSON, HCL, text) |
!include.raw | Include files as raw text regardless of extension |
!template | Evaluate Go template expressions and convert JSON to YAML types |
!literal | Preserve values verbatim, bypassing all template processing |
!random | Generate cryptographically secure random integers |
!cwd | Get the current working directory |
!repo-root | Get the repository root directory |
!aws.account_id | Get the current AWS account ID via STS |
!aws.caller_identity_arn | Get the current AWS caller identity ARN |
!aws.caller_identity_user_id | Get the AWS caller identity user ID |
!aws.organization_id | Get the current AWS Organization ID |
!aws.region | Get the current AWS region from SDK config |
YAML functions work in all Atmos stack manifest sections:
vars, settings, env, metadata, command, componentproviders, overrides, backend, backend_typeremote_state_backend, remote_state_backend_type!terraform.state -- Fast State Backend Access (Recommended)Reads outputs directly from the Terraform state backend without initialization. Supports S3,
local, GCS, and azurerm backends. 10-100x faster than !terraform.output.