Version Constraints
Version constraints allow you to specify required Atmos version ranges in your atmos.yaml configuration, ensuring consistent behavior across teams, CI/CD pipelines, and different environments.
Overview
When your configuration relies on specific Atmos features or behaviors, version constraints ensure that:
- Team members use compatible Atmos versions
- CI/CD pipelines fail early if the wrong version is installed
- Newer configurations don't silently fail on older Atmos versions
- Breaking changes are caught before causing confusing errors
Configuration
Add a version.constraint section to your atmos.yaml:
atmos.yaml
version.constraint.requireA semver constraint string specifying the required Atmos version(s). Uses the same syntax as Terraform version constraints. Multiple constraints are comma-separated and combined with AND logic.
version.constraint.enforcementControls behavior when the constraint is not satisfied:
fatal(default)- Exit immediately with error code 1
warn- Show a warning but continue execution
silent- Skip validation entirely (useful for debugging)
version.constraint.messageOptional custom message displayed when the constraint fails. Use this to provide team-specific upgrade instructions or context.
Constraint Syntax
Version constraints use hashicorp/go-version syntax, which is the same as Terraform:
| Constraint | Meaning | Example |
|---|---|---|
>=1.2.3 | Greater than or equal | >=1.100.0 |
<=1.2.3 | Less than or equal | <=1.200.0 |
>1.2.3 | Greater than (exclusive) | >1.99.0 |
<1.2.3 | Less than (exclusive) | <2.0.0 |
1.2.3 | Exact version | 1.200.0 |
!=1.2.3 | Not equal (exclude version) | !=1.150.0 |
~>1.2 | Pessimistic (>=1.2.0, <2.0.0) | ~>1.100 |
~>1.2.3 | Pessimistic (>=1.2.3, <1.3.0) | ~>1.100.0 |
| Multiple | Comma-separated AND | >=1.100.0, <2.0.0 |
Pessimistic Constraint Operator
The pessimistic constraint operator ~> allows only the rightmost version component to increment:
~>1.100allows1.100.0,1.150.0,1.200.0, but not2.0.0~>1.100.0allows1.100.0,1.100.1,1.100.9, but not1.101.0
Examples
Minimum Version Requirement
Ensure users have at least version 1.100.0:
atmos.yaml
Version Range
Require a specific major version range:
atmos.yaml
Exclude Problematic Version
Skip a version with known issues:
atmos.yaml
Soft Requirement (Warning Only)
Warn about unsupported versions without blocking execution:
atmos.yaml
Combined with Version Checking
Use both version constraints and update checking:
atmos.yaml
Environment Variable Override
Override the enforcement level at runtime using ATMOS_VERSION_ENFORCEMENT:
# Downgrade to warning
ATMOS_VERSION_ENFORCEMENT=warn atmos terraform plan
# Disable validation entirely
ATMOS_VERSION_ENFORCEMENT=silent atmos terraform plan
Precedence order:
ATMOS_VERSION_ENFORCEMENTenvironment variable (highest)version.constraint.enforcementinatmos.yaml- Default value
"fatal"(lowest)
Error Messages
Fatal Constraint Violation
When enforcement is fatal and the constraint is not satisfied:
Warning
When enforcement is warn:
Invalid Constraint Syntax
Invalid constraint syntax is always a fatal error:
Best Practices
- Start with minimum version - Use
>=X.Y.Zto ensure feature availability - Add upper bound for stability - Use
<X.0.0to avoid unexpected breaking changes - Use
warnduring migrations - Soft-enforce constraints while teams upgrade - Provide clear messages - Include upgrade instructions specific to your organization
- Test in CI first - Validate constraint behavior before enforcing on developers