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.
How it works
Section titled “How it works”chant import --from prod --output src/- Resolve the environment the way
chant lifecycle diff --livedoes. - Call each project lexicon’s
exportResources()capability for full-fidelity config. - 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.
Selectors
Section titled “Selectors”| Flag | Effect |
|---|---|
--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) |
--owned | only chant-owned resources (carrying the ownership marker) |
--verbatim | keep server-defaulted fields instead of stripping to declared shape |
Per-provider fidelity
Section titled “Per-provider fidelity”Each lexicon reads live config its own way and strips it to the shape you would have authored:
| Lexicon | Source | Stripped by default |
|---|---|---|
| AWS | cloudformation get-template --template-stage Original | nothing — the original template is already declared shape |
| Azure | az group export (the env is the resource group) | nothing — the exported ARM template is already declared shape |
| Kubernetes | kubectl get <kinds> -A -o json | status, managedFields, server metadata, server annotations |
| GCP (Config Connector) | kubectl get <*.cnrm.cloud.google.com> -A -o json | status, 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.
The adopt-an-orphan loop
Section titled “The adopt-an-orphan loop”When drift detection reports an orphan — something in the cloud that source doesn’t declare — live import is how you adopt it:
# 1. see what's orphanedchant lifecycle plan prod
# 2. regenerate the orphan as chant TypeScriptchant import --from prod --name my-bucket --output src/
# 3. review, commit — the orphan is now declaredTo automate this across many resources as a reviewable PR, use the ReconcileOp workflow, which runs exactly this loop and opens the PR for you.
See also
Section titled “See also”- Reconciling Lifecycle — the reconcile and apply workflows
- Lifecycle Models — where live import sits on the dial
chant import— the full CLI reference