Skip to content

Live Import

chant import <template-file> reads a template from disk. chant import --from <env> reads the live cloud or cluster instead, regenerating chant TypeScript from what is actually running. This is the cloud → code direction — the way to adopt infrastructure you didn’t author, or pull an orphan back into source.

Terminal window
chant import --from prod --output src/
  1. Resolve the environment the way chant lifecycle diff --live does.
  2. Call each project lexicon’s exportResources() capability for full-fidelity config.
  3. Generate TypeScript with the same by-category organization as file import.

Unlike state, which only ever reads scrubbed metadata, live import emits the resource’s full input config — so it may surface secrets. The command prints a warning; review generated files before committing.

FlagEffect
--type <ResourceType>only resources of this type
--name <name>only the resource with this name
-d, --lexicon <name>restrict to one lexicon (e.g. aws, k8s)
--ownedonly chant-owned resources (carrying the ownership marker)
--verbatimkeep server-defaulted fields instead of stripping to declared shape

Each lexicon reads live config its own way and strips it to the shape you would have authored:

LexiconSourceStripped by default
AWScloudformation get-template --template-stage Originalnothing — the original template is already declared shape
Azureaz group export (the env is the resource group)nothing — the exported ARM template is already declared shape
Kuberneteskubectl get <kinds> -A -o jsonstatus, managedFields, server metadata, server annotations
GCP (Config Connector)kubectl get <*.cnrm.cloud.google.com> -A -o jsonstatus, server metadata, cnrm.cloud.google.com/* annotations

--verbatim keeps the stripped fields when you need an exact copy rather than a clean authoring starting point.

When drift detection reports an orphan — something in the cloud that source doesn’t declare — live import is how you adopt it:

Terminal window
# 1. see what's orphaned
chant lifecycle plan prod
# 2. regenerate the orphan as chant TypeScript
chant import --from prod --name my-bucket --output src/
# 3. review, commit — the orphan is now declared

To automate this across many resources as a reviewable PR, use the ReconcileOp workflow, which runs exactly this loop and opens the PR for you.