/** * Opt-in `.tfstate` reader for the carve-out advisor (#214 T2). * * A `.tf`-only parse cannot know how many instances a `count`/`for_each` block * expands to — it reports 1 and flags the node dynamic. State is where those * are unrolled: each managed resource carries an `instances` array with one * entry per expansion. Feeding state in makes the `-3*(instances-1)` penalty * accurate, so a 200-instance fan-out ranks as the boundary work it really is. * * This is deliberately separate and opt-in (`--state `): a pure-`.tf` * parse is a plain file read, while reading state pulls in a state backend's * output. JSON only — no HCL, no wasm. */ import type { TfGraph } from "./types.js"; /** A resource's resolved attributes, read from state for adoption. */ export interface StateResource { type: string; name: string; /** The first instance's resolved attributes (id, arn, tags, ...). */ attributes: Record; } /** * Read one root-module managed resource's resolved attributes from state, by * Terraform address (`aws_s3_bucket.assets`). This is the true source of a * Terraform-managed resource's live shape — unlike a CloudFormation export, it * exists whether or not the resource was ever in a CFN stack. Returns null if * the address is absent, is a data source, or is module-nested. */ export declare function readStateResource(statePath: string, address: string): StateResource | null; /** * Map each root-module managed resource address to its state-expanded instance * count. Resources nested in a `module` are skipped: the `.tf` graph models a * module as a single node, so there is no per-resource node to attach the count * to (a documented v1 limitation — module internals are not descended into). */ export declare function readStateInstanceCounts(statePath: string): Map; /** * Overlay state instance counts onto a graph in place. Nodes absent from state * keep their `.tf`-derived count of 1. Returns the same graph for chaining. */ export declare function applyStateCounts(graph: TfGraph, counts: Map): TfGraph; //# sourceMappingURL=state.d.ts.map