YAML in Atmos
Atmos uses YAML as its configuration language because it's human-readable, portable, and powerful enough to handle complex infrastructure configurations. YAML in Atmos has a few party tricks up its sleeve—especially around scope, merging, and some practical considerations like type inference and quoting conventions.
Let's clear up the most common misconceptions and show you how to use YAML effectively in Atmos.
Why YAML for Configuration?
YAML is ideal for infrastructure configuration because:
✅ Human-readable - Easy to read, write, and review in PRs
✅ Supports comments - Document your configuration inline
✅ Hierarchical - Natural fit for nested infrastructure config
✅ Portable - Every language can parse it
✅ Type-aware - Strings, numbers, booleans, null
✅ Schema validation - Validate with JSON Schema or OPA policies
Compare to alternatives:
| Format | Comments | Hierarchy | Schema Validation | Complexity |
|---|---|---|---|---|
| YAML | ✅ | ✅ | ✅ | Low |
| JSON | ❌ | ✅ | ✅ | Low |
| HCL | ✅ | ✅ | ❌ | Medium |
YAML keeps configuration simple while HCL handles the infrastructure logic.
YAML is a strict superset of JSON—any valid JSON file is also valid YAML. If you're a diehard JSON fan, you can write your stack configurations in JSON and Atmos will parse them just fine. You just lose comments and the cleaner syntax.
YAML Scope is Depth-Relative
The most important thing to understand: there is no file-level scope in Atmos. When you import multiple YAML files, Atmos merges them into a single, unified configuration. The scope is determined by the depth in the YAML tree, not by which file something is defined in.
Think of it like this: Atmos processes all imports and sees one big YAML document. Variables and settings at the same depth in the tree have the same scope.
After processing, Atmos sees this as one merged configuration:
vars:
environment: production
region: us-east-1
namespace: myapp
components:
terraform:
vpc:
vars:
cidr_block: "10.0.0.0/16"
All three variables (environment, region, namespace) have the same scope—they're all at the top-level vars depth.