Wiring Components
Show the whole prompt
Read https://intentius.io/chant/components/wiring-howto/.
Wire the components I name: replace any `describe-stacks | jq` glue in their pipelines with the producer's outputs spread into the consumer's step, or an `@<component>.publish.uri` reference, and add `dependsOn`.
Run `npx chant graph --stacks` and show me the order it prints, then run `npx chant build` and `npx chant lint`, and open a pull request.
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`.Optional: hand this page to your coding agent
Read https://intentius.io/chant/components/wiring-howto/.Wire the components I name: replace any `describe-stacks | jq` glue in their pipelines with the producer's outputs spread into the consumer's step, or an `@<component>.publish.uri` reference, and add `dependsOn`.Run `npx chant graph --stacks` and show me the order it prints, then run `npx chant build` and `npx chant lint`, and open a pull request.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`.This is how to wire one component’s data into another. The composition grammar these patterns build on — phases, steps, gate, onFailure — lives in Composition & Wiring.
Cross-stack outputs
Section titled “Cross-stack outputs”When one component’s stack exports a value another needs, the consumer imports it. The graph resolves it, replacing the describe-stacks | jq glue a pipeline would otherwise carry.
export const searchService: Component = { name: "search-service", dependsOn: ["shared-alb"], deploy: [ phase("Apply", [cfnDeploy({ template: "archive:search.template.json", inputs: { ...sharedAlb.outputs } })]), // listener ARN, cluster ARN, subnets, … ],};chant graph --stacks orders shared-alb before the service and wires its outputs. See Multi-Stack Projects for the underlying stackOutput mechanism.
examples/adopt-alb-services is the runnable version of this exact pattern: a bespoke two-service ALB pipeline — describe-stacks | jq glue and all, kept as before/.gitlab-ci.yml — adopted as three build.json components a single driver runs.
Cross-component outputs
Section titled “Cross-component outputs”Components also wire by artifact, not just by stack output. A producer publishes an artifact; a consumer references it as @<component>.publish.uri (or .digest / .key). dependsOn orders the producer first; the graph resolves the reference into the consumer’s step.
The example illustrates the wiring — its jvm-build and publish-artifact verbs are not yet implemented (the cross-component reference resolution is what ships today):
// producer — a JAR published to S3, publish-only deployexport const jarLib: Component = { name: "jar-lib", build: jvmBuild({ tool: "maven", path: ".", into: "archive" }), deploy: [phase("Publish", [publishArtifact({ from: "archive", to: "$env.s3" })])], // → @jar-lib.publish.uri};
// consumer — an EMR job that reads the JARexport const emrJob: Component = { name: "emr-job", dependsOn: ["jar-lib"], deploy: [ phase("Submit", [emrStartJobRun({ jar: "@jar-lib.publish.uri", args: [/* … */] })]), phase("Verify", [waitJob({ runId: "@Submit.runId" })]), ],};Another member’s outputs
Section titled “Another member’s outputs”A member of a workspace can read another member’s outputs as its parameters when that member runs on another engine, such as a choudoufu estate or a Pulumi stack (#4455). The consumer adds a component named after the member, whose one step is member-outputs, and reads it with stackOutput() like any upstream component. In the three-cloud demo, dns reads the azureEndpoint the Azure site publishes:
import { memberOutputsComponent } from "@intentius/chant/components/verbs/member-outputs";
// The azure member of chant.workspace.json, whatever engine it runs on.export const azure = memberOutputsComponent("azure");
export const records: Component = { name: "records", dependsOn: ["azure"], deploy: [ phase("Apply", [cfnDeploy({ template: "dist/dns.json", inputs: { azureEndpoint: stackOutput("azure", "azureEndpoint") } })]), ],};The member’s kind in chant.workspace.json picks how its outputs are read. A lexicon that drives an engine contributes a source for it through CapabilityPlugin.engineOutputSources(), and the consumer lists that lexicon among its own. A member that moves between engines keeps the consumer’s components as they are.
| Member kind | Consumer lists | Applied values | Planned values, unknowns named |
|---|---|---|---|
choudoufu | terraform | choudoufu output -json in the member’s directory | live-plan-set -json: the plan’s planned_values.outputs, an output unknown when its output_changes entry marks any part after_unknown |
pulumi | pulumi | pulumi stack output --json --show-secrets=false in the member’s directory, or its checked-in stack-export.json with CHANT_PULUMI_APPLIED_OUTPUTS=export | pulumi preview --json: the stack’s outputs, an output unknown when it holds Pulumi’s unknown sentinel |
A Pulumi member on plunge (a plunge backend URL in Pulumi.yaml, or engine: "plunge" in its config) runs the same two commands under plunge. Besides these two reads, chant runs only the drift read for a Pulumi member (pulumi refresh --preview-only, or plunge drift --resource <urn> --stream on plunge), as ruled on #4476. On plunge it also reads the stack’s engine facts with one of four argv: plunge graph --json, plunge graph --json --stack <stack>, plunge graph --json --versions and plunge graph --json --stack <stack> --versions (#4529). plunge reads its records for it and calls no provider. Any other argv is refused before it runs, plunge graph --json --show-secrets included. A Pulumi output that is a secret is left out of both reads, so chant never carries its value. A parameter that reads one gets nothing; pass secrets through the engine’s own secret store.
The values are read the way a pull request reads any upstream (plan previews):
- When the change does not touch the member, the consumer is planned against the outputs it has now.
- When the change touches it, the consumer is planned against the outputs the member’s own plan says it will have. An output known only after the member applies has no value yet. The consumer’s step is planned without it, the pull request’s report lists the output (
azure.azureEndpoint, oraws.awsEndpointfor a Pulumiawsmember) under the consumer’sunknownInputs, and the change set has a hole onazure#outputsthat names the output. On merge, the consumer is held back until the member applied, then planned again against the value it applied as. That round is gated like any other.
The member applies through its own pipeline, and the consumer’s step only reads. While the member’s plan still has changes to apply, the step refuses, and the consumer is blocked behind it. The member’s component is in a change when the change signal names the member as a changed unit. The terraform lexicon does this for a terraform.roots entry of the same name. --from-affected can name it too.
Read next
Section titled “Read next”- Composition & Wiring — the composition grammar and fan-out, which these two wiring mechanisms build on.
- examples/adopt-alb-services — a bespoke multi-service ALB pipeline adopted onto the component model, before and after, runnable end to end.
- Build Archive — where a producer’s artifact lives before it is published.