Component Dependencies
The dependencies section has four sibling keys: tools (tool versions), components (other components this one depends on), files (file paths to watch), and folders (folder paths to watch). Use them to declare ordering, propagate impact through atmos describe affected, and drive CI/CD orchestration.
Use Cases
- Execution Order: Ensure VPC is created before subnets
- CI/CD Orchestration: Spacelift and other integrations use dependencies to order stack runs
- Impact Analysis: The
atmos describe affectedcommand uses dependencies to find impacted components - File/Folder Watching: Trigger component redeployment when external files or folders change
Configuration
The dependencies section is an object with up to four sibling keys. Each key is independently optional.
Sibling Keys
- tools (map)
- Required CLI tool versions (e.g.,
terraform: "1.9.8"). See the overview page for details. - components (list)
- Other Atmos components this component depends on. Used for ordering and dependency-graph traversal.
- files (list of strings)
- File paths whose changes mark this component as affected. Use when external configuration or source files belong logically to this component but live outside the component directory.
- folders (list of strings)
- Folder paths whose recursive contents mark this component as affected. Typical use: pointing at a Lambda source tree or a templates directory.
dependencies.components[] Entry Schema
Each entry in dependencies.components is an object with these fields:
- name (string, preferred)
- The component instance name as defined in the stack (e.g.,
vpc,subnet,tgw/hub). This is the name undercomponents.<kind>.<name>, not the Terraform module path. - component (string, legacy alias)
- Older alias for
name. Still parses for backward compatibility with configurations from Atmos < v1.211.0. New configurations should usename. Setting bothnameandcomponentto different values is a configuration error. - stack (string, optional)
- The Atmos stack name where the component is provisioned (e.g.,
tenant1-ue2-prod). If omitted, the component is assumed to be in the same stack. Use Go templates to construct stack names dynamically. - kind (string, optional)
- The dependency type:
terraform,helmfile,packer, or a registered plugin type. Defaults to the declaring component's type for component dependencies.
settings.depends_on?The legacy namespace, tenant, environment, and stage fields are not supported in dependencies.components. Use the stack field with a Go template instead — for example, stack: "{{ .vars.tenant }}-{{ .vars.environment }}-prod".
Examples
Same-Stack Component Dependency
The simplest case: a component depends on another component in the same stack.
Cross-Stack Component Dependencies
Use the stack field or templates to depend on components in different stacks.
File and Folder Dependencies
Trigger atmos describe affected when external files or folders change. Use the sibling dependencies.files and dependencies.folders keys.
Cross-Type Dependencies
Depend on components of a different type using the kind field.
Merge Behavior
By default, dependencies.components uses replace merge behavior during stack inheritance: a child stack's list of dependencies replaces (does not extend) the parent's list. To opt into append-merge behavior across imports, set settings.list_merge_strategy: append in atmos.yaml. The same rule applies to dependencies.files and dependencies.folders.
Default (replace)
Opt-in append
Configure list-merge once globally in atmos.yaml:
With that set, child dependencies.components lists extend the parent's list — in the example above, vpc would depend on both account-settings and network-baseline.
Other valid list_merge_strategy values are replace (default), append, and merge. See the settings reference for full semantics.
Integration with atmos describe affected
dependencies.components, dependencies.files, and dependencies.folders are all consumed by atmos describe affected to determine which components are impacted by changes.
How It Works
When you run atmos describe affected:
- Atmos compares the current branch to the target branch (e.g.,
main) - It identifies changed files (stack configs, component code)
- It checks
dependencies.files/dependencies.foldersfor path-based matches against the changed file set - It walks
dependencies.componentsto propagate impact through the dependency graph - Components touched directly or transitively are marked as "affected"
Example: File Dependency
# If src/lambda/handler/index.js changed:
atmos describe affected --ref refs/heads/main
# Output includes my-lambda because its dependency folder changed
Example: Component Dependency
If component A depends on component B, and component B is affected by changes, component A is also marked as affected (transitive dependency).
Viewing Dependencies
List Dependents
Find all components that depend on a specific component:
List Affected Components
Find all components affected by changes in a branch:
Best Practices
- Declare All Dependencies - Be explicit about dependencies, even if the order seems obvious
- Avoid Circular Dependencies - Component A cannot depend on B if B depends on A
- Use Templates for Cross-Stack - Use
{{ .vars.tenant }}-{{ .vars.environment }}-{{ .vars.stage }}instead of hardcoded stack names - Combine with YAML Functions - Use
!terraform.outputto pass data between dependent components - Test with
describe affected- Verify your dependencies work correctly in CI/CD - Prefer
name:overcomponent:- In new configurations, usename:insidedependencies.components[]for clarity - Prefer
dependencies.files/dependencies.foldersover inlinekind: file/folder- Cleaner separation between component-graph dependencies and path-watch dependencies
Legacy entry shapes (still supported)
These older shapes shipped in v1.210.0 and continue to parse for backward compatibility. They are still fully supported, but new configurations should use the canonical shapes shown above.
Legacy: component: instead of name:
The component: field is the older spelling of name:. Both refer to the same value:
Setting name: and component: to different values on the same entry is a configuration error.
Legacy: inline kind: file / kind: folder
Path-based dependencies originally had to be declared inside dependencies.components[] using kind: file or kind: folder with a path: field. This still works, but the sibling keys are clearer:
Both forms produce identical behavior in atmos describe affected and atmos describe dependents. They can also be mixed within the same component.
Migration from settings.depends_on
If you're using the much older settings.depends_on format:
Key Differences
| Feature | settings.depends_on | dependencies.* (current) |
|---|---|---|
| Format | Map with numeric keys | List(s) under sibling keys |
| Merge behavior | Deep merge (complex) | Per-list (replace by default, append opt-in) |
| Location | Under settings | Under dependencies |
| Cross-stack | namespace, tenant, environment, stage fields | stack field only (use templates) |
| Cross-type | Not supported | Use kind field on components[] (terraform, helmfile, packer, etc.) |
| File/folder deps | file and folder fields per entry | dependencies.files and dependencies.folders sibling keys |
Both formats continue to work. The new format is recommended for new configurations.
Related Documentation
- Dependencies Overview - Tool and component dependencies overview
- describe dependents - List components that depend on a component
- describe affected - List components affected by changes
- YAML Functions - Using
!terraform.outputfor cross-component data - Spacelift Integration - CI/CD integration with dependency ordering