Skip to content

Linked Templates

llms.txt lists every page for an agent
Optional: hand this page to your coding agentThe steps work by hand too.
Show the whole prompt
Read https://intentius.io/chant/lexicons/azure/linked-templates/.
Split this project into the child projects I name and an orchestrator that deploys each one with `ChildProjectInstance`, passing outputs between them with `StackOutput` and `Reference(...).outputs` as the page shows.
Run `npx chant build` and `npx chant lint src` in each project until both pass, and open a pull request with the result. Do not run `az deployment`.
Never deploy to a real cloud account or shared environment (with `chant run`, `chant components` or a platform's own CLI), approve (a pull request review, `chant approve` or `chant run approve`), override a policy denial (`chant approve policy-override`), or merge; never cut or publish a release (`chant release cut --yes` or `chant release publish`), push or delete a `ci/*` tag (`chant ci tick` pushes them), or change the value of an existing flag; never touch `.chant/allowed_signers` or `chant/lifecycle`.

Linked template deployments split infrastructure into smaller, reusable projects.

Use ChildProjectInstance from the core package to deploy a child project as a linked ARM template deployment:

import { ChildProjectInstance } from "@intentius/chant";
export const networkDeploy = new ChildProjectInstance({
project: "../network",
parameters: {
vnetName: "my-vnet",
addressPrefix: "10.0.0.0/16",
},
});

This generates a Microsoft.Resources/deployments resource in the parent template that references the child template.

A typical multi-project setup:

infrastructure/
├── network/ # VNet, subnets, NSGs
│ └── src/main.ts
├── data/ # Storage, SQL, Key Vault
│ └── src/main.ts
├── compute/ # VMs, AKS, App Service
│ └── src/main.ts
└── main/ # Orchestrator — deploys all sub-projects
└── src/main.ts

The orchestrator project:

main/src/main.ts
import { ChildProjectInstance } from "@intentius/chant";
export const networkDeploy = new ChildProjectInstance({
project: "../network",
parameters: {
vnetName: "prod-vnet",
addressPrefix: "10.0.0.0/16",
},
});
export const dataDeploy = new ChildProjectInstance({
project: "../data",
parameters: {
storageName: "prodstorage01",
sqlServerName: "prod-sql",
},
});
export const computeDeploy = new ChildProjectInstance({
project: "../compute",
parameters: {
aksClusterName: "prod-aks",
},
});

Reference outputs from a child deployment in the parent:

import { ChildProjectInstance, StackOutput } from "@intentius/chant";
import { Reference } from "@intentius/chant-lexicon-azure";
export const networkDeploy = new ChildProjectInstance({
project: "../network",
parameters: { vnetName: "my-vnet" },
});
// Reference the child deployment's outputs
export const vnetId = new StackOutput({
name: "vnetId",
value: Reference("networkDeploy").outputs.vnetId.value,
});

ARM linked deployments support two modes:

  • Incremental (default) — Adds or updates resources, leaves others unchanged
  • Complete — Adds or updates resources and removes any not in the template

The deployment mode is configured at the Azure CLI level:

Terminal window
# Incremental (default, safe)
az deployment group create --mode Incremental --template-file dist/template.json
# Complete (careful — removes unlisted resources)
az deployment group create --mode Complete --template-file dist/template.json

chant