@intentius/chant 0.52.2 → 0.53.0
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/main.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/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/main.ts +12 -5
- 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/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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carve-provider.d.ts","sourceRoot":"","sources":["../../src/terraform/carve-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,QAAQ,EAA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AE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,aAAa,GAAG,IAAI,CAAC;IACxG;;;;OAIG;IACH,gBAAgB,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACvD;AAqBD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,IAAI,CAYzE;AAED,wDAAwD;AACxD,wBAAgB,cAAc,IAAI,SAAS,aAAa,EAAE,CAEzD;AAmCD,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE9E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE7E;AAED,4FAA4F;AAC5F,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAE5C;AAED,4GAA4G;AAC5G,wBAAgB,YAAY,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAEjE;AAED,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpE;AAED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAElE"}
|
|
@@ -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,EA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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"}
|
|
@@ -18,11 +18,19 @@
|
|
|
18
18
|
* expression in a block that manages no infrastructure, the same order of work
|
|
19
19
|
* as recording an outbound deferred input. Hence 4, not 12.
|
|
20
20
|
*
|
|
21
|
-
* Sub-resources that inline into a parent (see `
|
|
21
|
+
* Sub-resources that inline into a parent (see `foldParentOf`) are folded into the
|
|
22
22
|
* parent's carve set: they are removed from the ranking and their edge to the
|
|
23
23
|
* parent is not counted as inbound — inlining them is free, not boundary work.
|
|
24
|
+
*
|
|
25
|
+
* The model itself is not Terraform-specific — the CDK cloud-assembly advisor
|
|
26
|
+
* (#1056) scores construct units with the same arithmetic. What differs per
|
|
27
|
+
* source is the type→tier lookup and the extra signals that source can see, so
|
|
28
|
+
* both are injectable via `ScoreOptions` rather than forked into a second
|
|
29
|
+
* scorer. Everything else — the six penalty terms, the clamp, the bands — is
|
|
30
|
+
* shared verbatim.
|
|
24
31
|
*/
|
|
25
|
-
import type
|
|
32
|
+
import { type TierInfo } from "./tier-map.js";
|
|
33
|
+
import type { TfGraph, TfNode } from "./types.js";
|
|
26
34
|
export type PeelabilityBand = "clean leaf" | "carvable w/ edits" | "leave in Terraform";
|
|
27
35
|
export interface PeelabilityBreakdown {
|
|
28
36
|
/** Inbound edges from resource/module blocks — a data-source patch each. */
|
|
@@ -33,7 +41,12 @@ export interface PeelabilityBreakdown {
|
|
|
33
41
|
tier: 1 | 2 | 3 | null;
|
|
34
42
|
hasDynamic: boolean;
|
|
35
43
|
instances: number;
|
|
36
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Signed penalty contributions, for report transparency. The six shared terms
|
|
46
|
+
* are always present; a source-specific scorer may add its own keys (the CDK
|
|
47
|
+
* advisor's `asset`, say). A reader that sums the values reproduces the score;
|
|
48
|
+
* a reader that only knows the six named terms still reads those correctly.
|
|
49
|
+
*/
|
|
37
50
|
penalties: {
|
|
38
51
|
inbound: number;
|
|
39
52
|
outbound: number;
|
|
@@ -41,8 +54,26 @@ export interface PeelabilityBreakdown {
|
|
|
41
54
|
tier: number;
|
|
42
55
|
dynamic: number;
|
|
43
56
|
instances: number;
|
|
57
|
+
[term: string]: number;
|
|
44
58
|
};
|
|
45
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* One unit of source a scored node stands for, when the node is a fold of
|
|
62
|
+
* several (#1056). A CDK construct emits 1..n CloudFormation resources and
|
|
63
|
+
* ranks once; this names the resources that carve with it. Absent on the
|
|
64
|
+
* Terraform path, where a fold is expressed by the child's absence from the
|
|
65
|
+
* ranking instead.
|
|
66
|
+
*/
|
|
67
|
+
export interface CarveUnitMember {
|
|
68
|
+
/** Identifier within its template/estate — a CFN logical ID. */
|
|
69
|
+
id: string;
|
|
70
|
+
/** Resource type, e.g. `AWS::IAM::Role`. */
|
|
71
|
+
type: string;
|
|
72
|
+
/** The template/stack the member lives in. */
|
|
73
|
+
stack?: string;
|
|
74
|
+
/** The member's own source path, e.g. a CDK construct path. */
|
|
75
|
+
path?: string;
|
|
76
|
+
}
|
|
46
77
|
export interface Peelability {
|
|
47
78
|
address: string;
|
|
48
79
|
kind: "resource" | "module";
|
|
@@ -51,11 +82,46 @@ export interface Peelability {
|
|
|
51
82
|
/** Native spec type a carve would target; undefined for modules/unsupported. */
|
|
52
83
|
mapsTo?: string;
|
|
53
84
|
breakdown: PeelabilityBreakdown;
|
|
85
|
+
/**
|
|
86
|
+
* Source-specific facts about this node that the six penalty terms do not
|
|
87
|
+
* carry — why it was disqualified, what folded into it, what it is. Plain
|
|
88
|
+
* prose, for the report's benefit; nothing keys on it.
|
|
89
|
+
*/
|
|
90
|
+
notes?: string[];
|
|
91
|
+
/** The source units folded into this node (#1056). */
|
|
92
|
+
members?: CarveUnitMember[];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Source-specific scoring input for one node, layered on the shared model.
|
|
96
|
+
* Everything here is optional: with no signals a node scores exactly as the
|
|
97
|
+
* Terraform path scores it.
|
|
98
|
+
*/
|
|
99
|
+
export interface ScoreSignals {
|
|
100
|
+
/** Extra penalty terms, merged into `breakdown.penalties` and the total. */
|
|
101
|
+
penalties?: Record<string, number>;
|
|
102
|
+
notes?: string[];
|
|
103
|
+
members?: CarveUnitMember[];
|
|
104
|
+
/**
|
|
105
|
+
* When set, the node scores 0 and this is the stated reason. For claims the
|
|
106
|
+
* arithmetic cannot express — a CDK assembly synthesized from dummy lookup
|
|
107
|
+
* values is not a faithful picture of anything, so no score it produces is
|
|
108
|
+
* worth reading.
|
|
109
|
+
*/
|
|
110
|
+
disqualified?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface ScoreOptions {
|
|
113
|
+
/**
|
|
114
|
+
* Resource type → native tier. Defaults to the Terraform tier map; the CDK
|
|
115
|
+
* advisor passes a CloudFormation-keyed one. Modules keep the built-in
|
|
116
|
+
* {@link MODULE_TIER} treatment either way.
|
|
117
|
+
*/
|
|
118
|
+
tierOf?: (type: string) => TierInfo | null;
|
|
119
|
+
signalsFor?: (node: TfNode) => ScoreSignals;
|
|
54
120
|
}
|
|
55
121
|
export declare function bandFor(score: number): PeelabilityBand;
|
|
56
122
|
/**
|
|
57
123
|
* Score every carvable node in the estate, ranked most-peelable first. Folded
|
|
58
124
|
* sub-resources are omitted (they carve with their parent, not on their own).
|
|
59
125
|
*/
|
|
60
|
-
export declare function scoreEstate(graph: TfGraph): Peelability[];
|
|
126
|
+
export declare function scoreEstate(graph: TfGraph, opts?: ScoreOptions): Peelability[];
|
|
61
127
|
//# sourceMappingURL=score.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"score.d.ts","sourceRoot":"","sources":["../../src/terraform/score.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"score.d.ts","sourceRoot":"","sources":["../../src/terraform/score.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,EAA6B,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,mBAAmB,GAAG,oBAAoB,CAAC;AAExF,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAA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AAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,GAAG,IAAI,CAAC;IAC3C,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,CAAC;CAC7C;AAUD,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAItD;AAyGD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,GAAE,YAAiB,GAAG,WAAW,EAAE,CAMlF"}
|
|
@@ -1,56 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Terraform-type → native-spec
|
|
2
|
+
* Terraform-type → native-spec ranking for the carve-out advisor (#214 T3),
|
|
3
|
+
* resolved through the carve provider registry (`carve-provider.ts`, #2016).
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
* (`aws-resources.ts`), so the
|
|
6
|
-
* can produce — no advise↔emit
|
|
7
|
-
*
|
|
5
|
+
* Every entry comes from a registered provider: the AWS ones from the single
|
|
6
|
+
* AWS carve-out table (`providers/aws.ts` over `aws-resources.ts`), so the
|
|
7
|
+
* advisor ranks exactly the AWS types `carve emit` can produce — no advise↔emit
|
|
8
|
+
* cliff — and the Kubernetes ones from `providers/kubernetes.ts`, which emits
|
|
9
|
+
* `kubernetes_manifest` and ranks the typed provider resources it does not.
|
|
8
10
|
*
|
|
9
11
|
* tier 1 — a clean 1:1 native resource
|
|
10
12
|
* tier 2 — maps, but with reshaping
|
|
11
13
|
* tier 3 — a hard/partial map
|
|
12
14
|
* null — no known native mapping (unsupported provider/type) → score 0
|
|
13
|
-
*/
|
|
14
|
-
export interface TierInfo {
|
|
15
|
-
tier: 1 | 2 | 3;
|
|
16
|
-
/** The native spec type a carve would target, for the report. */
|
|
17
|
-
mapsTo: string;
|
|
18
|
-
}
|
|
19
|
-
/** TF resource type → native tier. Absent = unsupported (score 0). */
|
|
20
|
-
export declare const TIER_MAP: Record<string, TierInfo>;
|
|
21
|
-
/**
|
|
22
|
-
* TF "sub-resource" types that inline into a parent resource rather than
|
|
23
|
-
* standing alone (TF splits config the native spec keeps in one resource).
|
|
24
|
-
* A sub-resource that shares its parent's name is folded into the parent's
|
|
25
|
-
* carve set: it is not ranked on its own, and its edge to the parent does not
|
|
26
|
-
* count as inbound boundary work — inlining it is free.
|
|
27
15
|
*
|
|
28
|
-
*
|
|
16
|
+
* These are functions, not frozen constants: the registry is open, so a
|
|
17
|
+
* provider registered after module load has to be visible here.
|
|
29
18
|
*/
|
|
30
|
-
|
|
19
|
+
import { type TierInfo } from "./carve-provider.js";
|
|
20
|
+
export { carveEmitTypes, type TierInfo } from "./carve-provider.js";
|
|
21
|
+
/** TF resource type → native tier, over every registered provider. Absent = unsupported (score 0). */
|
|
22
|
+
export declare function tierMap(): Readonly<Record<string, TierInfo>>;
|
|
23
|
+
export declare function resolveTier(tfType: string): TierInfo | null;
|
|
31
24
|
/**
|
|
32
|
-
* The HCL attribute carrying a resource's physical name
|
|
33
|
-
*
|
|
34
|
-
* a path into nested blocks (`manifest.metadata.name`). Used for the graph's
|
|
25
|
+
* The HCL attribute carrying a resource's physical name. A dotted entry is a
|
|
26
|
+
* path into nested blocks (`manifest.metadata.name`). Used for the graph's
|
|
35
27
|
* identity and the live-import hint. Absent → fall back to the TF logical name.
|
|
36
28
|
*/
|
|
37
|
-
export declare
|
|
38
|
-
|
|
29
|
+
export declare function identityAttrOf(tfType: string): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* The parent Terraform type a sub-resource folds into, if any. Terraform splits
|
|
32
|
+
* configuration the native spec keeps in one resource; a sub-resource sharing
|
|
33
|
+
* its parent's name carves with the parent rather than being ranked on its own.
|
|
34
|
+
*/
|
|
35
|
+
export declare function foldParentOf(tfType: string): string | undefined;
|
|
39
36
|
/**
|
|
40
37
|
* Can `chant carve emit` produce chant source for this type? Narrower than
|
|
41
|
-
* `resolveTier`:
|
|
42
|
-
*
|
|
43
|
-
* Both emit paths — `--state` and `--env` — gate on this, so a
|
|
44
|
-
* command refuses is refused by the other with the same message.
|
|
38
|
+
* `resolveTier`: providers also rank types no emit path can adopt (the typed
|
|
39
|
+
* `kubernetes_*` resources, whose manifest only the provider schema knows how
|
|
40
|
+
* to reassemble). Both emit paths — `--state` and `--env` — gate on this, so a
|
|
41
|
+
* type either command refuses is refused by the other with the same message.
|
|
45
42
|
*/
|
|
46
43
|
export declare function canCarveEmit(tfType: string): boolean;
|
|
47
|
-
/** The types `canCarveEmit` accepts, sorted, for user-facing hints. */
|
|
48
|
-
export declare function carveEmitTypes(): string[];
|
|
49
44
|
/**
|
|
50
45
|
* Can `chant carve bridge` render a Terraform `data` source for this type? A
|
|
51
|
-
* dotted
|
|
52
|
-
* is flat `attr = value` — `manifest.metadata.name = "x"` is not valid
|
|
53
|
-
* An absent entry is fine: the bridge writes a TODO comment
|
|
46
|
+
* dotted identity attribute is a path into nested blocks, and a data source
|
|
47
|
+
* body is flat `attr = value` — `manifest.metadata.name = "x"` is not valid
|
|
48
|
+
* HCL. An absent entry is fine: the bridge writes a TODO comment instead.
|
|
54
49
|
*/
|
|
55
50
|
export declare function canBridge(tfType: string): boolean;
|
|
56
51
|
//# sourceMappingURL=tier-map.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tier-map.d.ts","sourceRoot":"","sources":["../../src/terraform/tier-map.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tier-map.d.ts","sourceRoot":"","sources":["../../src/terraform/tier-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAKL,KAAK,QAAQ,EACd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjE,sGAAsG;AACtG,wBAAgB,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAE5D;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE/D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAGjD"}
|
|
@@ -62,6 +62,12 @@ export interface TfEdge {
|
|
|
62
62
|
* parameter. Empty when the reference came from a non-object block shape.
|
|
63
63
|
*/
|
|
64
64
|
via: string[];
|
|
65
|
+
/**
|
|
66
|
+
* The two ends live in different templates — a CloudFormation
|
|
67
|
+
* `Fn::ImportValue` resolved through the exporting stack's `Outputs` (#1056).
|
|
68
|
+
* Never set on the Terraform path, where a single estate is one namespace.
|
|
69
|
+
*/
|
|
70
|
+
crossStack?: boolean;
|
|
65
71
|
}
|
|
66
72
|
export interface TfGraph {
|
|
67
73
|
nodes: TfNode[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/terraform/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,MAAM;IACrB,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC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