@intentius/chant-lexicon-terraform 0.124.31 → 0.124.32
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/__fixtures__/terragrunt/affected-cases.js +111 -0
- package/dist/__fixtures__/terragrunt/record.js +57 -0
- package/dist/behaviour/index.js +6 -0
- package/dist/behaviour/kinds.js +194 -0
- package/dist/behaviour/predict.js +297 -0
- package/dist/behaviour/reference-catalog.js +178 -0
- package/dist/behaviour/request.js +482 -0
- package/dist/change-set.js +234 -0
- package/dist/changed-roots.js +97 -0
- package/dist/codegen/docs-cli.js +3 -0
- package/dist/codegen/docs.js +44 -0
- package/dist/codegen/generate-cli.js +9 -0
- package/dist/codegen/generate.js +59 -0
- package/dist/codegen/package.js +43 -0
- package/dist/commands.js +106 -0
- package/dist/components/capability-plugin.d.ts +38 -2
- package/dist/components/capability-plugin.d.ts.map +1 -1
- package/dist/components/capability-plugin.js +260 -0
- package/dist/composites/terraform-adopt-op.js +152 -0
- package/dist/composites/terraform-apply-op.js +183 -0
- package/dist/composites/terraform-pin-rollout-op.js +45 -0
- package/dist/composites/terraform-watch-op.js +219 -0
- package/dist/config.js +118 -0
- package/dist/describe-resources.js +984 -0
- package/dist/generated/index.js +1 -0
- package/dist/hcl/descend.js +208 -0
- package/dist/hcl/edges.js +287 -0
- package/dist/hcl/jsonencode.js +442 -0
- package/dist/hcl/marker.js +212 -0
- package/dist/hcl/parse.js +372 -0
- package/dist/hcl/references.js +156 -0
- package/dist/hcl/roots.js +98 -0
- package/dist/hcl/suppressions.js +189 -0
- package/dist/hcl/value.js +72 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -0
- package/dist/integrity.json +2 -2
- package/dist/lint/audit-catalog.js +501 -0
- package/dist/lint/audit-lineage.js +442 -0
- package/dist/lint/post-synth/blocks.js +87 -0
- package/dist/lint/post-synth/fixtures/load.js +94 -0
- package/dist/lint/post-synth/flat-attributes.js +135 -0
- package/dist/lint/post-synth/index.js +90 -0
- package/dist/lint/post-synth/module-source.js +153 -0
- package/dist/lint/post-synth/scope.js +104 -0
- package/dist/lint/post-synth/terragrunt.js +63 -0
- package/dist/lint/post-synth/tf001.js +138 -0
- package/dist/lint/post-synth/tf002.js +143 -0
- package/dist/lint/post-synth/tf003.js +60 -0
- package/dist/lint/post-synth/tf004.js +54 -0
- package/dist/lint/post-synth/tf005.js +68 -0
- package/dist/lint/post-synth/tf006.js +43 -0
- package/dist/lint/post-synth/tf007.js +66 -0
- package/dist/lint/post-synth/tf008.js +64 -0
- package/dist/lint/post-synth/tf009.js +49 -0
- package/dist/lint/post-synth/tf010.js +40 -0
- package/dist/lint/post-synth/tf011.js +38 -0
- package/dist/lint/post-synth/tf012.js +36 -0
- package/dist/lint/post-synth/tf013.js +53 -0
- package/dist/lint/post-synth/tf014.js +61 -0
- package/dist/lint/post-synth/tf015.js +62 -0
- package/dist/lint/post-synth/tf016.js +66 -0
- package/dist/lint/post-synth/tf017.js +39 -0
- package/dist/lint/post-synth/tf018.js +63 -0
- package/dist/lint/post-synth/tf019.js +60 -0
- package/dist/lint/post-synth/tf020.js +103 -0
- package/dist/lint/post-synth/tf021.js +117 -0
- package/dist/lint/post-synth/tf022.js +51 -0
- package/dist/lint/post-synth/tf024.js +62 -0
- package/dist/lint/post-synth/tf025.js +83 -0
- package/dist/lint/post-synth/tf026.js +74 -0
- package/dist/lint/post-synth/tf027.js +66 -0
- package/dist/lint/post-synth/tf028.js +83 -0
- package/dist/lint/post-synth/tf029.js +73 -0
- package/dist/lint/post-synth/tf030.js +253 -0
- package/dist/lint/post-synth/tf031.js +332 -0
- package/dist/lint/post-synth/tf032.js +201 -0
- package/dist/lint/post-synth/tf033.js +126 -0
- package/dist/lint/post-synth/tf034.js +45 -0
- package/dist/lint/post-synth/tf035.js +63 -0
- package/dist/lint/post-synth/tf036.js +97 -0
- package/dist/lint/post-synth/tf037.js +80 -0
- package/dist/lint/post-synth/tf038.js +63 -0
- package/dist/lint/post-synth/tf039.js +55 -0
- package/dist/lint/post-synth/tf040.js +67 -0
- package/dist/lint/post-synth/tf041.js +53 -0
- package/dist/lint/post-synth/tf042.js +38 -0
- package/dist/lint/post-synth/tf043.js +45 -0
- package/dist/lint/post-synth/tf044.js +45 -0
- package/dist/lint/post-synth/tf045.js +44 -0
- package/dist/lint/rules/fixtures/load.js +50 -0
- package/dist/lint/rules/index.js +4 -0
- package/dist/lint/rules/plan-before-apply.js +136 -0
- package/dist/lint/secret-shape.js +149 -0
- package/dist/live-ownership.js +57 -0
- package/dist/lsp/completions.js +95 -0
- package/dist/lsp/context.js +358 -0
- package/dist/lsp/hover.js +45 -0
- package/dist/lsp/option-keys.js +93 -0
- package/dist/manifest.json +1 -1
- package/dist/op/activities/index.js +30 -0
- package/dist/op/activities/live-detect.js +143 -0
- package/dist/op/activities/pin-rollout.js +45 -0
- package/dist/op/activities/terraform.js +1270 -0
- package/dist/op/activity-contracts.js +162 -0
- package/dist/op/adoption.js +272 -0
- package/dist/op/builders.js +125 -0
- package/dist/op/resolve-root-mode.js +77 -0
- package/dist/package-cli.js +16 -0
- package/dist/pin/edit-ts.js +76 -0
- package/dist/pin/edit.js +118 -0
- package/dist/pin/forge.js +65 -0
- package/dist/pin/index.js +16 -0
- package/dist/pin/rollout.d.ts.map +1 -1
- package/dist/pin/rollout.js +382 -0
- package/dist/pin/scan.js +287 -0
- package/dist/pin/source.js +171 -0
- package/dist/pin/waves.js +109 -0
- package/dist/plan-digest.js +67 -0
- package/dist/plugin.js +323 -0
- package/dist/serializer.js +23 -0
- package/dist/state-ownership.js +29 -0
- package/dist/terragrunt/affected.d.ts.map +1 -1
- package/dist/terragrunt/affected.js +290 -0
- package/dist/terragrunt/index.js +10 -0
- package/dist/terragrunt/mocks.js +270 -0
- package/dist/terragrunt/run.js +264 -0
- package/dist/terragrunt/units.js +195 -0
- package/dist/terragrunt/wave.js +125 -0
- package/dist/validate-cli.js +4 -0
- package/dist/validate.js +31 -0
- package/package.json +10 -10
- package/src/codegen/package.ts +2 -2
- package/src/components/capability-plugin.test.ts +97 -2
- package/src/components/capability-plugin.ts +117 -12
- package/src/components/pr-loop.tofu.test.ts +51 -11
- package/src/index.ts +1 -0
- package/src/pin/rollout.ts +2 -1
- package/src/terragrunt/affected.test.ts +11 -0
- package/src/terragrunt/affected.ts +2 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read `# chant-ignore*` comments out of raw `.tf` text.
|
|
3
|
+
*
|
|
4
|
+
* `hcl2json` drops comments entirely, and a probe of its output confirmed it
|
|
5
|
+
* exposes no source ranges either, so a suppression comment has nothing to
|
|
6
|
+
* attach to once a file goes through `@cdktn/hcl2json`. This module runs a
|
|
7
|
+
* second, cheap pass over the SAME raw text `./parse.ts` hands the parser,
|
|
8
|
+
* entirely with line-oriented regexes: a brace-depth counter to find each
|
|
9
|
+
* top-level block's start line (`terraform`, `locals`, `provider "x"`,
|
|
10
|
+
* `module "x"`, `variable "x"`, `output "x"`, `resource "t" "n"`,
|
|
11
|
+
* `data "t" "n"`, the exact set `blocksToEntities` turns into entities, and
|
|
12
|
+
* the address format below MUST stay in sync with that function's `add()`
|
|
13
|
+
* calls), and a directive regex for the three comment forms.
|
|
14
|
+
*
|
|
15
|
+
* `scanSuppressions` returns per-file lookups keyed by ADDRESS (`./parse.ts`'s
|
|
16
|
+
* `TerraformEntity.props.address`, e.g. `provider.aws`, `aws_s3_bucket.assets`)
|
|
17
|
+
* rather than by entity, because `blocksToEntities` computes an entity's final
|
|
18
|
+
* map key (with a `~2`/`~3` collision suffix) only after this scan has already
|
|
19
|
+
* run. A FIFO queue per address reconciles the two traversal orders: this
|
|
20
|
+
* scan reads the file top to bottom, but `blocksToEntities` walks hcl2json's
|
|
21
|
+
* tree grouped by section (all `variable` blocks together, then all
|
|
22
|
+
* `resource` blocks, etc.), not in source order. Two blocks that share one
|
|
23
|
+
* address (the same genuinely-duplicated declaration) are matched to their
|
|
24
|
+
* queue slot in file order, same as they're numbered `~2`/`~3` in file order.
|
|
25
|
+
*/
|
|
26
|
+
/** A block header keyword with zero labels (`terraform {`, `locals {`). */
|
|
27
|
+
const BARE_RE = /^\s*(terraform|locals|remote_state)\s*\{/;
|
|
28
|
+
/** One label (`provider "aws" {`, `module "vpc" {`, `variable "x" {`, `output "x" {`). */
|
|
29
|
+
const ONE_LABEL_RE = /^\s*(provider|module|variable|output|dependency|generate)\s+"([^"]*)"\s*\{/;
|
|
30
|
+
/** Two labels (`resource "aws_s3_bucket" "assets" {`, `data "aws_ami" "x" {`). */
|
|
31
|
+
const TWO_LABEL_RE = /^\s*(resource|data)\s+"([^"]*)"\s+"([^"]*)"\s*\{/;
|
|
32
|
+
/** A `#`/`//` comment naming one of the three suppression forms. */
|
|
33
|
+
const DIRECTIVE_RE = /^\s*(?:#|\/\/)\s*chant-ignore(-file|-block)?\s*:?\s*(.*)$/;
|
|
34
|
+
/** `./parse.ts`'s own address format per block kind, kept in sync by hand. */
|
|
35
|
+
function addressFor(keyword, labels) {
|
|
36
|
+
switch (keyword) {
|
|
37
|
+
case "terraform":
|
|
38
|
+
return "terraform";
|
|
39
|
+
case "locals":
|
|
40
|
+
return "locals";
|
|
41
|
+
case "remote_state":
|
|
42
|
+
return "remote_state";
|
|
43
|
+
case "dependency":
|
|
44
|
+
return `dependency.${labels[0]}`;
|
|
45
|
+
case "generate":
|
|
46
|
+
return `generate.${labels[0]}`;
|
|
47
|
+
case "provider":
|
|
48
|
+
return `provider.${labels[0]}`;
|
|
49
|
+
case "module":
|
|
50
|
+
return `module.${labels[0]}`;
|
|
51
|
+
case "variable":
|
|
52
|
+
return `var.${labels[0]}`;
|
|
53
|
+
case "output":
|
|
54
|
+
return `output.${labels[0]}`;
|
|
55
|
+
case "resource":
|
|
56
|
+
return `${labels[0]}.${labels[1]}`;
|
|
57
|
+
case "data":
|
|
58
|
+
return `data.${labels[0]}.${labels[1]}`;
|
|
59
|
+
default:
|
|
60
|
+
return "";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** Strip quoted string contents so a brace inside a literal (a jsonencode payload) doesn't skew depth tracking. */
|
|
64
|
+
function stripStrings(line) {
|
|
65
|
+
return line.replace(/"(?:[^"\\]|\\.)*"/g, '""');
|
|
66
|
+
}
|
|
67
|
+
function braceDelta(line) {
|
|
68
|
+
const stripped = stripStrings(line);
|
|
69
|
+
let delta = 0;
|
|
70
|
+
for (const ch of stripped) {
|
|
71
|
+
if (ch === "{")
|
|
72
|
+
delta++;
|
|
73
|
+
else if (ch === "}")
|
|
74
|
+
delta--;
|
|
75
|
+
}
|
|
76
|
+
return delta;
|
|
77
|
+
}
|
|
78
|
+
function parseDirectiveBody(rest) {
|
|
79
|
+
const tokens = rest.split(/\s+/).filter(Boolean);
|
|
80
|
+
let expires;
|
|
81
|
+
const idTokens = [];
|
|
82
|
+
for (const tok of tokens) {
|
|
83
|
+
const m = /^exp:(\d{4}-\d{2}-\d{2})$/.exec(tok);
|
|
84
|
+
if (m) {
|
|
85
|
+
expires = m[1];
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
idTokens.push(tok);
|
|
89
|
+
}
|
|
90
|
+
const joined = idTokens.join(" ").trim();
|
|
91
|
+
if (joined === "" || joined.toLowerCase() === "all")
|
|
92
|
+
return { ids: "all", expires };
|
|
93
|
+
const ids = new Set(joined
|
|
94
|
+
.split(/[,\s]+/)
|
|
95
|
+
.map((s) => s.trim().toUpperCase())
|
|
96
|
+
.filter(Boolean));
|
|
97
|
+
return { ids, expires };
|
|
98
|
+
}
|
|
99
|
+
function recordBlockLine(queues, address, lineNo) {
|
|
100
|
+
const q = queues.get(address) ?? [];
|
|
101
|
+
q.push(lineNo);
|
|
102
|
+
queues.set(address, q);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Scan one `.tf` file's raw text. `fileName` only labels the directives it
|
|
106
|
+
* returns (for messages and dedup); the scan itself is pure text.
|
|
107
|
+
*/
|
|
108
|
+
export function scanSuppressions(fileName, source) {
|
|
109
|
+
const lines = source.split("\n");
|
|
110
|
+
const blockLineQueues = new Map();
|
|
111
|
+
const byAnchorLine = new Map();
|
|
112
|
+
let fileDirective;
|
|
113
|
+
let firstNonBlankLine;
|
|
114
|
+
let depth = 0;
|
|
115
|
+
for (let i = 0; i < lines.length; i++) {
|
|
116
|
+
const line = lines[i];
|
|
117
|
+
const lineNo = i + 1;
|
|
118
|
+
const trimmed = line.trim();
|
|
119
|
+
if (firstNonBlankLine === undefined && trimmed !== "")
|
|
120
|
+
firstNonBlankLine = lineNo;
|
|
121
|
+
const directiveMatch = DIRECTIVE_RE.exec(line);
|
|
122
|
+
if (directiveMatch) {
|
|
123
|
+
const suffix = directiveMatch[1];
|
|
124
|
+
const { ids, expires } = parseDirectiveBody(directiveMatch[2].trim());
|
|
125
|
+
if (suffix === "-file") {
|
|
126
|
+
fileDirective = {
|
|
127
|
+
form: "chant-ignore-file",
|
|
128
|
+
ids,
|
|
129
|
+
expires,
|
|
130
|
+
file: fileName,
|
|
131
|
+
line: lineNo,
|
|
132
|
+
misplaced: lineNo !== firstNonBlankLine,
|
|
133
|
+
key: `${fileName}:${lineNo}:chant-ignore-file`,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const form = suffix === "-block" ? "chant-ignore-block" : "chant-ignore";
|
|
138
|
+
const directive = {
|
|
139
|
+
form,
|
|
140
|
+
ids,
|
|
141
|
+
expires,
|
|
142
|
+
file: fileName,
|
|
143
|
+
line: lineNo,
|
|
144
|
+
key: `${fileName}:${lineNo}:${form}`,
|
|
145
|
+
};
|
|
146
|
+
const anchorLine = lineNo + 1;
|
|
147
|
+
const list = byAnchorLine.get(anchorLine) ?? [];
|
|
148
|
+
list.push(directive);
|
|
149
|
+
byAnchorLine.set(anchorLine, list);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else if (depth === 0) {
|
|
153
|
+
// Only look for a block header on a line that isn't itself a directive
|
|
154
|
+
// comment, and only at top-level nesting (depth 0 before this line).
|
|
155
|
+
let m = BARE_RE.exec(line);
|
|
156
|
+
if (m) {
|
|
157
|
+
recordBlockLine(blockLineQueues, addressFor(m[1], []), lineNo);
|
|
158
|
+
}
|
|
159
|
+
else if ((m = ONE_LABEL_RE.exec(line))) {
|
|
160
|
+
recordBlockLine(blockLineQueues, addressFor(m[1], [m[2]]), lineNo);
|
|
161
|
+
}
|
|
162
|
+
else if ((m = TWO_LABEL_RE.exec(line))) {
|
|
163
|
+
recordBlockLine(blockLineQueues, addressFor(m[1], [m[2], m[3]]), lineNo);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
depth += braceDelta(line);
|
|
167
|
+
}
|
|
168
|
+
return { blockLineQueues, byAnchorLine, fileDirective };
|
|
169
|
+
}
|
|
170
|
+
/** Pop the next recorded start line for `address` (FIFO; see module doc). */
|
|
171
|
+
export function popBlockLine(scan, address) {
|
|
172
|
+
const q = scan.blockLineQueues.get(address);
|
|
173
|
+
if (!q || q.length === 0)
|
|
174
|
+
return undefined;
|
|
175
|
+
return q.shift();
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Directives to attach to the entity being added for `address`: the ones
|
|
179
|
+
* anchored to its own start line (`chant-ignore`/`chant-ignore-block`), plus
|
|
180
|
+
* the file-level one, if any. Every entity in a file carries a file-level
|
|
181
|
+
* directive, misplaced or not (misplaced ones report themselves but suppress
|
|
182
|
+
* nothing; see `applyInlineSuppressions`).
|
|
183
|
+
*/
|
|
184
|
+
export function directivesFor(scan, address) {
|
|
185
|
+
const line = popBlockLine(scan, address);
|
|
186
|
+
const anchored = line !== undefined ? (scan.byAnchorLine.get(line) ?? []) : [];
|
|
187
|
+
const all = scan.fileDirective ? [...anchored, scan.fileDirective] : anchored;
|
|
188
|
+
return { line, suppressions: all.length > 0 ? all : undefined };
|
|
189
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A value envelope over a parsed block body (chant #2113).
|
|
3
|
+
*
|
|
4
|
+
* Every TF post-synth check reads `BlockBody` (`./parse.ts`), raw
|
|
5
|
+
* `@cdktn/hcl2json` output, and re-derives, by hand, whether an attribute is
|
|
6
|
+
* a plain literal, a reference/expression, or absent. tflint's OPA ruleset
|
|
7
|
+
* hands a policy `{value, unknown, sensitive, ephemeral, range}` per
|
|
8
|
+
* attribute so a check reads that uniformly instead of re-deriving it
|
|
9
|
+
* (`tflint-ruleset-opa`'s `docs/functions.md`, cited in the #2107 survey).
|
|
10
|
+
* `attr()` is the equivalent for chant's static string-based body.
|
|
11
|
+
*
|
|
12
|
+
* The shape here is narrower than tflint's for one structural reason.
|
|
13
|
+
* hcl2json converts HCL to plain JSON with no evaluation and no position
|
|
14
|
+
* data. There is no live Terraform graph behind this parse, so there is no
|
|
15
|
+
* `unknown` (this runs over source, not a plan), and no `sensitive`/
|
|
16
|
+
* `ephemeral` flag (those live on a `variable` block's own attributes, not on
|
|
17
|
+
* every attribute that happens to reference one; a check that cares reads
|
|
18
|
+
* the referenced variable's declaration itself). `range` is the one field
|
|
19
|
+
* tflint's envelope carries that this cannot. hcl2json's own output is bare
|
|
20
|
+
* values, JSON-round-tripped from HCL, with no line/column/byte-range
|
|
21
|
+
* attached anywhere in the tree, so there is nothing for `attr()` to read a
|
|
22
|
+
* position from. (#2111 adds a `props.line` to the *entity*, from a separate
|
|
23
|
+
* text-based mechanism this file does not touch and is not a substitute for
|
|
24
|
+
* per-attribute ranges. See that issue for how it gets a line at all.)
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Every `${...}` span within a string, in source order. One level of nested
|
|
28
|
+
* `{...}` is tolerated (an object constructor or a map-typed function argument
|
|
29
|
+
* inside the interpolation), which is as far as a regex can go without
|
|
30
|
+
* becoming a brace-counting parser. `attr()` below decides `"reference"` vs
|
|
31
|
+
* `"template"` from how many spans this finds and whether the one span (if
|
|
32
|
+
* there is exactly one) consumes the whole string, not from a second,
|
|
33
|
+
* separately-anchored pattern, so the two checks can't disagree about what
|
|
34
|
+
* counts as an interpolation.
|
|
35
|
+
*/
|
|
36
|
+
const INTERPOLATION_SPANS = /\$\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g;
|
|
37
|
+
/**
|
|
38
|
+
* Read one attribute of a parsed block body as a value envelope.
|
|
39
|
+
*
|
|
40
|
+
* - `"absent"`: `name` is not a key of `body` at all (or is `undefined`/`null`).
|
|
41
|
+
* - `"reference"`: the value is a string that is nothing but one
|
|
42
|
+
* `${...}` interpolation (`"${aws_s3_bucket.foo.id}"`, `"${var.x}"`,
|
|
43
|
+
* `"${lower(var.x)}"`; a function call counts, since the whole value is
|
|
44
|
+
* still one expression, not a literal). `refs` carries that one expression.
|
|
45
|
+
* - `"template"`: the value is a string with `${...}` interpolation mixed
|
|
46
|
+
* with literal text (`"prefix-${var.x}-suffix"`, or two interpolations in
|
|
47
|
+
* one string). `refs` carries every span found, in source order.
|
|
48
|
+
* - `"literal"`: anything else. A plain string with no interpolation, a
|
|
49
|
+
* number, a boolean, an array, or an object (which is how hcl2json encodes
|
|
50
|
+
* a nested block under the same key a caller might ask `attr()` about, so
|
|
51
|
+
* a nested block reads as `kind: "literal"` with `value` holding its body
|
|
52
|
+
* or bodies array). See `hasBlock()` in `../lint/post-synth/tf001.ts`,
|
|
53
|
+
* which is exactly that case.
|
|
54
|
+
*
|
|
55
|
+
* A malformed `${` with no matching `}` is not specially detected; it falls
|
|
56
|
+
* through to `"literal"` (no complete span found), matching hcl2json's own
|
|
57
|
+
* behavior of passing such text through as a plain string.
|
|
58
|
+
*/
|
|
59
|
+
export function attr(body, name) {
|
|
60
|
+
const raw = body[name];
|
|
61
|
+
if (raw === undefined || raw === null)
|
|
62
|
+
return { kind: "absent", raw };
|
|
63
|
+
if (typeof raw === "string") {
|
|
64
|
+
const spans = [...raw.matchAll(INTERPOLATION_SPANS)];
|
|
65
|
+
if (spans.length === 0)
|
|
66
|
+
return { kind: "literal", value: raw, raw };
|
|
67
|
+
const refs = spans.map((m) => m[1].trim());
|
|
68
|
+
const isWholeString = spans.length === 1 && spans[0].index === 0 && spans[0][0].length === raw.length;
|
|
69
|
+
return isWholeString ? { kind: "reference", refs, raw } : { kind: "template", refs, raw };
|
|
70
|
+
}
|
|
71
|
+
return { kind: "literal", value: raw, raw };
|
|
72
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { terraformPlugin } from "./plugin.js";
|
|
2
|
-
export { terraformCapabilityPlugin, terraformApplyCapability, TERRAFORM_VERB_FAMILIES, type TerraformApplyStepInput, type TerraformApplyStepOutput, } from "./components/capability-plugin.js";
|
|
2
|
+
export { terraformCapabilityPlugin, terraformApplyCapability, TerraformPlanMovedError, TERRAFORM_VERB_FAMILIES, type TerraformApplyStepInput, type TerraformApplyStepOutput, } from "./components/capability-plugin.js";
|
|
3
3
|
export { terraformSerializer } from "./serializer.js";
|
|
4
4
|
export { terraformConfigSchema, terraformRootSchema, type TerraformConfig, type TerraformRootConfig, type TerraformConfigNamespace, } from "./config.js";
|
|
5
5
|
export { blocksToEntities, parseTerraformRootContent, parseTerraformRootDir, readLiveSidecarFile, splitBundleContent, terraformEntity, DATA_TYPE, LIVE_SIDECAR_FILENAME, LIVE_TYPE, LOCALS_TYPE, MODULE_TYPE, OUTPUT_TYPE, PROVIDER_TYPE, RESOURCE_TYPE, TERRAFORM_TYPE, VARIABLE_TYPE, type BlockBody, type TerraformEntity, type TerraformFile, type TerraformRootMode, type TerraformRootModeOptions, } from "./hcl/parse.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM3C,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,KAA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
3
|
+
// The `terraform-apply` component verb (#3049), contributed to core's
|
|
4
|
+
// capability-plugin seam. Core loads `terraformCapabilityPlugin` when a
|
|
5
|
+
// project's chant.config lists this lexicon, so a component can deploy a root
|
|
6
|
+
// and a fan-out can run many of them in gated waves.
|
|
7
|
+
export { terraformCapabilityPlugin, terraformApplyCapability, TerraformPlanMovedError, TERRAFORM_VERB_FAMILIES, } from "./components/capability-plugin.js";
|
|
8
|
+
// Serializer
|
|
9
|
+
export { terraformSerializer } from "./serializer.js";
|
|
10
|
+
// The `terraform` config namespace. Importing this package is what brings the
|
|
11
|
+
// `terraform` key into `ChantConfig` (#1344), so the augmentation must be
|
|
12
|
+
// reachable from the entry point.
|
|
13
|
+
export { terraformConfigSchema, terraformRootSchema, } from "./config.js";
|
|
14
|
+
// HCL parse: one entity per block, shared by the build path and (from #2085)
|
|
15
|
+
// the audit path.
|
|
16
|
+
export { blocksToEntities, parseTerraformRootContent, parseTerraformRootDir, readLiveSidecarFile, splitBundleContent, terraformEntity, DATA_TYPE, LIVE_SIDECAR_FILENAME, LIVE_TYPE, LOCALS_TYPE, MODULE_TYPE, OUTPUT_TYPE, PROVIDER_TYPE, RESOURCE_TYPE, TERRAFORM_TYPE, VARIABLE_TYPE, } from "./hcl/parse.js";
|
|
17
|
+
export { renderTerraformRoots } from "./hcl/roots.js";
|
|
18
|
+
// Typed Op step builders (#2086). Same names as the activities they wrap, and
|
|
19
|
+
// like k3s's they are opt-in from the lexicon root — the activities themselves
|
|
20
|
+
// are reached by the registry through `./op/activities`, never from here.
|
|
21
|
+
export { terraformInit, terraformPlan, terraformApply, terraformShow, choudoufuLivePlan, choudoufuLiveLs, choudoufuLiveCheck, choudoufuAdopt, terraformPinRollout, } from "./op/builders.js";
|
|
22
|
+
// The adoption ledger over `live-plan -json`'s document (#2105). Pure, and
|
|
23
|
+
// exported because the ledger's shape is what a project reading an Op's own
|
|
24
|
+
// result is reading.
|
|
25
|
+
export { parseAdoptionCommands, readAdoptionLedger, renderAdoptionLedger, } from "./op/adoption.js";
|
|
26
|
+
// The Init/Plan/Gate/Apply composite (#2086).
|
|
27
|
+
export { TerraformApplyOp } from "./composites/terraform-apply-op.js";
|
|
28
|
+
// The Init/Plan/[Report] drift composite (#2087).
|
|
29
|
+
export { TerraformWatchOp } from "./composites/terraform-watch-op.js";
|
|
30
|
+
// The Check/Ledger/Gate/Adopt composite (#2105): reconcile for a choudoufu
|
|
31
|
+
// estate, and #2089's answer for this backend.
|
|
32
|
+
export { TerraformAdoptOp } from "./composites/terraform-adopt-op.js";
|
|
33
|
+
// One pin-bump PR per wave (#3189). The pin edit, wave plan and rollout run
|
|
34
|
+
// are in the `@intentius/chant-lexicon-terraform/pin` subpath.
|
|
35
|
+
export { TerraformPinRolloutOp } from "./composites/terraform-pin-rollout-op.js";
|
|
36
|
+
// Live observation over `terraform show -json` (#2087). The plugin reaches
|
|
37
|
+
// `describeResources` through a dynamic import; the ownership keys are here
|
|
38
|
+
// because `ownershipChannel` declares them eagerly.
|
|
39
|
+
export { TERRAFORM_STATE_OWNERSHIP_KEYS } from "./state-ownership.js";
|
|
40
|
+
// The behaviour engine's request from a terraform estate (#2360): the live
|
|
41
|
+
// path for a choudoufu root, reading `live-ls -json` and `live-plan -json`
|
|
42
|
+
// through the same activities `describeResources` runs, and the same producer
|
|
43
|
+
// over the declaration so the two sides of the delta are built alike. The
|
|
44
|
+
// engine is injected, and defaults to core's front (#2495): this lexicon
|
|
45
|
+
// dials none.
|
|
46
|
+
export { predictTerraformBehaviour, terraformBehaviourRequest, terraformPredictOptionsFrom, TERRAFORM_REFERENCE_CATALOG, } from "./behaviour/index.js";
|
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "a5897bba742d07d4ca58b354e2b739e0e2a56675d23771a5f9abc3e1aaa3dd64",
|
|
5
5
|
"meta.json": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356",
|
|
6
6
|
"types/index.d.ts": "022927e6a7b351cc4cf52d5f973f60ccd140e5810e17b32fb8868965aa1db161",
|
|
7
7
|
"rules/plan-before-apply.ts": "7c10245b2c3335253b48ee7d8b075d89f43116bde20313a5d1031b343fef1282",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"rules/tf045.ts": "760b1f4f385fbe7a86897efe3078fdeac11bcc9bfb806285d63db50488174b7b",
|
|
57
57
|
"skills/chant-terraform.md": "d9ca7b7c28aed0038ce775a3491150298492eed2858fd3651ed9bfca0e577ae8"
|
|
58
58
|
},
|
|
59
|
-
"composite": "
|
|
59
|
+
"composite": "50dacdccb0421ca5ba3994072257c04477565eab99be70a7bf7b82add19786ff"
|
|
60
60
|
}
|