/** * Boundary bridging for the strangler-fig carve (#197) — the centerpiece. * * Carving a resource cuts edges. This generates the edits to the Terraform you * LEAVE BEHIND so its plan stays valid once the resource is chant-owned: * * - inbound edge → the survivor loses its reference to the carved resource. * Bridge: add a `data` source for the (now chant-managed) resource and * rewrite the survivor's `type.name.attr` references to `data.type.name.attr`. * Required immediately, or `terraform plan` errors on the dangling ref. * An `output` block reading the carved resource is such a survivor (#1638): * same data source, same textual rewrite, applied to the output's value. * * - outbound edge → the carved resource read a value from a survivor. That * value must enter chant from outside synthesis, as a deploy-time input. * Deferred until apply; here we only record the provenance. * * Pure text transform over the original `.tf` content — no wasm, no shell, no * mutation. The command layer writes the results and (optionally) diffs them * into a git-applyable patch. A carve never destroys or recreates; the runbook * is reversible via `terraform import`. */ import { type CarveReport } from "./carve.js"; export interface CarvedIdentity { /** The HCL identity attribute, e.g. `bucket` or `name`. */ attr?: string; /** Its literal value, e.g. `myapp-assets-prod`. */ value?: string; } export interface DataSourceBlock { /** Carved resource address the data source stands in for. */ address: string; type: string; name: string; hcl: string; } export interface FileRewrite { path: string; original: string; rewritten: string; changed: boolean; /** Carved addresses whose own `resource` block was removed from this file (#998). */ excised: string[]; } export interface DeferredInput { survivor: string; carved: string; attrs: string[]; /** Build-parameter name(s) the input becomes in the emitted project (#998). */ params: string[]; note: string; } export interface BridgePlan { target: string; dataSources: DataSourceBlock[]; rewrites: FileRewrite[]; deferredInputs: DeferredInput[]; /** Every carved address whose own block the rewrites remove, across files. */ excised: string[]; /** * `output` blocks whose value the rewrites repoint at a data source (#1638), * as `output.`. They are inbound edges like any other — listed * separately only because the patch is a one-line expression edit. */ outputRewrites: string[]; runbook: string; } /** * Build the bridge plan for a carve. * * @param report the boundary report (from `boundaryReport`) * @param files every `.tf` file in the estate, as { path, content } * @param identities physical identity per carved address, for the data sources */ export declare function generateBridge(report: CarveReport, files: Array<{ path: string; content: string; }>, identities: Map): BridgePlan; //# sourceMappingURL=bridge.d.ts.map