Skip to content

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.

Terminal window
chant import <template-file> --output src/
chant build

The import process:

  1. Reads the existing template
  2. Maps resources to lexicon types
  3. Converts property names to TypeScript conventions
  4. Generates TypeScript files organized by resource
  5. Generates import statements for cross-resource references

See your lexicon’s documentation for provider-specific import commands and options.

Lexicons may provide roundtrip tests that verify the full import pipeline:

  1. Parse the original template into an intermediate representation
  2. Generate TypeScript source from the IR
  3. Import the generated code (verifying constructors resolve)
  4. Serialize back to the target format
  5. 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.