Example: Scaffold YAML Functions
Load a shared reference table once from a local file via !include, instead of hand-duplicating
the same list of choices across fields or re-deriving the same lookup data in every file that
needs it — plus pull in small dynamic values like an environment variable or the current git
branch via !env and !git.branch, with no need to prompt the user for them.
Learn more in the Scaffold Command Documentation.
What You'll See
- A YQ-filtered
!includeshapinglib/licenses.yamlinto real{label, value}options for aselectfield, so the choice list lives in one file instead of being typed intoscaffold.yamldirectly - An unfiltered
!includeon atype: computedfield landing the same file's raw structure at.Config.license_lookup, read fromNOTICE.mdvia a plain lookup (index) !git.branchand!envon two moretype: computedfields, each with a fallback default so generation still works outside a git repository or without the environment variable setlib/licenses.yaml— despite being declared inspec.files[]like any other file — never appearing in generated output, since it exists solely to be included
Try It
# List available scaffold templatesatmos scaffold list# Generate with a valid licenseatmos scaffold generate example ./my-project --set license=MIT# The options: list is real, not just documentation -- an invalid value is rejectedatmos scaffold generate example ./my-project --set license=NotARealLicense# Set the environment variable !env reads, to see it flow through instead of the defaultATMOS_EXAMPLE_MAINTAINER="Jane Doe" atmos scaffold generate example ./my-project --set license=MIT
The first command generates NOTICE.md and atmos.yaml (this whole directory is source: "."
for the example template, like in examples/scaffolding) — but never lib/licenses.yaml
itself. NOTICE.md reads (branch and maintainer will vary; shown here with the defaults and
without running atmos scaffold generate inside a git repository):
# License Notice
This project is licensed under **MIT License**.
See: https://opensource.org/licenses/MIT
Generated from branch `unknown` by the project team.
Key Files
| File | Purpose |
|---|---|
scaffold.yaml | Template configuration: a license select field sourced from !include, a license_lookup computed field holding the same file's raw data, and generated_from_branch/maintainer computed fields sourced from !git.branch/!env |
lib/licenses.yaml | The shared reference table both license-related fields include — never copied into generated output |
NOTICE.md | Discovered template file, reads .Config.license_lookup, .Config.generated_from_branch, and .Config.maintainer |
atmos.yaml | Registers this directory as the example template, and is copied verbatim into generated output for the same reason README.md is in examples/scaffolding |
README.md | This file, also copied verbatim into generated output |
Learn More
These YAML functions resolve before schema validation runs, not just before generation —
atmos scaffold validate catches a missing local file, an unreachable remote source, a YQ filter
producing the wrong shape, or a malformed function call, the same way atmos scaffold generate
does. Only functions that need no stack, component, or backend context are supported in
scaffold.yaml — see the
atmos scaffold generate
docs for the full reference, including remote (git::, oci://, https://) !include sources
and the complete supported-tag list.