EXAMPLE
Stack Names
Name stacks imperatively with the `name` field — the explicit name always wins over filenames, templates, and patterns.
Try it out
- Install Atmos
- Try the example
Copy the example into a new directory and make it your own:
atmos init examples/stack-names
cd stack-names
Follow the README for prerequisites and next steps.
See it in action
RECORDED DEMO Real commands. Real output.
README.md1.6 KB
View on GitHubStack Names Example
This example demonstrates imperative stack naming using the name field in stack manifests.
Overview
Stack names are determined by the following precedence (highest to lowest):
name- Explicit name from the stack manifest (always wins)name_template- Template-based naming (if configured)name_pattern- Pattern-based naming (if configured)- Filename - Basename of the stack file (fallback)
This example demonstrates the name field, which always takes precedence over other naming methods.
Stacks
| File | Name Field | Canonical Name |
|---|---|---|
stacks/dev.yaml | (none) | dev |
stacks/prod.yaml | production | production |
Usage
# List all stacksatmos list stacks# Dev stack - uses filenameatmos terraform plan mock -s dev# Prod stack - uses explicit nameatmos terraform plan mock -s production# This will NOT work (filename is not the canonical name):# atmos terraform plan mock -s prod
Key Points
- The
namefield takes precedence over the filename - Only the canonical name is valid for the
-sflag - This is useful for migrations, legacy infrastructure, or matching existing Terraform workspace names