Skip to content

chant state

chant state snapshot <env> [lexicon]
chant state show <env>
chant state diff <env>
chant state log [env]

chant state captures point-in-time snapshots of deployed infrastructure by querying the cloud provider API and saving the result to a git orphan branch. Snapshots enable drift detection — comparing what’s currently built against what was last deployed.

The environment name (e.g. dev, staging, prod) must be declared in chant.config.ts under environments.

Query the provider API for the current deployed state, then save a snapshot to the chant-state/<env> orphan branch.

Terminal window
chant state snapshot dev
chant state snapshot prod aws # snapshot only the aws lexicon

Print the latest saved snapshot for an environment.

Terminal window
chant state show dev

Build the current project and compare the output against the last snapshot for that environment. Reports added, removed, and modified resources.

Terminal window
chant state diff dev

List the history of snapshots. Omit env to show all environments.

Terminal window
chant state log # all environments
chant state log dev # just dev
CodeMeaning
0Success
1Error (invalid environment, API failure, no snapshot found)