Importing Templates
Some lexicons provide an import command that converts existing infrastructure templates into chant TypeScript resource definitions. This lets you adopt chant incrementally by importing your current infrastructure rather than rewriting it from scratch.
General Workflow
Section titled “General Workflow”chant import <template-file> --output src/chant buildThe import process:
- Reads the existing template
- Maps resources to lexicon types
- Converts property names to TypeScript conventions
- Generates TypeScript files organized by resource
- Generates import statements for cross-resource references
See your lexicon’s documentation for provider-specific import commands and options.
Verifying Imports
Section titled “Verifying Imports”Lexicons may provide roundtrip tests that verify the full import pipeline:
- Parse the original template into an intermediate representation
- Generate TypeScript source from the IR
- Import the generated code (verifying constructors resolve)
- Serialize back to the target format
- Compare the output structurally against the original
The Kubernetes lexicon includes a full roundtrip suite and optional k3d cluster validation. See the K8s Testing & Validation docs for details.