CI/CD: GitHub Actions, Spacelift, Atlantis, `atmos describe affected` for change detection
Atmos provides native CI/CD integration patterns for managing Terraform infrastructure through automated
pipelines. The three primary integration paths are GitHub Actions, Spacelift, and Atlantis. Each approach
leverages Atmos stack configurations and the atmos describe affected command to detect changes between
commits or branches, enabling efficient PR-based plan and merge-based apply workflows.
All integrations follow a common GitOps pattern:
atmos describe affectedatmos terraform plan for each affected component/stack pairatmos describe affectedThe atmos describe affected command is the foundation of all CI/CD integrations. It compares two Git
commits to produce a list of affected Atmos components and stacks.
The command performs these steps:
When component source directories have changed, all related stacks are marked affected and Atmos skips further configuration comparison for those stacks, streamlining the process.
# Compare current branch against the default branch (main)
atmos describe affected
# Compare against a specific branch
atmos describe affected --ref refs/heads/main
# Compare against a specific commit SHA
atmos describe affected --sha 6a9b2c1
# Use a pre-cloned repo for the target reference
atmos describe affected --repo-path /path/to/cloned/target
# Output as JSON for CI/CD consumption
atmos describe affected --format json
The command outputs a JSON array of affected items. Each item contains:
[
{
"component": "vpc",
"component_type": "terraform",
"stack": "plat-ue2-dev",
"stack_slug": "plat-ue2-dev-vpc",
"affected": "stack.vars"
},
{
"component": "eks/cluster",
"component_type": "terraform",
"stack": "plat-ue2-prod",
"stack_slug": "plat-ue2-prod-eks-cluster",
"affected": "component"
}
]
Fields:
component -- The Atmos component namecomponent_type -- Always terraform for Terraform componentsstack -- The Atmos stack namestack_slug -- A slug combining stack and component (used for matrix grouping)affected -- What changed: component (source files), stack.vars, stack.env, stack.settings, etc.The output can be filtered and grouped for GitHub Actions matrix strategies using jq expressions
configured in atmos.yaml:
# atmos.yaml