Multi-state transactions

Atomic across modules.

Plan and apply changes spanning many root modules in one transaction. Cross-state dependencies resolve automatically, every state commits together, and if anything fails, nothing applies.

One plan, many states All-or-nothing No manual ordering
Get Started See it run

Terraform treats every state as an island

Coordinating a change across networking, compute, and application states means applying them one at a time, in the right order, hoping nothing fails halfway. There's no atomicity across the boundaries you drew.

// Terraform / OpenTofu
1apply networking
2apply compute
3apply application
!step 2 fails → partial state
→ manual ordering, no rollback
// Stategraph
1stategraph tf mtx ./net ./compute ./app
2one plan across all states
3one apply, one transaction
any failure → nothing applies
→ atomic, ordered for you

One plan across two states

rm1 and rm2 are separate root modules with separate states. One stategraph tf mtx plans both — 7 resources across State 0 and State 1 — and one apply commits them together.

stategraph — mtx
 stategraph tf mtx ./rm1 ./rm2 -- plan

State 0 · ./rm1
  + terraform_data.network
  + terraform_data.subnet
  + terraform_data.router
State 1 · ./rm2  (reads rm1.network_id, pending)
  + terraform_data.app
  + terraform_data.firewall
  + terraform_data.route
  + terraform_data.dns_record

Plan: 7 to add, 0 to change, 0 to destroy   # across 2 states

 stategraph tf mtx ./rm1 ./rm2 -- apply
State 0  ✓ applied     State 1  ✓ applied
✓ transaction committed · 7 resources · 2 states · 1 txn

State 0 = rm1, State 1 = rm2 · one plan, one apply, one transaction

What you get

Atomic commits

Every state in the transaction applies together, or none does. No more half-applied changes across module boundaries.

Automatic dependency order

Cross-state references resolve automatically. Stategraph orders the work for you — no hand-maintained apply sequence.

One plan, full picture

See every change across every state in a single plan, with real diffs. Review the whole change set at once.

Reads pending changes

Consumers see producers' planned outputs in the same transaction. See cross-state plans →

No partial-failure cleanup

A failure anywhere rolls the whole transaction back. You never wake up to a state that's half-migrated.

Same HCL

Point each module's backend at Stategraph and run stategraph tf mtx across the directories. No code changes.

One transaction, many states. Because every state lives in the same database, spanning them is just a bigger transaction — with the same ACID guarantees Postgres gives any other write. Transaction docs →

Apply across modules, atomically

Stop ordering applies by hand and praying nothing fails halfway. See all features →

Get Started Read the Docs