Infrastructure as a Database

Your infrastructure, as a database

Terraform keeps your infrastructure in a file. Stategraph keeps it in PostgreSQL, as a graph. Plans read only what changed, changes that do not overlap apply at the same time, and every resource and every change is a row you can query.

Same HCL, modules, and providers Terraform and OpenTofu One import in, one export out

Teams running Terraform on Stategraph

Zip logo PrizePicks logo Haus logo Avaloq logo Xanadu logo January logo Patients Know Best logo NOV logo Mixpanel logo Notable Health logo Skool logo

Read the case studies →

What changes when state is a database

Measured on real states

Plan time

A plan reads only your change

Terraform refreshes every resource on every plan. Stategraph walks the part of the graph your change reaches, so plan time follows the size of the change.

Faster plan & apply →

No-op plan on a real 800 MB production state.

terraform plan
3+ hours
Refreshes every resource
stategraph plan
97 seconds
Walks only the change

One benchmark. Results vary with the shape of the state. On a smaller state, a one-line change dropped the same plan from 1m13s to 2.0s.

Concurrency

Nobody waits on a lock

Nothing is arbitrated up front. Everyone plans at once, and overlap is settled at commit: changes to different resources land together, and a real overlap is rejected and re-planned.

Parallel applies →
conflict check tx-a plan apply committed tx-b plan apply committed different resources, so nothing to settle tx-c plan apply rejected touched a resource tx-a changed → re-plan and retry time →

tx-a and tx-b touch different resources and commit. tx-c touched a resource tx-a changed, so it is rejected and re-planned.

Multi-state transactions

Producer and consumer in one plan

With a state file, you apply the producer first and hope. Stategraph plans the producer and the consumer together and commits both states in one transaction.

Multi-state transactions →
stategraph · multi-state plan
# edit rm1 only: http_proxy_port 8080 → 9090 ❯ stategraph plan State 0 · rm1 (producer) ~ terraform_data.http_proxy_port input: 8080 → 9090 ~ output.http_proxy_port: 8080 → 9090 State 1 · rm2 (consumer, reads rm1's pending output) ~ terraform_data.firewall_rule_port_min input: 8070 → 9080 Plan: 0 to add, 2 to change, 0 to destroy ✓ across 2 states, one plan, one apply

Real output. Same terraform_remote_state HCL.

Query

Ask your infrastructure anything

Resources, dependencies, and history are rows in PostgreSQL. "What depends on this?" and "what changed last Tuesday?" are a query, not archaeology.

SQL inventory →
stategraph · sql
❯ stategraph query "SELECT type, COUNT(*) FROM resources GROUP BY type ORDER BY COUNT(*) DESC LIMIT 5" type count kubernetes_role_binding 586 kubernetes_manifest 382 null_resource 317 kubernetes_service 175 google_kms_key_ring 166 ❯ stategraph query "SELECT COUNT(*) FROM instances" count 7190

Real output captured from a live Stategraph instance.

Blast radius

Every dependent, ranked, before you apply

A plan lists what you changed, not what it breaks. Stategraph walks the dependency graph and lists every dependent by distance, remote-state consumers included.

Blast radius →
stategraph · blast-radius
❯ stategraph blast-radius \ "module.scrum.data.google_compute_network.shared_network_dev" DIST RESOURCE 0 module.scrum.data.google_compute_network.shared_network_dev 1 module.scrum.google_redis_instance.agent_sandbox 1 module.scrum.google_redis_instance.memorystore_jobs 1 module.scrum.google_memcache_instance.memorystore 1 module.scrum.google_redis_instance.memorystore_v2

distance 0 = the changed resource · distance 1 = directly affected dependents

Cost

The price of a change, in the plan

Reviewers see the diff and the bill together. Every plan carries current versus planned cost, per state and per resource.

Cost →
stategraph · plan
❯ stategraph plan --out plan.json Plan: 1 to add, 2 to change, 0 to destroy. Costs: Totals: Monthly: 130.82 USD → 140.16 USD (+9.34 USD) Hourly: 0.18 USD → 0.19 USD (+0.01 USD) Resources: 14 → 15 (+1) Coverage: 100.0% (unchanged) Per state: prod-network: +9.34/mo (resources +1) + aws_nat_gateway.main +9.34

current → planned, with the delta in green.

Security

Security model

State lives in a database that we may host. This is what that does and does not mean.

The server never runs Terraform

Plans and applies run where you run the CLI, on your machine or your CI runner. The server stores state and never sees your cloud credentials.

Access scoped to part of the graph

A token can plan without apply, and can be limited to one state or to specific resources within it.

Your identity provider

Sign in over OIDC or with Google. Self-hosted, air-gapped, or BYOC when your policy requires it.

Findings on the change itself

With scanning enabled, each plan reports the findings a change adds and resolves, in the plan output.

Getting in, and getting out

Same HCL, one state at a time

Check the fit locally first. Import one root module. Export a standard state file whenever you want.

adopting Infrastructure as a Database
# 1. See how the repo fits. Local, no API calls, nothing uploaded. ❯ stategraph diagnostics run # 2. Pull one workspace's state and import it, with its HCL ❯ terraform state pull > terraform.tfstate ❯ stategraph import tf # 3. Plan and apply with two commands. Modules and providers do not change. ❯ stategraph plan ❯ stategraph apply # To leave: write a standard Terraform state file back at any time ❯ stategraph states export

Gap analysis compares your AWS or GCP account with your states and generates the import blocks and HCL for what no state manages.

Deployment

Run it where your security team wants it

Stategraph Cloud

Managed by us, single-tenant with your own Postgres. The fastest way to start.

Self-hosted

In your own infrastructure, fully air-gapped if needed. See self-host options →

BYOC

We operate it inside your AWS, GCP, or Azure account. You own the data and the account.

Use it on its own under the CI you have, or with Stategraph Orchestration from the pull request.

Go deeper

Each capability, with a worked example

Faster plan & apply

Subgraph execution, resource-level locking, and multi-state transactions.

Insights

Blast radius, dependency search, and the graph explorer.

Inventory

Dashboards and SQL over everything you run.

Cost

Current versus planned in every plan, attribution, and actuals.

Infrastructure as a Database docs →

See it on your infrastructure

Bring a state file. In under 30 minutes you see your own infrastructure as a graph, with plans, locks, and SQL running against it.

Start 30-day trial Book a Demo Contact Sales