Multi-State Operations
A single transaction can span multiple Terraform states. Cross-state dependencies are resolved automatically.
Usage
Use stategraph tf mtx to plan across multiple state directories:
stategraph tf mtx --out plan.json ./networking ./compute ./application
Apply works the same as a single-state plan:
stategraph tf apply plan.json
Cross-State Dependencies
When a transaction spans states, terraform_remote_state data sources are resolved automatically. Resources from different states that reference each other are planned and applied together in the correct dependency order.
Guarantees
- Single plan, single apply — All states are merged into one Terraform workspace and executed together, not sequentially
- Cross-state conflict detection — Resource-level locking detects overlapping changes across states at commit time
- Automatic dependency resolution —
terraform_remote_statereferences between states are resolved within the merged plan