Terraform CLI Compatibility
Stategraph is a state management and visualization layer that drives Terraform for plan and apply. Some Terraform CLI commands have direct Stategraph equivalents, some are subsumed by Stategraph's transaction model, and some have no analog (and do not need one).
The tables below map each standard Terraform 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 |
— (internal: stategraph-server test graph) |
Graphviz dump is available only via the server's test interface. |
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). |
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. |
-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 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 |
Emitted, not consumed. stategraph refactor complete writes detected renames and module moves into moved_stategraph.tf. Pre-existing moved blocks in user HCL are not consumed during evaluation. |
import block (Terraform 1.5+) |
terraform import (CLI) |
Skipped during evaluation. Onboarding goes through stategraph import tf or stategraph hcl import instead. |
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 |
Not honored by Stategraph evaluation. |
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, stategraph tenant ... |
Multi-tenant identity |
See also