/** * Env teardown for the aws lexicon (chant #1222) — both halves of the * `teardownOwned` / `executeTeardown` capability pair, at STACK granularity. * * Per-resource selection is impossible here by construction: the thin read * (`describeResources`) is sourced from `describe-stack-resources`, which * returns no tags, so no resource-level marker can be read on the teardown * path. The stack is aws's ownership boundary anyway — the applier deploys * whole stacks and deletes ride CloudFormation — so teardown enumerates the * environment's stacks and verifies the marker on each STACK's own tags * (`DescribeStacks` → `Tags`), stamped there by the apply paths from the * template's `Metadata["chant:ownership"]` block. * * Which stacks are the environment's: the project's declared `stacks[]` when * it is a multi-stack project, else the single-stack convention — the explicit * `stack` option, else the stack named after the environment (the same rule * `describeResources` and `exportResources` apply, see chant #932). * * Verification is tag-reading, never name-trusting. A resolved stack whose * tags carry exactly the requested identity (managed-by + stack + env) is a * candidate of type `AWS::CloudFormation::Stack`. A stack carrying a DIFFERENT * marker identity verifiably belongs to another project or env — out of scope, * silently, the way another env's resources are. A stack carrying NO marker at * all is unknowable — a legacy chant stack from before stack tagging, or a * foreign stack that happens to hold the env's name — and is reported as a * hole (`filtered` / unverified-ownership), never deleted. An absent stack is * knowledge, not a hole: nothing to tear down. * * Execution re-reads each candidate stack's tags immediately before deleting * (the enumeration is a moment old at best, and a delete is not undoable), * then rides the existing Query-API delete — `awsDelete`, DeleteStack polled * to DELETE_COMPLETE. An identity that no longer matches is `not-prunable: * unverified-ownership`; an already-absent stack is `deleted` (teardown is * idempotent). */ import type { TeardownCandidate, TeardownEnumeration, TeardownExecution } from "@intentius/chant/lexicon"; import { type OwnershipMarker } from "@intentius/chant/ownership"; import { type AwsReadClientOptions } from "./api/read-client.js"; import { type AwsHttp } from "./op/activities/aws-apply.js"; /** The one candidate type this lexicon's teardown produces: whole stacks. */ export declare const STACK_TYPE = "AWS::CloudFormation::Stack"; export interface AwsTeardownOptions { environment: string; /** The identity to select on: this project's ownership stack + the env being torn down. */ marker: OwnershipMarker; /** Explicit deployed stack name (single-stack override). */ stack?: string; /** Region that stack is deployed in. */ region?: string; /** A multi-stack project's declared stacks (chant.config `stacks[]`). */ stacks?: Array<{ name: string; region?: string; }>; } /** Injectable transports/timeouts, so tests double the Query API (no network). */ export interface AwsTeardownDeps { /** Options for the read client's `DescribeStacks` calls (http injection, endpoint). */ read?: AwsReadClientOptions; /** The applier transport `awsDelete` polls DeleteStack through. */ applyHttp?: AwsHttp; /** DeleteStack settle timeout in ms (default `awsDelete`'s 300000). */ timeoutMs?: number; /** DeleteStack poll interval in ms (default `awsDelete`'s 3000). */ intervalMs?: number; } /** The stacks an env teardown resolves to: `stacks[]`, else the single-stack convention. */ export declare function resolveTeardownStacks(options: AwsTeardownOptions): Array<{ name: string; region?: string; }>; /** * Enumerate the environment's marker-verified stacks — the aws half of * `chant lifecycle teardown ` planning. Read-only. */ export declare function teardownOwned(options: AwsTeardownOptions, deps?: AwsTeardownDeps): Promise; /** * Delete the handed-over stacks: re-verify each stack's own tags, then * DeleteStack via `awsDelete`, polled to DELETE_COMPLETE. One outcome per * candidate, always. */ export declare function executeTeardown(options: AwsTeardownOptions & { candidates: TeardownCandidate[]; }, deps?: AwsTeardownDeps): Promise; //# sourceMappingURL=teardown.d.ts.map