@intentius/chant 0.52.2 → 0.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdk/advise.d.ts +29 -0
- package/dist/cdk/advise.d.ts.map +1 -0
- package/dist/cdk/assembly.d.ts +38 -0
- package/dist/cdk/assembly.d.ts.map +1 -0
- package/dist/cdk/graph.d.ts +68 -0
- package/dist/cdk/graph.d.ts.map +1 -0
- package/dist/cdk/tier-map.d.ts +44 -0
- package/dist/cdk/tier-map.d.ts.map +1 -0
- package/dist/cdk/types.d.ts +114 -0
- package/dist/cdk/types.d.ts.map +1 -0
- package/dist/cli/commands/carve-apply.d.ts.map +1 -1
- package/dist/cli/commands/carve-bridge.d.ts.map +1 -1
- package/dist/cli/commands/carve-emit.d.ts.map +1 -1
- package/dist/cli/commands/carve.d.ts +48 -6
- package/dist/cli/commands/carve.d.ts.map +1 -1
- package/dist/cli/handlers/carve-emit.d.ts.map +1 -1
- package/dist/cli/handlers/carve.d.ts +5 -4
- package/dist/cli/handlers/carve.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.d.ts +10 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/op-progress.d.ts +37 -4
- package/dist/cli/handlers/op-progress.d.ts.map +1 -1
- package/dist/cli/handlers/operator.d.ts +61 -1
- package/dist/cli/handlers/operator.d.ts.map +1 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/registry.d.ts +9 -1
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/identity.d.ts +196 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/lexicon.d.ts +41 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/converge-ledger.d.ts +81 -1
- package/dist/lifecycle/converge-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +43 -1
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/terraform/adopt-state.d.ts +17 -66
- package/dist/terraform/adopt-state.d.ts.map +1 -1
- package/dist/terraform/aws-resources.d.ts +1 -1
- package/dist/terraform/carve-provider.d.ts +142 -0
- package/dist/terraform/carve-provider.d.ts.map +1 -0
- package/dist/terraform/carve.d.ts +36 -3
- package/dist/terraform/carve.d.ts.map +1 -1
- package/dist/terraform/emit-source.d.ts +25 -0
- package/dist/terraform/emit-source.d.ts.map +1 -0
- package/dist/terraform/graduate.d.ts +11 -1
- package/dist/terraform/graduate.d.ts.map +1 -1
- package/dist/terraform/providers/aws.d.ts +19 -0
- package/dist/terraform/providers/aws.d.ts.map +1 -0
- package/dist/terraform/providers/gcp.d.ts +41 -0
- package/dist/terraform/providers/gcp.d.ts.map +1 -0
- package/dist/terraform/providers/index.d.ts +15 -0
- package/dist/terraform/providers/index.d.ts.map +1 -0
- package/dist/terraform/providers/kubernetes.d.ts +29 -0
- package/dist/terraform/providers/kubernetes.d.ts.map +1 -0
- package/dist/terraform/score.d.ts +70 -4
- package/dist/terraform/score.d.ts.map +1 -1
- package/dist/terraform/tier-map.d.ts +30 -35
- package/dist/terraform/tier-map.d.ts.map +1 -1
- package/dist/terraform/types.d.ts +6 -0
- package/dist/terraform/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cdk/__fixtures__/cdk.out/AppStack.template.json +171 -0
- package/src/cdk/__fixtures__/cdk.out/DataStack.template.json +90 -0
- package/src/cdk/__fixtures__/cdk.out/cdk.out +1 -0
- package/src/cdk/__fixtures__/cdk.out/manifest.json +30 -0
- package/src/cdk/__fixtures__/cdk.out/tree.json +201 -0
- package/src/cdk/__fixtures__/cdk.out-dummy/LookupStack.template.json +29 -0
- package/src/cdk/__fixtures__/cdk.out-dummy/manifest.json +26 -0
- package/src/cdk/advise.test.ts +208 -0
- package/src/cdk/advise.ts +44 -0
- package/src/cdk/assembly.ts +133 -0
- package/src/cdk/graph.test.ts +206 -0
- package/src/cdk/graph.ts +525 -0
- package/src/cdk/tier-map.ts +71 -0
- package/src/cdk/types.ts +115 -0
- package/src/cli/commands/carve-apply.ts +20 -4
- package/src/cli/commands/carve-bridge.ts +9 -5
- package/src/cli/commands/carve-emit-k8s.test.ts +262 -0
- package/src/cli/commands/carve-emit-provider.test.ts +207 -0
- package/src/cli/commands/carve-emit.ts +28 -24
- package/src/cli/commands/carve.ts +139 -36
- package/src/cli/handlers/carve-emit.ts +8 -3
- package/src/cli/handlers/carve.ts +8 -7
- package/src/cli/handlers/lifecycle.test.ts +187 -1
- package/src/cli/handlers/lifecycle.ts +125 -1
- package/src/cli/handlers/op-progress.test.ts +67 -1
- package/src/cli/handlers/op-progress.ts +70 -14
- package/src/cli/handlers/operator.test.ts +302 -1
- package/src/cli/handlers/operator.ts +193 -5
- package/src/cli/handlers/run.ts +11 -13
- package/src/cli/main.test.ts +19 -0
- package/src/cli/main.ts +38 -10
- package/src/cli/registry.ts +9 -1
- package/src/identity.test.ts +199 -0
- package/src/identity.ts +346 -0
- package/src/index.ts +1 -0
- package/src/lexicon.ts +53 -0
- package/src/lifecycle/converge-ledger.test.ts +110 -0
- package/src/lifecycle/converge-ledger.ts +110 -2
- package/src/lifecycle/gate-ledger.test.ts +81 -1
- package/src/lifecycle/gate-ledger.ts +64 -1
- package/src/terraform/__fixtures__/gcp-estate/main.tf +60 -0
- package/src/terraform/adopt-state.test.ts +131 -0
- package/src/terraform/adopt-state.ts +19 -167
- package/src/terraform/aws-resources.test.ts +38 -22
- package/src/terraform/aws-resources.ts +1 -1
- package/src/terraform/carve-provider.test.ts +155 -0
- package/src/terraform/carve-provider.ts +237 -0
- package/src/terraform/carve.test.ts +55 -1
- package/src/terraform/carve.ts +0 -0
- package/src/terraform/emit-source.ts +39 -0
- package/src/terraform/graduate.test.ts +37 -0
- package/src/terraform/graduate.ts +55 -7
- package/src/terraform/graph.ts +3 -3
- package/src/terraform/providers/aws.ts +169 -0
- package/src/terraform/providers/gcp.test.ts +228 -0
- package/src/terraform/providers/gcp.ts +329 -0
- package/src/terraform/providers/index.ts +21 -0
- package/src/terraform/providers/kubernetes.ts +224 -0
- package/src/terraform/score.ts +111 -25
- package/src/terraform/tier-map.ts +45 -107
- package/src/terraform/types.ts +6 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converge-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/converge-ledger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"converge-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/converge-ledger.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The address of the approval surface for a gate, resolved from the CI
|
|
3
|
+
* environment (#2028).
|
|
4
|
+
*
|
|
5
|
+
* #1485's argument for gate-as-fact was that approval gets an address:
|
|
6
|
+
* "gate-as-PR gives approval a URL, a review surface, and CODEOWNERS as the
|
|
7
|
+
* authorization model." What shipped recorded the gate and not the address,
|
|
8
|
+
* so a pending-approval card had nothing to link to and gate-as-PR stayed a
|
|
9
|
+
* convention. This is the narrow, honest half of that: when a tick (or a
|
|
10
|
+
* `chant approve`) runs inside the PR/MR job that carries the change, the
|
|
11
|
+
* loop genuinely knows where approval happens, and says so. Anywhere else it
|
|
12
|
+
* returns `undefined` and the field is simply absent — never a guess, never a
|
|
13
|
+
* synthesized link.
|
|
14
|
+
*
|
|
15
|
+
* The env-var fallback chain is the same one `--actor` and `--run-id` already
|
|
16
|
+
* use (`../cli/handlers/components.ts`): GitHub Actions first, then GitLab CI.
|
|
17
|
+
*
|
|
18
|
+
* - GitHub Actions on a `pull_request` event: `GITHUB_SERVER_URL` +
|
|
19
|
+
* `GITHUB_REPOSITORY` + the PR number, which `GITHUB_REF_NAME` carries as
|
|
20
|
+
* `<n>/merge`. A push-event run has no PR, so it resolves to nothing.
|
|
21
|
+
* - GitLab CI on a merge-request pipeline: `CI_MERGE_REQUEST_PROJECT_URL` +
|
|
22
|
+
* `CI_MERGE_REQUEST_IID`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveApprovalUrl(env?: NodeJS.ProcessEnv): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Whether `raw` is an address worth recording as one: an absolute `http`/
|
|
27
|
+
* `https` URL. A gate's address is a link a reader is expected to follow, so
|
|
28
|
+
* a relative path or a `file:`/`javascript:` scheme is refused at the CLI
|
|
29
|
+
* boundary rather than written into an immutable record.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isApprovalUrl(raw: string): boolean;
|
|
1
32
|
/** One immutable gate-resolution record. */
|
|
2
33
|
export interface GateResolutionRecord {
|
|
3
34
|
/** Schema version, so an incompatible future shape is detected before being misread. */
|
|
@@ -10,8 +41,19 @@ export interface GateResolutionRecord {
|
|
|
10
41
|
resolvedBy: string;
|
|
11
42
|
/** ISO-8601 timestamp, caller-supplied (library code never calls `Date.now()` internally). */
|
|
12
43
|
timestamp: string;
|
|
13
|
-
/** Optional free-text context
|
|
44
|
+
/** Optional free-text context. Before #2028 this was also where a PR link went by convention; put the link in {@link GateResolutionRecord.url} instead and leave this for prose. */
|
|
14
45
|
note?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The address this resolution happened at (#2028) — the PR that carried the
|
|
48
|
+
* change, the review thread, whatever the approval surface was. Typed, so
|
|
49
|
+
* "resolved by this PR" is machine-readable instead of a reader sniffing
|
|
50
|
+
* `note` for something that looks like a link.
|
|
51
|
+
*
|
|
52
|
+
* `chant approve --url` sets it; absent when the resolver genuinely had no
|
|
53
|
+
* address (a human at a terminal, no PR). Always an absolute `http`/`https`
|
|
54
|
+
* URL — see {@link isApprovalUrl}.
|
|
55
|
+
*/
|
|
56
|
+
url?: string;
|
|
15
57
|
}
|
|
16
58
|
export type GateResolutionInput = Omit<GateResolutionRecord, "version">;
|
|
17
59
|
/** Append one immutable gate-resolution record. Does not push to the remote — call `pushLifecycle` (./git.ts) afterward, same two-step shape every other ledger write here uses. Retries on `RefCASConflictError` the same way `appendConvergeRecord` does (./converge-ledger.ts) — a concurrent writer to a different op's/env's file on the same orphan branch is the ordinary case, not an edge case. The baseline read must be `readPathSha` + `readBlobBySha` rather than `readBlobFromPath`, so the exact sha `existing` came from can be passed as `expectPriorPathSha` — see `writeBlobToPath` (./git.ts) for the race that closes. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/gate-ledger.ts"],"names":[],"mappings":"AA4CA,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB;IACnC,wFAAwF;IACxF,OAAO,EAAE,CAAC,CAAC;IACX,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,yHAAyH;IACzH,UAAU,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,SAAS,EAAE,MAAM,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"gate-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/gate-ledger.ts"],"names":[],"mappings":"AA4CA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAY3F;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOlD;AAED,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB;IACnC,wFAAwF;IACxF,OAAO,EAAE,CAAC,CAAC;IACX,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,yHAAyH;IACzH,UAAU,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,SAAS,EAAE,MAAM,CAAC;IAClB,oLAAoL;IACpL,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;OASG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;AAMxE,+mBAA+mB;AAC/mB,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,mBAAmB,EAC1B,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,CAAC,CAqB3D;AAED,oPAAoP;AACpP,wBAAsB,mBAAmB,CACvC,EAAE,EAAE,MAAM,EACV,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC;IAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CA0BjE;AAED,uOAAuO;AACvO,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,oBAAoB,EAAE,EAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,oBAAoB,GAAG,SAAS,CASlC"}
|
|
@@ -4,81 +4,32 @@
|
|
|
4
4
|
* a TF resource is created through the provider API, not CloudFormation, so it
|
|
5
5
|
* is not in any CFN stack — but its resolved attributes ARE in the state file.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* `
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* without a mapping are preserved in a reference comment, never dropped.
|
|
13
|
-
*
|
|
14
|
-
* Deferred outbound inputs (#998): an attribute whose value the Terraform
|
|
15
|
-
* source read from a survivor (`vpc_id = aws_vpc.main.id`) is not a fact of
|
|
16
|
-
* the carved resource — it is a deploy-time input. Those props are emitted as
|
|
17
|
-
* `params.<name>` references instead of frozen literals, with the state's
|
|
18
|
-
* resolved value as the declared default (see `carve-emit.ts`'s scaffold).
|
|
7
|
+
* The mapping itself belongs to the carve provider that owns the Terraform type
|
|
8
|
+
* (`carve-provider.ts`, #2016) — aws maps snake_case provider attributes to
|
|
9
|
+
* CloudFormation PascalCase props over the AWS carve-out table. This module is
|
|
10
|
+
* the dispatch: it resolves the provider and hands off. A new provider adds a
|
|
11
|
+
* file under `providers/`, never an edit here.
|
|
19
12
|
*/
|
|
13
|
+
import { type AdoptedSource, type DeferredParam } from "./carve-provider.js";
|
|
20
14
|
import type { StateResource } from "./state.js";
|
|
21
|
-
|
|
22
|
-
export
|
|
23
|
-
/**
|
|
24
|
-
* One deferred outbound input turned into a build parameter (#998). Derived
|
|
25
|
-
* from the boundary report's outbound edges + the state's resolved attributes
|
|
26
|
-
* in `carve-emit.ts`; consumed here (source substitution) and by the scaffold
|
|
27
|
-
* (`chant.config.ts` `buildParams` declaration).
|
|
28
|
-
*/
|
|
29
|
-
export interface DeferredParam {
|
|
30
|
-
/** Build-parameter name, source-referenceable (`params.<name>`). */
|
|
31
|
-
name: string;
|
|
32
|
-
/** The carved resource's own Terraform attribute the value enters through. */
|
|
33
|
-
tfAttr: string;
|
|
34
|
-
/** The survivor the Terraform source read, e.g. `aws_vpc.main`. */
|
|
35
|
-
survivor: string;
|
|
36
|
-
/** Survivor attribute(s) read, e.g. `["id"]`. */
|
|
37
|
-
attrs: string[];
|
|
38
|
-
/** The state-resolved value — the parameter's declared default. */
|
|
39
|
-
default?: string | number | boolean;
|
|
40
|
-
}
|
|
41
|
-
/** What one folded sub-resource contributed to the parent's emitted props (#1637). */
|
|
42
|
-
export interface FoldedContribution {
|
|
43
|
-
/** The sub-resource's Terraform address, e.g. `aws_s3_bucket_versioning.assets`. */
|
|
44
|
-
address: string;
|
|
45
|
-
/** CFN properties it added to the parent, e.g. `["VersioningConfiguration"]`. */
|
|
46
|
-
props: string[];
|
|
47
|
-
}
|
|
48
|
-
export interface AdoptedSource {
|
|
49
|
-
fileName: string;
|
|
50
|
-
content: string;
|
|
51
|
-
/** True when at least one attribute was mapped to a native prop. */
|
|
52
|
-
mapped: boolean;
|
|
53
|
-
nativeType: string;
|
|
54
|
-
/** Deferred params actually substituted into the emitted props (#998). */
|
|
55
|
-
parameterized: string[];
|
|
56
|
-
/** Folded sub-resources and the props each one joined into the parent (#1637). */
|
|
57
|
-
folded: FoldedContribution[];
|
|
58
|
-
}
|
|
15
|
+
export { PARAMS_IMPORT } from "./emit-source.js";
|
|
16
|
+
export type { AdoptedSource, DeferredParam, FoldedContribution } from "./carve-provider.js";
|
|
59
17
|
/**
|
|
60
|
-
* Is this Terraform type adoptable from state (
|
|
61
|
-
*
|
|
18
|
+
* Is this Terraform type adoptable from state (a provider emits it)? The same
|
|
19
|
+
* gate serves the live path, so both are the shared `canCarveEmit`.
|
|
62
20
|
*/
|
|
63
21
|
export declare function canAdoptFromState(tfType: string): boolean;
|
|
64
22
|
/** Terraform types that can currently be adopted from state, for user-facing hints. */
|
|
65
23
|
export declare function supportedStateAdoptionTypes(): string[];
|
|
66
24
|
/**
|
|
67
|
-
* Render chant source for a state-adopted resource
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* reference (a real chant build parameter) instead of the state literal —
|
|
73
|
-
* the value came from a survivor, so it stays overridable per build.
|
|
25
|
+
* Render chant source for a state-adopted resource, through the provider that
|
|
26
|
+
* owns its Terraform type. `params` carries the deferred outbound inputs the
|
|
27
|
+
* boundary report found (#998) and `folded` the carve set's sub-resources read
|
|
28
|
+
* from the same state file (#1637); what a provider does with them is its own
|
|
29
|
+
* business, and both are reported back on the {@link AdoptedSource}.
|
|
74
30
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* the parent's props (#1637) — a fold that only announced itself and left the
|
|
78
|
-
* emitted resource without the versioning or public-access block the Terraform
|
|
79
|
-
* declared was a silent loss of configuration. A sub-resource's setting wins
|
|
80
|
-
* over the parent's own legacy in-state block: it is the one the config
|
|
81
|
-
* actually declares.
|
|
31
|
+
* Null means no registered provider emits this type — the caller has already
|
|
32
|
+
* refused it at the emit gate, so this is the belt-and-braces path.
|
|
82
33
|
*/
|
|
83
34
|
export declare function adoptFromState(resource: StateResource, params?: DeferredParam[], folded?: StateResource[]): AdoptedSource | null;
|
|
84
35
|
//# sourceMappingURL=adopt-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adopt-state.d.ts","sourceRoot":"","sources":["../../src/terraform/adopt-state.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"adopt-state.d.ts","sourceRoot":"","sources":["../../src/terraform/adopt-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEzF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,uFAAuF;AACvF,wBAAgB,2BAA2B,IAAI,MAAM,EAAE,CAEtD;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,aAAa,EACvB,MAAM,GAAE,aAAa,EAAO,EAC5B,MAAM,GAAE,aAAa,EAAO,GAC3B,aAAa,GAAG,IAAI,CAGtB"}
|
|
@@ -37,7 +37,7 @@ export declare const AWS_LEXICON_IMPORT = "@intentius/chant-lexicon-aws";
|
|
|
37
37
|
export declare const AWS_CARVE_TYPES: AwsCarveType[];
|
|
38
38
|
export declare function awsCarveType(tfType: string): AwsCarveType | undefined;
|
|
39
39
|
/**
|
|
40
|
-
* How a folded sub-resource (see `
|
|
40
|
+
* How a folded sub-resource (see the provider's `foldsInto`) joins its parent's emitted
|
|
41
41
|
* properties (#1637). Terraform splits configuration the CloudFormation shape
|
|
42
42
|
* keeps inside the parent resource, so the fold is not just a carve-set
|
|
43
43
|
* membership claim: the sub-resource's attributes have to land in the parent's
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The carve provider seam (#2016).
|
|
3
|
+
*
|
|
4
|
+
* `carve advise|emit|bridge` used to reach into the AWS carve table directly:
|
|
5
|
+
* the tier map derived from it, the emit gate was `awsCarveType(t) !== undefined`,
|
|
6
|
+
* the adopter called `applyAwsMapper`, and the emitted project's lexicon was a
|
|
7
|
+
* constant. A second provider — Kubernetes emit (#999), GCP (#2017) — had
|
|
8
|
+
* nowhere to land except a parallel path beside the AWS one.
|
|
9
|
+
*
|
|
10
|
+
* A provider owns one or more Terraform type prefixes and answers everything
|
|
11
|
+
* the carve commands ask about the types under them: how each ranks against a
|
|
12
|
+
* native spec, which HCL attribute carries the physical name, which
|
|
13
|
+
* sub-resources fold into a parent, which types emit can produce source for,
|
|
14
|
+
* and how to adopt one from `.tfstate`.
|
|
15
|
+
*
|
|
16
|
+
* ── Why the registry lives in core, not behind a `LexiconPlugin` capability ──
|
|
17
|
+
*
|
|
18
|
+
* `carve advise` runs against a Terraform directory that is not a chant project:
|
|
19
|
+
* there is no `chant.config.ts` naming lexicons, so there is nothing to load
|
|
20
|
+
* plugins from, and `carve emit --state` is deliberately offline (see the
|
|
21
|
+
* handler). Behind a plugin capability both would have to load plugins to learn
|
|
22
|
+
* that a type ranks tier 1. Providers are also Terraform-provider knowledge
|
|
23
|
+
* (`terraform-provider-aws` attribute names), which belongs beside the HCL
|
|
24
|
+
* parser rather than inside a lexicon.
|
|
25
|
+
*
|
|
26
|
+
* `registerCarveProvider` is exported, so a plugin that wants to contribute a
|
|
27
|
+
* provider at runtime still can — the seam does not foreclose it, it just does
|
|
28
|
+
* not require plugin loading for the paths that run without one.
|
|
29
|
+
*/
|
|
30
|
+
import type { StateResource } from "./state.js";
|
|
31
|
+
export interface TierInfo {
|
|
32
|
+
tier: 1 | 2 | 3;
|
|
33
|
+
/** The native spec type a carve would target, for the report. */
|
|
34
|
+
mapsTo: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* One deferred outbound input turned into a build parameter (#998). Derived
|
|
38
|
+
* from the boundary report's outbound edges + the state's resolved attributes
|
|
39
|
+
* in `carve-emit.ts`; consumed by a provider's `adopt` (source substitution)
|
|
40
|
+
* and by the scaffold (`chant.config.ts` `buildParams` declaration).
|
|
41
|
+
*/
|
|
42
|
+
export interface DeferredParam {
|
|
43
|
+
/** Build-parameter name, source-referenceable (`params.<name>`). */
|
|
44
|
+
name: string;
|
|
45
|
+
/** The carved resource's own Terraform attribute the value enters through. */
|
|
46
|
+
tfAttr: string;
|
|
47
|
+
/** The survivor the Terraform source read, e.g. `aws_vpc.main`. */
|
|
48
|
+
survivor: string;
|
|
49
|
+
/** Survivor attribute(s) read, e.g. `["id"]`. */
|
|
50
|
+
attrs: string[];
|
|
51
|
+
/** The state-resolved value — the parameter's declared default. */
|
|
52
|
+
default?: string | number | boolean;
|
|
53
|
+
}
|
|
54
|
+
/** What one folded sub-resource contributed to the parent's emitted props (#1637). */
|
|
55
|
+
export interface FoldedContribution {
|
|
56
|
+
/** The sub-resource's Terraform address, e.g. `aws_s3_bucket_versioning.assets`. */
|
|
57
|
+
address: string;
|
|
58
|
+
/** Native properties it added to the parent, e.g. `["VersioningConfiguration"]`. */
|
|
59
|
+
props: string[];
|
|
60
|
+
}
|
|
61
|
+
export interface AdoptedSource {
|
|
62
|
+
fileName: string;
|
|
63
|
+
content: string;
|
|
64
|
+
/** True when at least one attribute was mapped to a native prop. */
|
|
65
|
+
mapped: boolean;
|
|
66
|
+
nativeType: string;
|
|
67
|
+
/** Deferred params actually substituted into the emitted props (#998). */
|
|
68
|
+
parameterized: string[];
|
|
69
|
+
/** Folded sub-resources and the props each one joined into the parent (#1637). */
|
|
70
|
+
folded: FoldedContribution[];
|
|
71
|
+
}
|
|
72
|
+
export interface CarveProvider {
|
|
73
|
+
/** Registry id, unique. Registering a second provider under it replaces the first. */
|
|
74
|
+
readonly name: string;
|
|
75
|
+
/**
|
|
76
|
+
* Terraform type prefixes this provider owns, e.g. `["aws_"]`. Resolution
|
|
77
|
+
* takes the longest match, so a narrower provider can claim a subset of a
|
|
78
|
+
* wider one's prefix.
|
|
79
|
+
*/
|
|
80
|
+
readonly tfTypePrefixes: readonly string[];
|
|
81
|
+
/**
|
|
82
|
+
* The chant lexicon emitted source targets — the scaffolded project's
|
|
83
|
+
* dependency and `--lexicon` flag, and the lexicon the live import runs
|
|
84
|
+
* against.
|
|
85
|
+
*/
|
|
86
|
+
readonly lexicon: string;
|
|
87
|
+
/** Terraform type → native tier, contributed to the advisor's tier map. */
|
|
88
|
+
readonly tiers: Readonly<Record<string, TierInfo>>;
|
|
89
|
+
/**
|
|
90
|
+
* Terraform type → the HCL attribute carrying the physical name. A dotted
|
|
91
|
+
* entry is a path into nested blocks (`manifest.metadata.name`); the bridge
|
|
92
|
+
* refuses those, since a data-source body is flat `attr = value`.
|
|
93
|
+
*/
|
|
94
|
+
readonly identityAttrs?: Readonly<Record<string, string>>;
|
|
95
|
+
/**
|
|
96
|
+
* Sub-resource Terraform type → parent type, for types Terraform splits out
|
|
97
|
+
* of the resource the native spec keeps them in.
|
|
98
|
+
*/
|
|
99
|
+
readonly foldsInto?: Readonly<Record<string, string>>;
|
|
100
|
+
/**
|
|
101
|
+
* Terraform types `carve emit` can produce chant source for — narrower than
|
|
102
|
+
* `tiers`, which advise also ranks types no emit path can adopt. Absent or
|
|
103
|
+
* empty means advise-only. Declaring types here obliges the provider to
|
|
104
|
+
* implement {@link adopt}: both emit paths gate on the same list (#2015), so
|
|
105
|
+
* a type the live path accepts must be adoptable from state too.
|
|
106
|
+
*/
|
|
107
|
+
readonly emitTypes?: readonly string[];
|
|
108
|
+
/** Adopt a resource from Terraform state into chant source. */
|
|
109
|
+
adopt?(resource: StateResource, params: DeferredParam[], folded: StateResource[]): AdoptedSource | null;
|
|
110
|
+
/**
|
|
111
|
+
* The native selector type the live (cloud→code) import filters on, e.g.
|
|
112
|
+
* `AWS::S3::Bucket`. Undefined when this type has no live adoption path —
|
|
113
|
+
* `carve emit --env` refuses it rather than importing the wrong thing.
|
|
114
|
+
*/
|
|
115
|
+
liveSelectorType?(tfType: string): string | undefined;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Register a carve provider. Returns a function that removes it again, so a
|
|
119
|
+
* test (or a plugin unloading) leaves the registry as it found it.
|
|
120
|
+
*/
|
|
121
|
+
export declare function registerCarveProvider(provider: CarveProvider): () => void;
|
|
122
|
+
/** Every registered provider, in registration order. */
|
|
123
|
+
export declare function carveProviders(): readonly CarveProvider[];
|
|
124
|
+
/** The provider owning this Terraform type, by longest prefix match. */
|
|
125
|
+
export declare function resolveCarveProvider(tfType: string): CarveProvider | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* The provider that can emit chant source for this Terraform type. Narrower
|
|
128
|
+
* than {@link resolveCarveProvider}: a provider owns every type under its
|
|
129
|
+
* prefix for advise, and only the ones on its `emitTypes` list for emit.
|
|
130
|
+
*/
|
|
131
|
+
export declare function resolveEmitProvider(tfType: string): CarveProvider | undefined;
|
|
132
|
+
/** Every Terraform type any registered provider can emit, sorted, for user-facing hints. */
|
|
133
|
+
export declare function carveEmitTypes(): string[];
|
|
134
|
+
/** The lexicons emit can adopt into, sorted — what the CLI loads plugins for. */
|
|
135
|
+
export declare function carveEmitLexicons(): string[];
|
|
136
|
+
/** Terraform resource type → native tier, merged over every provider. Read-only: it is the cached index. */
|
|
137
|
+
export declare function carveTierMap(): Readonly<Record<string, TierInfo>>;
|
|
138
|
+
/** The HCL attribute carrying this type's physical name, if its provider declares one. */
|
|
139
|
+
export declare function carveIdentityAttr(tfType: string): string | undefined;
|
|
140
|
+
/** The parent Terraform type this sub-resource folds into, if any. */
|
|
141
|
+
export declare function carveFoldParent(tfType: string): string | undefined;
|
|
142
|
+
//# sourceMappingURL=carve-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carve-provider.d.ts","sourceRoot":"","sources":["../../src/terraform/carve-provider.ts"],"names":[],"mappings":"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"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* (via live import) and generating the TF patches live in the command/bridge
|
|
11
11
|
* layers; this module just classifies the boundary.
|
|
12
12
|
*/
|
|
13
|
+
import { type ScoreOptions } from "./score.js";
|
|
13
14
|
import type { TfGraph } from "./types.js";
|
|
14
15
|
/** One resource in the carve set (the selected node plus its folded sub-resources). */
|
|
15
16
|
export interface CarveMember {
|
|
@@ -47,8 +48,17 @@ export interface BoundaryEdge {
|
|
|
47
48
|
* named after on emit. For an output edge it is `["value"]`.
|
|
48
49
|
*/
|
|
49
50
|
via: string[];
|
|
50
|
-
|
|
51
|
+
/**
|
|
52
|
+
* The patch that bridges the cut, in the surviving source's own vocabulary.
|
|
53
|
+
* Terraform: a `data` source, an `output` expression rewrite, or a deferred
|
|
54
|
+
* deploy-time input. CDK (#1056): `cdk-import` — the surviving app reimports
|
|
55
|
+
* the carved resource by ARN/name — or a `Outputs` rewrite. Open-ended: a
|
|
56
|
+
* reader must tolerate a value it does not know.
|
|
57
|
+
*/
|
|
58
|
+
bridge: "tf-data-source" | "tf-output-rewrite" | "cdk-import" | "cfn-output-rewrite" | "deferred-input";
|
|
51
59
|
required: "immediately" | "at-apply";
|
|
60
|
+
/** The two ends live in different CloudFormation templates (#1056). */
|
|
61
|
+
crossStack?: boolean;
|
|
52
62
|
}
|
|
53
63
|
export interface CarveReport {
|
|
54
64
|
/** The selected resource address. */
|
|
@@ -64,20 +74,43 @@ export interface CarveReport {
|
|
|
64
74
|
}
|
|
65
75
|
/**
|
|
66
76
|
* The carve set for a selected address: the node itself plus any sub-resources
|
|
67
|
-
* that fold into it (same name, a `
|
|
77
|
+
* that fold into it (same name, a `foldParentOf` child type whose parent is the
|
|
68
78
|
* selection). Those are carried along and inlined, not left behind.
|
|
69
79
|
*/
|
|
70
80
|
export declare function resolveCarveSet(graph: TfGraph, target: string): CarveMember[];
|
|
81
|
+
/**
|
|
82
|
+
* Which source the graph came from, and so which vocabulary its bridge patches
|
|
83
|
+
* are named in. Terraform is the default; `cdk` is the read-only cloud-assembly
|
|
84
|
+
* advisor (#1056), where the surviving app reimports rather than adding a
|
|
85
|
+
* `data` source.
|
|
86
|
+
*/
|
|
87
|
+
export type CarveDialect = "terraform" | "cdk";
|
|
88
|
+
export interface BoundaryOptions {
|
|
89
|
+
dialect?: CarveDialect;
|
|
90
|
+
/** Scoring hooks, so `peelability` is the same number the ranking reported. */
|
|
91
|
+
score?: ScoreOptions;
|
|
92
|
+
}
|
|
71
93
|
/**
|
|
72
94
|
* Classify the boundary of carving `target`: the inbound edges that need an
|
|
73
95
|
* immediate data-source patch, and the outbound edges that become deferred
|
|
74
96
|
* deploy-time inputs. Edges internal to the carve set (e.g. a folded
|
|
75
97
|
* sub-resource pointing at its parent) are not boundary work.
|
|
76
98
|
*/
|
|
77
|
-
export declare function boundaryReport(graph: TfGraph, target: string): CarveReport | null;
|
|
99
|
+
export declare function boundaryReport(graph: TfGraph, target: string, opts?: BoundaryOptions): CarveReport | null;
|
|
78
100
|
/**
|
|
79
101
|
* The build-parameter name a deferred input's carrying attribute becomes on
|
|
80
102
|
* emit (#998) — shared so bridge notes and emitted `buildParams` agree.
|
|
81
103
|
*/
|
|
82
104
|
export declare function deferredParamName(tfAttr: string): string;
|
|
105
|
+
/**
|
|
106
|
+
* Collapse duplicate edges (same survivor/carved pair), merging attrs.
|
|
107
|
+
*
|
|
108
|
+
* The map key below joins the two addresses with U+001F (unit separator).
|
|
109
|
+
* A Terraform address is built from HCL identifiers plus `.`, `[`, `]`, `"`
|
|
110
|
+
* and `-`; it cannot contain a C0 control character, so U+001F can never
|
|
111
|
+
* collide with an address component. Keep it that way — this key is never
|
|
112
|
+
* serialized, so a plain, non-printing separator is fine, but it must stay
|
|
113
|
+
* a character no address can produce.
|
|
114
|
+
*/
|
|
115
|
+
export declare function dedupeEdges(edges: BoundaryEdge[]): BoundaryEdge[];
|
|
83
116
|
//# sourceMappingURL=carve.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carve.d.ts","sourceRoot":"","sources":["../../src/terraform/carve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"carve.d.ts","sourceRoot":"","sources":["../../src/terraform/carve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,uFAAuF;AACvF,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;;;;OAKG;IACH,GAAG,EAAE,MAAM,EAAE,CAAC;IACd;;;;;;OAMG;IACH,MAAM,EAAE,gBAAgB,GAAG,mBAAmB,GAAG,YAAY,GAAG,oBAAoB,GAAG,gBAAgB,CAAC;IACxG,QAAQ,EAAE,aAAa,GAAG,UAAU,CAAC;IACrC,uEAAuE;IACvE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,iFAAiF;IACjF,UAAU,EAAE,IAAI,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,CAgB7E;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,KAAK,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAQD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,eAAoB,GAAG,WAAW,GAAG,IAAI,CA0D7G;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAajE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source rendering shared by constructor-shaped carve providers (#2016).
|
|
3
|
+
*
|
|
4
|
+
* A provider that adopts into a typed chant constructor call — aws today, gcp
|
|
5
|
+
* next (#2017) — renders the same literal: an import, an exported `new Ctor({
|
|
6
|
+
* ...props })`, and a reference comment carrying whatever the mapping could not
|
|
7
|
+
* place. Only the lexicon import path and the property mapping differ, so the
|
|
8
|
+
* rendering lives here rather than being copied per provider.
|
|
9
|
+
*
|
|
10
|
+
* A provider whose native shape is not a constructor call (a Kubernetes
|
|
11
|
+
* manifest, #999) renders its own source and does not use this.
|
|
12
|
+
*/
|
|
13
|
+
/** The core subpath the emitted source reads build parameters from. */
|
|
14
|
+
export declare const PARAMS_IMPORT = "@intentius/chant/params";
|
|
15
|
+
/** Marker for a prop whose value is a `params.<name>` reference, not a literal. */
|
|
16
|
+
export declare class ParamRef {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly type: "string" | "number" | "boolean";
|
|
19
|
+
constructor(name: string, type: "string" | "number" | "boolean");
|
|
20
|
+
}
|
|
21
|
+
/** Render a JS object literal with stable key order and given indent. */
|
|
22
|
+
export declare function renderObject(obj: Record<string, unknown>, indent: number): string;
|
|
23
|
+
/** A prop value: a `params.<name>` reference (cast keeps the project tsc-clean) or a literal. */
|
|
24
|
+
export declare function renderValue(value: unknown): string;
|
|
25
|
+
//# sourceMappingURL=emit-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-source.d.ts","sourceRoot":"","sources":["../../src/terraform/emit-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,uEAAuE;AACvE,eAAO,MAAM,aAAa,4BAA4B,CAAC;AAEvD,mFAAmF;AACnF,qBAAa,QAAQ;IAEjB,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;gBADrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;CAEjD;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjF;AAED,iGAAiG;AACjG,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAElD"}
|
|
@@ -25,8 +25,10 @@ export declare const DEFAULT_TAG_OWNERSHIP_KEYS: ChannelKeys;
|
|
|
25
25
|
export interface GraduationPlan {
|
|
26
26
|
target: string;
|
|
27
27
|
marker: OwnershipMarker;
|
|
28
|
-
/** The ownership
|
|
28
|
+
/** The ownership entries the emitted resource must carry to be chant-owned. */
|
|
29
29
|
ownershipTags: Record<string, string>;
|
|
30
|
+
/** What that channel is called on this target: `tags`, or `labels` for k8s. */
|
|
31
|
+
markerKind: string;
|
|
30
32
|
/** The finalized, ordered apply runbook. */
|
|
31
33
|
steps: string[];
|
|
32
34
|
warnings: string[];
|
|
@@ -38,6 +40,14 @@ export interface GraduationOptions {
|
|
|
38
40
|
env?: string;
|
|
39
41
|
/** Override the tag channel (e.g. for a non-AWS lexicon). */
|
|
40
42
|
channel?: ChannelKeys;
|
|
43
|
+
/**
|
|
44
|
+
* The lexicon the emitted source targets, from the carve provider that
|
|
45
|
+
* adopted the type. It decides how the build and the apply are spelled: a
|
|
46
|
+
* CloudFormation template and `aws cloudformation deploy` for aws, a manifest
|
|
47
|
+
* and `kubectl apply` for k8s (#999). Unknown falls back to the aws wording,
|
|
48
|
+
* which is what every carve was before there was a second provider.
|
|
49
|
+
*/
|
|
50
|
+
lexicon?: string;
|
|
41
51
|
}
|
|
42
52
|
export declare function graduationPlan(report: CarveReport, opts?: GraduationOptions): GraduationPlan;
|
|
43
53
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graduate.d.ts","sourceRoot":"","sources":["../../src/terraform/graduate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"graduate.d.ts","sourceRoot":"","sources":["../../src/terraform/graduate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAA0C,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAC9G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAIxC,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,eAAe,CAAC;IACxB,+EAA+E;IAC/E,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,+EAA+E;IAC/E,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA6BD,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,GAAE,iBAAsB,GAAG,cAAc,CA4BhG;AAWD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAqC9C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The AWS carve provider (#2016) — the seam's implementation over the AWS
|
|
3
|
+
* carve-out table (`../aws-resources.ts`), which stays the single source of
|
|
4
|
+
* truth for which AWS Terraform types chant can carve and how.
|
|
5
|
+
*
|
|
6
|
+
* chant AWS constructors take CloudFormation PascalCase properties (e.g.
|
|
7
|
+
* `new Bucket({ BucketName })`), while Terraform state uses the provider's
|
|
8
|
+
* snake_case attributes (`bucket`, `tags`). Attributes without a mapping are
|
|
9
|
+
* preserved in a reference comment, never dropped.
|
|
10
|
+
*
|
|
11
|
+
* Deferred outbound inputs (#998): an attribute whose value the Terraform
|
|
12
|
+
* source read from a survivor (`vpc_id = aws_vpc.main.id`) is not a fact of
|
|
13
|
+
* the carved resource — it is a deploy-time input. Those props are emitted as
|
|
14
|
+
* `params.<name>` references instead of frozen literals, with the state's
|
|
15
|
+
* resolved value as the declared default (see `carve-emit.ts`'s scaffold).
|
|
16
|
+
*/
|
|
17
|
+
import type { CarveProvider } from "../carve-provider.js";
|
|
18
|
+
export declare const awsCarveProvider: CarveProvider;
|
|
19
|
+
//# sourceMappingURL=aws.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws.d.ts","sourceRoot":"","sources":["../../../src/terraform/providers/aws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAWH,OAAO,KAAK,EAAiB,aAAa,EAA+C,MAAM,mBAAmB,CAAC;AAgInH,eAAO,MAAM,gBAAgB,EAAE,aAc9B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The GCP carve provider (#2017) — advise-only.
|
|
3
|
+
*
|
|
4
|
+
* `mapsTo` names a Config Connector type as the gcp lexicon spells it
|
|
5
|
+
* (`GCP::Storage::Bucket`), not a Terraform type and not a raw CNRM kind. Every
|
|
6
|
+
* value here is checked against `lexicons/gcp/dist/meta.json` by
|
|
7
|
+
* `gcp.test.ts`, so an entry pointing at a type the lexicon does not define
|
|
8
|
+
* fails the suite rather than shipping a report that promises a resource chant
|
|
9
|
+
* cannot build.
|
|
10
|
+
*
|
|
11
|
+
* The google Terraform provider and Config Connector wrap the same GCP API, so
|
|
12
|
+
* resource granularity matches almost everywhere. That is why `foldsInto` is
|
|
13
|
+
* empty: unlike S3, where Terraform splits versioning, ACLs and encryption out
|
|
14
|
+
* of the bucket CloudFormation keeps together, GCP has no family where several
|
|
15
|
+
* `google_*` resources collapse into one CNRM resource.
|
|
16
|
+
*
|
|
17
|
+
* Tiers follow the reshaping the constructor demands, not the API's size:
|
|
18
|
+
*
|
|
19
|
+
* 1 — flat rename, `google_pubsub_topic` to `GCP::Pubsub::Topic`.
|
|
20
|
+
* 2 — a cross-resource reference becomes a `*Ref` object, or a Terraform
|
|
21
|
+
* block list becomes a CNRM object. Most of the table.
|
|
22
|
+
* 3 — the native shape is a re-modelling. `google_container_cluster` inlines
|
|
23
|
+
* node pools Terraform also declares separately, `google_sql_database_
|
|
24
|
+
* instance` carries everything under `settings`, and the IAM membership
|
|
25
|
+
* resources map onto one generic `GCP::Iam::PolicyMember` per binding.
|
|
26
|
+
*
|
|
27
|
+
* No `emitTypes` and no `adopt`, so `carve emit` refuses these types on both
|
|
28
|
+
* paths with the same message (#2015). Emit is a larger piece of work than the
|
|
29
|
+
* per-attribute rename the tier map implies: CNRM addresses a sibling through
|
|
30
|
+
* a `*Ref` object rather than the id or self-link Terraform state holds, and
|
|
31
|
+
* the resource's own name lives in `metadata.name` with `resourceID` as the
|
|
32
|
+
* override, so a faithful adopter has to resolve both per type. Declaring emit
|
|
33
|
+
* before that exists would put back the advise/emit cliff #2015 closed.
|
|
34
|
+
*/
|
|
35
|
+
import type { CarveProvider, TierInfo } from "../carve-provider.js";
|
|
36
|
+
/** Terraform type → tier, the shape the registry merges into the tier map. */
|
|
37
|
+
export declare const GCP_TIERS: Readonly<Record<string, TierInfo>>;
|
|
38
|
+
/** Terraform type → the HCL attribute carrying its physical name. */
|
|
39
|
+
export declare const GCP_IDENTITY_ATTRS: Readonly<Record<string, string>>;
|
|
40
|
+
export declare const gcpCarveProvider: CarveProvider;
|
|
41
|
+
//# sourceMappingURL=gcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gcp.d.ts","sourceRoot":"","sources":["../../../src/terraform/providers/gcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAiRjE,8EAA8E;AAC9E,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAExD,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAI/D,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,aAQ9B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The carve providers core ships with (#2016). Adding a provider is a file
|
|
3
|
+
* here plus a line in this list — no edit to `adopt-state.ts` or
|
|
4
|
+
* `carve-emit.ts`, which resolve everything through the registry.
|
|
5
|
+
*
|
|
6
|
+
* This module holds no runtime dependency on `../carve-provider`, so the
|
|
7
|
+
* registry can import the list without an import cycle.
|
|
8
|
+
*/
|
|
9
|
+
import { awsCarveProvider } from "./aws.js";
|
|
10
|
+
import { gcpCarveProvider } from "./gcp.js";
|
|
11
|
+
import { kubernetesCarveProvider } from "./kubernetes.js";
|
|
12
|
+
import type { CarveProvider } from "../carve-provider.js";
|
|
13
|
+
export declare const BUILTIN_CARVE_PROVIDERS: readonly CarveProvider[];
|
|
14
|
+
export { awsCarveProvider, gcpCarveProvider, kubernetesCarveProvider };
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/terraform/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,eAAO,MAAM,uBAAuB,EAAE,SAAS,aAAa,EAI3D,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Kubernetes carve provider (#2016 seam, #999 emit).
|
|
3
|
+
*
|
|
4
|
+
* `kubernetes_manifest` IS the manifest (tier 1) and is the type emit adopts.
|
|
5
|
+
* The typed provider resources (`kubernetes_deployment`, ...) reshape their HCL
|
|
6
|
+
* schema back into a manifest, so they rank tier 2; the common `_v1` aliases
|
|
7
|
+
* share their base type's entry. They are advise-only: recovering a manifest
|
|
8
|
+
* from the provider's own schema is a per-type reshaping (`container` blocks to
|
|
9
|
+
* `containers`, `metadata` blocks unwrapped from their single-element state
|
|
10
|
+
* arrays), not something the generic path below can do honestly, so emit
|
|
11
|
+
* refuses them on both paths with the same message (#2015).
|
|
12
|
+
*
|
|
13
|
+
* ── Two things `kubernetes_manifest` does not share with an AWS type ──
|
|
14
|
+
*
|
|
15
|
+
* It has no fixed entity type. The target kind lives INSIDE the resource: the
|
|
16
|
+
* `manifest` attribute is the body, and its `apiVersion`/`kind` are what say
|
|
17
|
+
* whether this block is a ConfigMap or a cert-manager Certificate. So `mapsTo`
|
|
18
|
+
* can only name the family, and `adopt` reads the body to learn the rest —
|
|
19
|
+
* which is also why one rule here covers every CRD.
|
|
20
|
+
*
|
|
21
|
+
* It has no live adoption path. `carve emit --env` filters a live export by a
|
|
22
|
+
* native type, and there is no type to filter by until the body is read; state
|
|
23
|
+
* is where the body is. `liveSelectorType` therefore returns undefined and
|
|
24
|
+
* `--env` refuses with "adopts it from state only", rather than importing
|
|
25
|
+
* something else.
|
|
26
|
+
*/
|
|
27
|
+
import type { CarveProvider } from "../carve-provider.js";
|
|
28
|
+
export declare const kubernetesCarveProvider: CarveProvider;
|
|
29
|
+
//# sourceMappingURL=kubernetes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kubernetes.d.ts","sourceRoot":"","sources":["../../../src/terraform/providers/kubernetes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAiB,aAAa,EAA2B,MAAM,mBAAmB,CAAC;AAuL/F,eAAO,MAAM,uBAAuB,EAAE,aAarC,CAAC"}
|