Terraform CLI Compatibility
Stategraph is a state management and visualization layer that drives Terraform or OpenTofu for plan and apply. Some CLI commands have direct Stategraph equivalents, some are subsumed by Stategraph's transaction model, and some have no analog (and do not need one). A few commands (query, stacks, state identities) exist only in Terraform, not OpenTofu; the tables note these.
The tables below map each standard Terraform or OpenTofu CLI command (and the HCL constructs that replace some of them) to its closest Stategraph counterpart.
Lifecycle
| Terraform |
Stategraph |
Notes |
terraform init |
— |
No equivalent. Stategraph does not initialize a working directory; HCL is supplied to commands directly. |
terraform plan |
stategraph tf plan (alias: stategraph plan) |
Plans against state stored in Stategraph; changes are recorded in a transaction. |
terraform apply |
stategraph tf apply (alias: stategraph apply) |
Materializes the minimal HCL subset and runs terraform apply. |
terraform destroy |
— |
No dedicated destroy verb. Whole-state deletion is stategraph states delete; per-resource removal flows through the refactor or transaction model. |
terraform refresh |
— |
No equivalent. State is sourced from imports and applies. |
terraform validate |
stategraph hcl eval, stategraph hcl json (partial) |
Closest analog is HCL parsing and evaluation. |
terraform fmt |
— |
Out of scope. |
terraform console |
stategraph sql query (alias: stategraph query) |
Different paradigm: SQL queries over infrastructure, not an HCL expression REPL. |
terraform show (plan file) |
stategraph tf show |
Plan files only. |
terraform show (state) |
stategraph states export, stategraph states summary |
tf show does not display state; use the states group. |
terraform output |
stategraph sql query |
Outputs are queryable via SQL; no dedicated output verb. |
terraform graph |
— |
No Graphviz/DOT export. For dependency analysis, use stategraph states instances blast-radius (alias: stategraph blast-radius) or the Graph Explorer in the UI. |
terraform providers |
stategraph states summary |
Surfaces providers per state. |
terraform test |
— |
No equivalent. |
terraform metadata functions |
— |
No equivalent. |
terraform modules |
stategraph states modules list |
Lists modules in a stored state (rather than the working directory). terraform modules is Terraform-only; OpenTofu has no modules command. |
terraform query |
— |
No equivalent. Terraform-only (not in OpenTofu); runs list blocks to search remote infrastructure. |
terraform stacks |
— |
No equivalent. Terraform-only; manages HCP Terraform Stacks. Out of scope. |
Plan and apply flags
Stategraph supports a subset of the flags that modify how terraform plan and terraform apply behave.
| Terraform flag |
Stategraph |
Notes |
-var=NAME=VALUE |
stategraph tf plan --var ... |
Pass-through. |
-var-file=FILE |
stategraph tf plan --var-file ... |
Pass-through. |
-refresh=false |
stategraph tf plan --skip-refresh |
|
-target=ADDRESS |
stategraph tf plan --force (glob-based) |
--force scopes the plan via glob patterns; it is not Terraform's address syntax. |
-detailed-exitcode |
stategraph tf plan --detailed-exitcode |
Returns a tofu/terraform-compatible detailed exit code (also available on stategraph tf mtx). |
-auto-approve |
stategraph tf apply --auto-approve |
Skip the approval prompt on a plan-less stategraph tf apply. |
-out=FILE |
stategraph tf plan --out ... |
Save the plan to a file for a later stategraph tf apply. Omit it for a read-only preview. |
-replace=ADDRESS |
— |
No equivalent. |
-refresh-only |
— |
No equivalent. |
-destroy |
— |
No equivalent. |
State manipulation
| Terraform |
Stategraph |
Notes |
terraform state list |
stategraph states list, stategraph states resources summary, stategraph states instances query |
Multiple lenses on resources and instances. |
terraform state show |
stategraph states export, stategraph sql query |
No single-instance "show" verb; query via SQL. |
terraform state mv |
stategraph refactor start / step / complete |
Refactor sessions model address moves. See also the moved block below. |
terraform state rm |
stategraph states delete (whole state); refactor flow (per-resource) |
No direct per-resource rm. |
terraform state pull |
stategraph states export |
Dump full state. |
terraform state push |
stategraph states import |
Import a state file. |
terraform state replace-provider |
— |
No equivalent. |
terraform state identities |
— |
No equivalent. Terraform-only (not in OpenTofu); lists resource identities. |
terraform import |
stategraph import tf, stategraph hcl import, stategraph states import |
Onboards state and HCL from a directory or file. See also the import block below. |
terraform taint / untaint |
— |
No equivalent (deprecated upstream as well; use -replace on apply, which Stategraph also does not support). |
terraform force-unlock |
stategraph tx abort |
Transactions replace state-file locking; the Stategraph HTTP backend does not implement Terraform's lock/unlock semantics. |
HCL-native alternatives to state commands
Modern Terraform exposes several HCL blocks that replace older CLI state operations. Stategraph's support varies by block.
| Terraform HCL |
Replaces |
Stategraph |
moved block (Terraform 1.1+) |
terraform state mv |
stategraph refactor complete writes detected renames and module moves into moved_stategraph.tf. Pre-existing moved blocks in your HCL are parsed and de-duplicated during evaluation (kept, not dropped). |
import block (Terraform 1.5+) |
terraform import (CLI) |
Evaluated. Import blocks are parsed (their dependencies are tracked) and passed through to Terraform/OpenTofu at apply — their to address is rewritten to match the reified module layout. For bulk onboarding from an existing state, use stategraph import tf. |
removed block (Terraform 1.7+) |
terraform state rm |
Skipped during evaluation. Removal flows through the refactor or transaction model. |
check block (Terraform 1.5+) |
Pre/post-condition assertions |
References are extracted for the dependency graph; the assertions are not enforced by Stategraph. |
lifecycle { ignore_changes } |
Selective refresh control |
Not honored by Stategraph evaluation. |
lifecycle { prevent_destroy } |
Guard against accidental destroy |
Not honored by Stategraph evaluation. |
lifecycle { create_before_destroy } |
Apply ordering |
Passed through to Terraform at apply time. |
lifecycle { replace_triggered_by } (Terraform 1.2+) |
Replacement for taint |
Passed through to Terraform at apply time; the referenced resource is retained as a boundary (not literalized), so Terraform/OpenTofu honors the replacement on apply. terraform_data.triggers_replace is also supported (Release 2.3.8, #1035). |
Workspaces
| Terraform |
Stategraph |
Notes |
terraform workspace new |
stategraph states create --workspace |
A workspace maps to a Stategraph state. |
terraform workspace select |
stategraph states resolve |
Resolve a state ID for a workspace. |
terraform workspace list |
stategraph states list |
|
terraform workspace show |
stategraph info |
Surfaces current context (user, tenants, server). |
terraform workspace delete |
stategraph states delete |
|
Backend configuration
Stategraph implements the Terraform HTTP backend, so a workspace can store its state directly in Stategraph instead of S3, GCS, Consul, or Terraform Cloud.
| Terraform |
Stategraph |
Notes |
terraform { backend "http" { ... } } |
POST / GET /api/v1/states/backend/{group_id}[/{workspace}] |
Stategraph exposes the HTTP backend endpoints used by terraform init/apply. |
Backend lock / unlock |
— |
The HTTP backend implements GET and POST only; concurrency is managed by Stategraph transactions, not file locks. |
| Other backends (S3, GCS, Consul, …) |
— |
Out of scope. |
Auth and miscellaneous
| Terraform |
Stategraph |
Notes |
terraform login / logout |
(handled out of band) |
Auth via tenant and user setup. See stategraph user whoami and stategraph info. |
terraform version |
stategraph version client, stategraph version server |
|
terraform get |
— |
No module-fetch concept exposed. |
Stategraph-only commands
These have no Terraform CLI equivalent — they are part of what Stategraph adds on top.
| Command |
Purpose |
stategraph tx create / list / abort / logs list |
Transactional change model |
stategraph tf mtx |
Multi-state transactions |
stategraph states instances blast-radius (alias: stategraph blast-radius) |
Dependency and dependent analysis |
stategraph tenant gaps analyze (alias: stategraph gaps) |
Discover unmanaged cloud resources |
stategraph sql query / schema |
SQL across infrastructure |
stategraph states anonymize |
Anonymize state JSON |
stategraph user tenants list |
Multi-tenant identity (tenants the user belongs to) |
See also