@intentius/chant-lexicon-terraform 0.73.0 → 0.74.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/config.d.ts +52 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/hcl/parse.d.ts +10 -0
- package/dist/hcl/parse.d.ts.map +1 -1
- package/dist/integrity.json +3 -2
- package/dist/lint/audit-catalog.d.ts +1 -1
- package/dist/lint/audit-catalog.d.ts.map +1 -1
- package/dist/lint/post-synth/index.d.ts.map +1 -1
- package/dist/lint/post-synth/tf029.d.ts +29 -0
- package/dist/lint/post-synth/tf029.d.ts.map +1 -0
- package/dist/manifest.json +1 -1
- package/dist/okf/index.md +1 -0
- package/dist/okf/rules/TF029.md +11 -0
- package/dist/op/activities/terraform.d.ts.map +1 -1
- package/dist/rules/tf029.ts +85 -0
- package/package.json +1 -1
- package/src/config.ts +26 -0
- package/src/hcl/parse.ts +12 -1
- package/src/hcl/roots.ts +1 -1
- package/src/lint/audit-catalog.ts +14 -1
- package/src/lint/post-synth/fixtures/TF029/declared/main.tf +5 -0
- package/src/lint/post-synth/fixtures/TF029/no-declaration/main.tf +5 -0
- package/src/lint/post-synth/index.ts +2 -0
- package/src/lint/post-synth/tf029.test.ts +72 -0
- package/src/lint/post-synth/tf029.ts +85 -0
- package/src/op/activities/terraform.ts +29 -7
package/dist/config.d.ts
CHANGED
|
@@ -58,6 +58,32 @@ export declare const terraformRootSchema: z.ZodObject<{
|
|
|
58
58
|
varFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
59
59
|
/** `-backend-config` key/value pairs handed to `init`. */
|
|
60
60
|
backendConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
61
|
+
/**
|
|
62
|
+
* The choudoufu estate this root runs against, for a live root whose HCL
|
|
63
|
+
* does not declare one of its own (#2479).
|
|
64
|
+
*
|
|
65
|
+
* This is the environment dimension. A live root has no backend and no
|
|
66
|
+
* state file, so nothing about it is positional: dev, staging and
|
|
67
|
+
* production can be the same directory under different estates, which is
|
|
68
|
+
* why named roots rather than a directory tree are where environments
|
|
69
|
+
* belong here.
|
|
70
|
+
*
|
|
71
|
+
* roots: {
|
|
72
|
+
* "app-staging": { dir: "./terraform", estate: "app-staging", varFiles: ["staging.tfvars"] },
|
|
73
|
+
* "app-prod": { dir: "./terraform", estate: "app-prod", varFiles: ["prod.tfvars"] },
|
|
74
|
+
* }
|
|
75
|
+
*
|
|
76
|
+
* How inputs vary across those environments is `varFiles`, which is
|
|
77
|
+
* already per-root and ordered - the question a directory tree answers
|
|
78
|
+
* with HCL inheritance, answered here by a map entry.
|
|
79
|
+
*
|
|
80
|
+
* Refused (TF028) when the root's own HCL declares an estate in a `live`
|
|
81
|
+
* block or `estate.chdf.hcl` sidecar. choudoufu refuses `-estate` beside a
|
|
82
|
+
* declaration ("This configuration's live block is what names its estate"),
|
|
83
|
+
* and a value here that the declaration then overrode would be a setting
|
|
84
|
+
* written down and silently ignored.
|
|
85
|
+
*/
|
|
86
|
+
estate: z.ZodOptional<z.ZodString>;
|
|
61
87
|
/** This root's declared delete mode. See {@link terraformDeleteModeSchema}. */
|
|
62
88
|
delete: z.ZodOptional<z.ZodEnum<{
|
|
63
89
|
gated: "gated";
|
|
@@ -102,6 +128,32 @@ export declare const terraformConfigSchema: z.ZodObject<{
|
|
|
102
128
|
varFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
103
129
|
/** `-backend-config` key/value pairs handed to `init`. */
|
|
104
130
|
backendConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
131
|
+
/**
|
|
132
|
+
* The choudoufu estate this root runs against, for a live root whose HCL
|
|
133
|
+
* does not declare one of its own (#2479).
|
|
134
|
+
*
|
|
135
|
+
* This is the environment dimension. A live root has no backend and no
|
|
136
|
+
* state file, so nothing about it is positional: dev, staging and
|
|
137
|
+
* production can be the same directory under different estates, which is
|
|
138
|
+
* why named roots rather than a directory tree are where environments
|
|
139
|
+
* belong here.
|
|
140
|
+
*
|
|
141
|
+
* roots: {
|
|
142
|
+
* "app-staging": { dir: "./terraform", estate: "app-staging", varFiles: ["staging.tfvars"] },
|
|
143
|
+
* "app-prod": { dir: "./terraform", estate: "app-prod", varFiles: ["prod.tfvars"] },
|
|
144
|
+
* }
|
|
145
|
+
*
|
|
146
|
+
* How inputs vary across those environments is `varFiles`, which is
|
|
147
|
+
* already per-root and ordered - the question a directory tree answers
|
|
148
|
+
* with HCL inheritance, answered here by a map entry.
|
|
149
|
+
*
|
|
150
|
+
* Refused (TF028) when the root's own HCL declares an estate in a `live`
|
|
151
|
+
* block or `estate.chdf.hcl` sidecar. choudoufu refuses `-estate` beside a
|
|
152
|
+
* declaration ("This configuration's live block is what names its estate"),
|
|
153
|
+
* and a value here that the declaration then overrode would be a setting
|
|
154
|
+
* written down and silently ignored.
|
|
155
|
+
*/
|
|
156
|
+
estate: z.ZodOptional<z.ZodString>;
|
|
105
157
|
/** This root's declared delete mode. See {@link terraformDeleteModeSchema}. */
|
|
106
158
|
delete: z.ZodOptional<z.ZodEnum<{
|
|
107
159
|
gated: "gated";
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB;;;;EAA2C,CAAC;AAClF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB;IAC9B,0FAA0F;;IAE1F,4EAA4E;;IAE5E,0DAA0D;;IAE1D,0D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AAM,wBAAwB,GAAG,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC"}
|
package/dist/hcl/parse.d.ts
CHANGED
|
@@ -169,6 +169,7 @@ export declare const LIVE_SIDECAR_FILENAME = "estate.chdf.hcl";
|
|
|
169
169
|
export declare function terraformEntity(entityType: string, address: string, body: BlockBody, file: string, root: string, extra?: {
|
|
170
170
|
mode?: TerraformRootMode;
|
|
171
171
|
estate?: string;
|
|
172
|
+
configEstate?: string;
|
|
172
173
|
workspace?: string;
|
|
173
174
|
delete?: TerraformDeleteMode;
|
|
174
175
|
callers?: readonly string[];
|
|
@@ -204,6 +205,15 @@ export interface TerraformRootModeOptions {
|
|
|
204
205
|
workspace?: string;
|
|
205
206
|
/** `terraform.roots.<name>.delete`, recorded verbatim regardless of mode (#2106). */
|
|
206
207
|
delete?: TerraformDeleteMode;
|
|
208
|
+
/**
|
|
209
|
+
* `terraform.roots.<name>.estate`, recorded verbatim (#2479), and kept
|
|
210
|
+
* separate from the `estate` prop a declaration produces. The two have
|
|
211
|
+
* different authorities: a declaration is what choudoufu itself reads, and
|
|
212
|
+
* this is what chant would otherwise pass as `-estate`. TF029 exists
|
|
213
|
+
* because a root carrying both has written down a setting that the
|
|
214
|
+
* declaration silently overrides.
|
|
215
|
+
*/
|
|
216
|
+
configEstate?: string;
|
|
207
217
|
}
|
|
208
218
|
/**
|
|
209
219
|
* Parse a set of files into entities keyed `<root>/<address>`. Two blocks that
|
package/dist/hcl/parse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/hcl/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2B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AAU,CAAC,CAAC,CA8GlC;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,QAAQ,EACnB,WAAW,CAAC,EAAE,wBAAwB,EACtC,OAAO,GAAE,SAAS,MAAM,EAAO,GAC9B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAUlC;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,QAAQ,EACnB,WAAW,CAAC,EAAE,wBAAwB,GACrC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAElC;AAED,2EAA2E;AAC3E,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAInD;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED,kGAAkG;AAClG,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAGlD"}
|
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "a8575f4a52f0ba53e22af459b69912dc8677592a3fc8c59d943ce10bb06d41b1",
|
|
5
5
|
"meta.json": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356",
|
|
6
6
|
"types/index.d.ts": "022927e6a7b351cc4cf52d5f973f60ccd140e5810e17b32fb8868965aa1db161",
|
|
7
7
|
"rules/plan-before-apply.ts": "31b1b3176799fd365b2583fe3947edd187c2a863e3dc0094ed9e91ece2464c99",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"rules/tf026.ts": "8cf1e61bc9563aa2d3c149f243ffa02ad4f183eebb672f861cd6c4e6fba1d310",
|
|
36
36
|
"rules/tf027.ts": "0a6062a230cdaa707f82b2353be4b34dff81322d24075d46f732a47bcef15893",
|
|
37
37
|
"rules/tf028.ts": "81ef95659c40ad1774c83e663473ed769143d894a4ba0517c3defa31f00ba723",
|
|
38
|
+
"rules/tf029.ts": "52e02b4921a64f3f928836896b8b80682400adb50bd7a0645f3fe2e8819433c2",
|
|
38
39
|
"skills/chant-terraform.md": "d9ca7b7c28aed0038ce775a3491150298492eed2858fd3651ed9bfca0e577ae8"
|
|
39
40
|
},
|
|
40
|
-
"composite": "
|
|
41
|
+
"composite": "e901f0f4f228bcd78f0f76ad1de1d545f79b7315729b611b4c5290070028b148"
|
|
41
42
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Every post-synth check needs an entry or it contributes nothing to
|
|
5
5
|
* `chant audit`, silently, and `packages/core/src/audit/catalog.test.ts` fails.
|
|
6
6
|
*
|
|
7
|
-
* TF001 and TF024 through
|
|
7
|
+
* TF001 and TF024 through TF029 all read the chant model (`ctx.entities`),
|
|
8
8
|
* never emitted output, so `yamlBased` is false for all of them. Prior-art
|
|
9
9
|
* lineage lives in ./audit-lineage.ts.
|
|
10
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-catalog.d.ts","sourceRoot":"","sources":["../../src/lint/audit-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAe1E,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"audit-catalog.d.ts","sourceRoot":"","sources":["../../src/lint/audit-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAe1E,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CA0S1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AA8BvE,eAAO,MAAM,eAAe,EAAE,cAAc,EA6B3C,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TF029: a live root names its estate twice - once in `terraform.roots.<name>.estate`
|
|
3
|
+
* and once in its own HCL, in a `live { }` block or an `estate.chdf.hcl` sidecar.
|
|
4
|
+
*
|
|
5
|
+
* The two are not equal in authority. A declaration is what choudoufu reads
|
|
6
|
+
* for itself; `terraform.roots.<name>.estate` (#2479) is what this lexicon
|
|
7
|
+
* would otherwise hand it as `-estate`. choudoufu refuses that flag beside a
|
|
8
|
+
* declaration outright - "This configuration's live block is what names its
|
|
9
|
+
* estate, and `-estate=...` would name a second one for this run only"
|
|
10
|
+
* (`internal/command/live_plan.go`) - so this lexicon does not pass it, and
|
|
11
|
+
* the config value is simply not used.
|
|
12
|
+
*
|
|
13
|
+
* That is the whole problem. A setting written down and silently ignored is
|
|
14
|
+
* worse than one that errors: an author who moves an environment by editing
|
|
15
|
+
* `roots.app.estate` gets a run against the old estate and no indication
|
|
16
|
+
* anything was disregarded. Refusing the pair at build time turns a silent
|
|
17
|
+
* wrong-estate run into a message naming both places.
|
|
18
|
+
*
|
|
19
|
+
* The fix is to pick one. A root whose directory is shared across
|
|
20
|
+
* environments should declare no estate in HCL and name it per root here; a
|
|
21
|
+
* root with its own `live` block already has an estate and needs nothing in
|
|
22
|
+
* chant.config.
|
|
23
|
+
*
|
|
24
|
+
* One diagnostic per root, fired from the root's `Terraform::Live` entity -
|
|
25
|
+
* the same entity TF024, TF025 and TF026 fire from.
|
|
26
|
+
*/
|
|
27
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
28
|
+
export declare const tf029: PostSynthCheck;
|
|
29
|
+
//# sourceMappingURL=tf029.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tf029.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf029.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAI1C,eAAO,MAAM,KAAK,EAAE,cAiDnB,CAAC"}
|
package/dist/manifest.json
CHANGED
package/dist/okf/index.md
CHANGED
|
@@ -31,4 +31,5 @@ okf_version: '0.2'
|
|
|
31
31
|
* [TF026](/rules/TF026.md) - Live root declares delete: "never" but its policy leaves undeclared_tagged at "delete"
|
|
32
32
|
* [TF027](/rules/TF027.md) - Live root's policy block sets undeclared_untagged = "delete", which deletes resources chant does not own
|
|
33
33
|
* [TF028](/rules/TF028.md) - A live root is watched by a TerraformWatchOp built without live: true
|
|
34
|
+
* [TF029](/rules/TF029.md) - Live root names its estate both in chant.config and in its own HCL
|
|
34
35
|
* [TF101](/rules/TF101.md) - terraformApply's planFile must reference a preceding terraformPlan step.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: post-synth-check
|
|
3
|
+
title: TF029
|
|
4
|
+
description: Live root names its estate both in chant.config and in its own HCL
|
|
5
|
+
id: TF029
|
|
6
|
+
severity: error
|
|
7
|
+
category: post-synth
|
|
8
|
+
lexicon: terraform
|
|
9
|
+
docs: https://intentius.io/chant/lexicons/terraform/rules/
|
|
10
|
+
---
|
|
11
|
+
Live root names its estate both in chant.config and in its own HCL
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terraform.d.ts","sourceRoot":"","sources":["../../../src/op/activities/terraform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAWrB,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,cAAc,CAAC;AAEpD,gHAAgH;AAChH,eAAO,MAAM,+BAA+B,yBAAyB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAE9C;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,mEACsB,CAAC;AAEnE,mHAAmH;AACnH,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAE9C,wGAAwG;AACxG,eAAO,MAAM,mCAAmC,wDAAwD,CAAC;AAEzG,0GAA0G;AAC1G,eAAO,MAAM,8BAA8B,oDAAoD,CAAC;AAIhG,8EAA8E;AAC9E,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAA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GAAG,SAAS,CAI5F;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,kBAAkB,EACxB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,oBAAoB,CAAC,CAoC/B;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,iBAAiB,EACvB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,mBAAmB,CAAC,CA2B9B;AA6BD;;;;;;;;;;;;;;GAcG;AACH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,qBAAqB,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EACvD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,uBAAuB,CAAC,CA0GlC;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,mBAAmB,EACzB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,qBAAqB,CAAC,CAWhC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,kBAAkB,EACxB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,oBAAoB,CAAC,CA8C/B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,sBAAsB,EAC5B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,wBAAwB,CAAC,CAuBnC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TF029: a live root names its estate twice - once in `terraform.roots.<name>.estate`
|
|
3
|
+
* and once in its own HCL, in a `live { }` block or an `estate.chdf.hcl` sidecar.
|
|
4
|
+
*
|
|
5
|
+
* The two are not equal in authority. A declaration is what choudoufu reads
|
|
6
|
+
* for itself; `terraform.roots.<name>.estate` (#2479) is what this lexicon
|
|
7
|
+
* would otherwise hand it as `-estate`. choudoufu refuses that flag beside a
|
|
8
|
+
* declaration outright - "This configuration's live block is what names its
|
|
9
|
+
* estate, and `-estate=...` would name a second one for this run only"
|
|
10
|
+
* (`internal/command/live_plan.go`) - so this lexicon does not pass it, and
|
|
11
|
+
* the config value is simply not used.
|
|
12
|
+
*
|
|
13
|
+
* That is the whole problem. A setting written down and silently ignored is
|
|
14
|
+
* worse than one that errors: an author who moves an environment by editing
|
|
15
|
+
* `roots.app.estate` gets a run against the old estate and no indication
|
|
16
|
+
* anything was disregarded. Refusing the pair at build time turns a silent
|
|
17
|
+
* wrong-estate run into a message naming both places.
|
|
18
|
+
*
|
|
19
|
+
* The fix is to pick one. A root whose directory is shared across
|
|
20
|
+
* environments should declare no estate in HCL and name it per root here; a
|
|
21
|
+
* root with its own `live` block already has an estate and needs nothing in
|
|
22
|
+
* chant.config.
|
|
23
|
+
*
|
|
24
|
+
* One diagnostic per root, fired from the root's `Terraform::Live` entity -
|
|
25
|
+
* the same entity TF024, TF025 and TF026 fire from.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import type {
|
|
29
|
+
PostSynthCheck,
|
|
30
|
+
PostSynthContext,
|
|
31
|
+
PostSynthDiagnostic,
|
|
32
|
+
} from "@intentius/chant/lint/post-synth";
|
|
33
|
+
import { isResourceDeclarable } from "@intentius/chant/declarable";
|
|
34
|
+
import { LIVE_TYPE } from "../../hcl/parse";
|
|
35
|
+
|
|
36
|
+
export const tf029: PostSynthCheck = {
|
|
37
|
+
id: "TF029",
|
|
38
|
+
description: "Live root names its estate both in chant.config and in its own HCL",
|
|
39
|
+
|
|
40
|
+
check(ctx: PostSynthContext): PostSynthDiagnostic[] {
|
|
41
|
+
const diagnostics: PostSynthDiagnostic[] = [];
|
|
42
|
+
const flagged = new Set<string>();
|
|
43
|
+
|
|
44
|
+
for (const [name, entity] of ctx.entities) {
|
|
45
|
+
if (entity.entityType !== LIVE_TYPE) continue;
|
|
46
|
+
if (!isResourceDeclarable(entity)) continue;
|
|
47
|
+
const props = entity.props as { root?: unknown; estate?: unknown; configEstate?: unknown };
|
|
48
|
+
|
|
49
|
+
// Both halves must be present. A root with only a declaration is the
|
|
50
|
+
// ordinary case; a root with only a config estate is exactly what
|
|
51
|
+
// #2479 added and must stay silent, or the feature would refuse
|
|
52
|
+
// itself.
|
|
53
|
+
const declared = typeof props.estate === "string" ? props.estate : undefined;
|
|
54
|
+
const configured = typeof props.configEstate === "string" ? props.configEstate : undefined;
|
|
55
|
+
if (declared === undefined || configured === undefined) continue;
|
|
56
|
+
|
|
57
|
+
const root = typeof props.root === "string" ? props.root : "";
|
|
58
|
+
if (flagged.has(root)) continue;
|
|
59
|
+
flagged.add(root);
|
|
60
|
+
|
|
61
|
+
// Say both values even when they agree. Two settings that happen to
|
|
62
|
+
// match today still means one of them is doing nothing, and the next
|
|
63
|
+
// edit to the ignored one is the incident this rule exists to prevent.
|
|
64
|
+
const sameNote =
|
|
65
|
+
declared === configured
|
|
66
|
+
? " They name the same estate today, which makes this harmless until one of them is edited - at which point the edit to the config value would be silently ignored."
|
|
67
|
+
: "";
|
|
68
|
+
|
|
69
|
+
diagnostics.push({
|
|
70
|
+
checkId: "TF029",
|
|
71
|
+
severity: "error",
|
|
72
|
+
message:
|
|
73
|
+
`Root "${root}" names its estate twice: terraform.roots.${root}.estate = "${configured}" in chant.config, ` +
|
|
74
|
+
`and "${declared}" in its own HCL. The declaration wins - choudoufu refuses \`-estate\` beside one, so ` +
|
|
75
|
+
`this lexicon never passes the config value and it has no effect.${sameNote} ` +
|
|
76
|
+
`Remove terraform.roots.${root}.estate, or remove the estate from the root's \`live\` block / ` +
|
|
77
|
+
`\`estate.chdf.hcl\` sidecar so the root can be pointed at an estate per environment.`,
|
|
78
|
+
entity: name,
|
|
79
|
+
lexicon: "terraform",
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return diagnostics;
|
|
84
|
+
},
|
|
85
|
+
};
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -57,6 +57,32 @@ export const terraformRootSchema = z.strictObject({
|
|
|
57
57
|
varFiles: z.array(z.string()).optional(),
|
|
58
58
|
/** `-backend-config` key/value pairs handed to `init`. */
|
|
59
59
|
backendConfig: z.record(z.string(), z.string()).optional(),
|
|
60
|
+
/**
|
|
61
|
+
* The choudoufu estate this root runs against, for a live root whose HCL
|
|
62
|
+
* does not declare one of its own (#2479).
|
|
63
|
+
*
|
|
64
|
+
* This is the environment dimension. A live root has no backend and no
|
|
65
|
+
* state file, so nothing about it is positional: dev, staging and
|
|
66
|
+
* production can be the same directory under different estates, which is
|
|
67
|
+
* why named roots rather than a directory tree are where environments
|
|
68
|
+
* belong here.
|
|
69
|
+
*
|
|
70
|
+
* roots: {
|
|
71
|
+
* "app-staging": { dir: "./terraform", estate: "app-staging", varFiles: ["staging.tfvars"] },
|
|
72
|
+
* "app-prod": { dir: "./terraform", estate: "app-prod", varFiles: ["prod.tfvars"] },
|
|
73
|
+
* }
|
|
74
|
+
*
|
|
75
|
+
* How inputs vary across those environments is `varFiles`, which is
|
|
76
|
+
* already per-root and ordered - the question a directory tree answers
|
|
77
|
+
* with HCL inheritance, answered here by a map entry.
|
|
78
|
+
*
|
|
79
|
+
* Refused (TF028) when the root's own HCL declares an estate in a `live`
|
|
80
|
+
* block or `estate.chdf.hcl` sidecar. choudoufu refuses `-estate` beside a
|
|
81
|
+
* declaration ("This configuration's live block is what names its estate"),
|
|
82
|
+
* and a value here that the declaration then overrode would be a setting
|
|
83
|
+
* written down and silently ignored.
|
|
84
|
+
*/
|
|
85
|
+
estate: z.string().optional(),
|
|
60
86
|
/** This root's declared delete mode. See {@link terraformDeleteModeSchema}. */
|
|
61
87
|
delete: terraformDeleteModeSchema.optional(),
|
|
62
88
|
});
|
package/src/hcl/parse.ts
CHANGED
|
@@ -190,7 +190,7 @@ export function terraformEntity(
|
|
|
190
190
|
body: BlockBody,
|
|
191
191
|
file: string,
|
|
192
192
|
root: string,
|
|
193
|
-
extra?: { mode?: TerraformRootMode; estate?: string; workspace?: string; delete?: TerraformDeleteMode; callers?: readonly string[] },
|
|
193
|
+
extra?: { mode?: TerraformRootMode; estate?: string; configEstate?: string; workspace?: string; delete?: TerraformDeleteMode; callers?: readonly string[] },
|
|
194
194
|
source: string = "",
|
|
195
195
|
line?: number,
|
|
196
196
|
suppressions?: readonly SuppressionDirective[],
|
|
@@ -214,6 +214,7 @@ export function terraformEntity(
|
|
|
214
214
|
...(extra?.estate !== undefined ? { estate: extra.estate } : {}),
|
|
215
215
|
...(extra?.workspace !== undefined ? { workspace: extra.workspace } : {}),
|
|
216
216
|
...(extra?.delete !== undefined ? { delete: extra.delete } : {}),
|
|
217
|
+
...(extra?.configEstate !== undefined ? { configEstate: extra.configEstate } : {}),
|
|
217
218
|
...(extra?.callers !== undefined && extra.callers.length > 0 ? { callers: extra.callers } : {}),
|
|
218
219
|
},
|
|
219
220
|
suppressions,
|
|
@@ -303,6 +304,15 @@ export interface TerraformRootModeOptions {
|
|
|
303
304
|
workspace?: string;
|
|
304
305
|
/** `terraform.roots.<name>.delete`, recorded verbatim regardless of mode (#2106). */
|
|
305
306
|
delete?: TerraformDeleteMode;
|
|
307
|
+
/**
|
|
308
|
+
* `terraform.roots.<name>.estate`, recorded verbatim (#2479), and kept
|
|
309
|
+
* separate from the `estate` prop a declaration produces. The two have
|
|
310
|
+
* different authorities: a declaration is what choudoufu itself reads, and
|
|
311
|
+
* this is what chant would otherwise pass as `-estate`. TF029 exists
|
|
312
|
+
* because a root carrying both has written down a setting that the
|
|
313
|
+
* declaration silently overrides.
|
|
314
|
+
*/
|
|
315
|
+
configEstate?: string;
|
|
306
316
|
}
|
|
307
317
|
|
|
308
318
|
/**
|
|
@@ -352,6 +362,7 @@ export async function blocksToEntities(
|
|
|
352
362
|
{
|
|
353
363
|
...(modeOptions?.workspace !== undefined ? { workspace: modeOptions.workspace } : {}),
|
|
354
364
|
...(modeOptions?.delete !== undefined ? { delete: modeOptions.delete } : {}),
|
|
365
|
+
...(modeOptions?.configEstate !== undefined ? { configEstate: modeOptions.configEstate } : {}),
|
|
355
366
|
...(callers.length > 0 ? { callers } : {}),
|
|
356
367
|
},
|
|
357
368
|
file.source,
|
package/src/hcl/roots.ts
CHANGED
|
@@ -86,7 +86,7 @@ export async function renderTerraformRoots(
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
try {
|
|
89
|
-
const modeOptions = { binary: opts.binary, workspace: root.workspace, delete: root.delete };
|
|
89
|
+
const modeOptions = { binary: opts.binary, workspace: root.workspace, delete: root.delete, configEstate: root.estate };
|
|
90
90
|
const parsed = await parseTerraformRootDir(dir, name, opts.hcl2json, modeOptions);
|
|
91
91
|
for (const [key, entity] of parsed) entities.set(key, entity);
|
|
92
92
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Every post-synth check needs an entry or it contributes nothing to
|
|
5
5
|
* `chant audit`, silently, and `packages/core/src/audit/catalog.test.ts` fails.
|
|
6
6
|
*
|
|
7
|
-
* TF001 and TF024 through
|
|
7
|
+
* TF001 and TF024 through TF029 all read the chant model (`ctx.entities`),
|
|
8
8
|
* never emitted output, so `yamlBased` is false for all of them. Prior-art
|
|
9
9
|
* lineage lives in ./audit-lineage.ts.
|
|
10
10
|
*/
|
|
@@ -93,6 +93,19 @@ export const terraformAuditCatalog: Record<string, RuleMeta> = {
|
|
|
93
93
|
"estate instead if it is not a live root.",
|
|
94
94
|
yamlBased: false,
|
|
95
95
|
},
|
|
96
|
+
TF029: {
|
|
97
|
+
id: "TF029",
|
|
98
|
+
tier: "merge-worthy",
|
|
99
|
+
fixKind: "guidance",
|
|
100
|
+
category: "correctness",
|
|
101
|
+
title: "Live root names its estate both in chant.config and in its own HCL",
|
|
102
|
+
remediation:
|
|
103
|
+
"Pick one. A root whose directory is shared across environments declares no estate in HCL and " +
|
|
104
|
+
"names it per root with terraform.roots.<name>.estate; a root with its own live block already " +
|
|
105
|
+
"has an estate and needs nothing in chant.config. The declaration wins today, so the config " +
|
|
106
|
+
"value is written down and never used.",
|
|
107
|
+
yamlBased: false,
|
|
108
|
+
},
|
|
96
109
|
TF002: {
|
|
97
110
|
id: "TF002",
|
|
98
111
|
tier: "merge-worthy",
|
|
@@ -27,6 +27,7 @@ import { tf025 } from "./tf025";
|
|
|
27
27
|
import { tf026 } from "./tf026";
|
|
28
28
|
import { tf027 } from "./tf027";
|
|
29
29
|
import { tf028 } from "./tf028";
|
|
30
|
+
import { tf029 } from "./tf029";
|
|
30
31
|
|
|
31
32
|
export const postSynthChecks: PostSynthCheck[] = [
|
|
32
33
|
tf001,
|
|
@@ -56,4 +57,5 @@ export const postSynthChecks: PostSynthCheck[] = [
|
|
|
56
57
|
tf026,
|
|
57
58
|
tf027,
|
|
58
59
|
tf028,
|
|
60
|
+
tf029,
|
|
59
61
|
];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { dirname, join } from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
import type { PostSynthContext } from "@intentius/chant/lint/post-synth";
|
|
5
|
+
import { tf029 } from "./tf029";
|
|
6
|
+
import { LIVE_TYPE, parseTerraformRootDir } from "../../hcl/parse";
|
|
7
|
+
|
|
8
|
+
const fixtures = join(dirname(fileURLToPath(import.meta.url)), "fixtures", "TF029");
|
|
9
|
+
|
|
10
|
+
async function ctxFor(
|
|
11
|
+
fixture: string,
|
|
12
|
+
opts: { binary?: string; configEstate?: string } = {},
|
|
13
|
+
root = "estate",
|
|
14
|
+
): Promise<PostSynthContext> {
|
|
15
|
+
const entities = await parseTerraformRootDir(join(fixtures, fixture), root, undefined, {
|
|
16
|
+
binary: opts.binary ?? "choudoufu",
|
|
17
|
+
...(opts.configEstate !== undefined ? { configEstate: opts.configEstate } : {}),
|
|
18
|
+
});
|
|
19
|
+
return { outputs: new Map(), entities } as unknown as PostSynthContext;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe("TF029: an estate named twice", () => {
|
|
23
|
+
test("fires when the root declares an estate in HCL and chant.config names another", async () => {
|
|
24
|
+
const diags = tf029.check(await ctxFor("declared", { configEstate: "named-in-config" }));
|
|
25
|
+
expect(diags).toHaveLength(1);
|
|
26
|
+
expect(diags[0].checkId).toBe("TF029");
|
|
27
|
+
// Both values, so a reader can see which one is being ignored without
|
|
28
|
+
// opening two files.
|
|
29
|
+
expect(diags[0].message).toContain("named-in-config");
|
|
30
|
+
expect(diags[0].message).toContain("declared-in-hcl");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("fires even when the two agree, and says why that is still worth fixing", async () => {
|
|
34
|
+
const diags = tf029.check(await ctxFor("declared", { configEstate: "declared-in-hcl" }));
|
|
35
|
+
expect(diags).toHaveLength(1);
|
|
36
|
+
expect(diags[0].message).toContain("same estate today");
|
|
37
|
+
expect(diags[0].message).toContain("silently ignored");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// #2479's whole feature is a root that names its estate in chant.config
|
|
41
|
+
// instead of in HCL, so a rule that fired on that would refuse the thing it
|
|
42
|
+
// shipped alongside.
|
|
43
|
+
//
|
|
44
|
+
// Stated precisely, because the obvious version of this test proves
|
|
45
|
+
// nothing: a root with no `live` block produces no Terraform::Live entity
|
|
46
|
+
// at all, so TF029's loop never reaches it and the assertion below would
|
|
47
|
+
// pass against any implementation, including one with no guard. The
|
|
48
|
+
// absence is asserted directly for that reason, and the guard itself is
|
|
49
|
+
// proven by "stays silent on a stock root" above, which DOES produce a
|
|
50
|
+
// Live entity and does fail when the guard is removed.
|
|
51
|
+
test("a root that names its estate ONLY in chant.config has no Live entity to fire on", async () => {
|
|
52
|
+
const ctx = await ctxFor("no-declaration", { configEstate: "app-staging" });
|
|
53
|
+
const live = [...ctx.entities.values()].filter((e) => e.entityType === LIVE_TYPE);
|
|
54
|
+
expect(live, "the fixture must declare no estate, or this test proves nothing").toHaveLength(0);
|
|
55
|
+
expect(tf029.check(ctx)).toHaveLength(0);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("stays silent on an ordinary root that declares its estate only in HCL", async () => {
|
|
59
|
+
const diags = tf029.check(await ctxFor("declared"));
|
|
60
|
+
expect(diags).toHaveLength(0);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("stays silent on a stock root, which has no estate either way", async () => {
|
|
64
|
+
const diags = tf029.check(await ctxFor("declared", { binary: "tofu", configEstate: "app-staging" }));
|
|
65
|
+
expect(diags).toHaveLength(0);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("reports a root once rather than once per entity in it", async () => {
|
|
69
|
+
const diags = tf029.check(await ctxFor("declared", { configEstate: "named-in-config" }));
|
|
70
|
+
expect(diags).toHaveLength(1);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TF029: a live root names its estate twice - once in `terraform.roots.<name>.estate`
|
|
3
|
+
* and once in its own HCL, in a `live { }` block or an `estate.chdf.hcl` sidecar.
|
|
4
|
+
*
|
|
5
|
+
* The two are not equal in authority. A declaration is what choudoufu reads
|
|
6
|
+
* for itself; `terraform.roots.<name>.estate` (#2479) is what this lexicon
|
|
7
|
+
* would otherwise hand it as `-estate`. choudoufu refuses that flag beside a
|
|
8
|
+
* declaration outright - "This configuration's live block is what names its
|
|
9
|
+
* estate, and `-estate=...` would name a second one for this run only"
|
|
10
|
+
* (`internal/command/live_plan.go`) - so this lexicon does not pass it, and
|
|
11
|
+
* the config value is simply not used.
|
|
12
|
+
*
|
|
13
|
+
* That is the whole problem. A setting written down and silently ignored is
|
|
14
|
+
* worse than one that errors: an author who moves an environment by editing
|
|
15
|
+
* `roots.app.estate` gets a run against the old estate and no indication
|
|
16
|
+
* anything was disregarded. Refusing the pair at build time turns a silent
|
|
17
|
+
* wrong-estate run into a message naming both places.
|
|
18
|
+
*
|
|
19
|
+
* The fix is to pick one. A root whose directory is shared across
|
|
20
|
+
* environments should declare no estate in HCL and name it per root here; a
|
|
21
|
+
* root with its own `live` block already has an estate and needs nothing in
|
|
22
|
+
* chant.config.
|
|
23
|
+
*
|
|
24
|
+
* One diagnostic per root, fired from the root's `Terraform::Live` entity -
|
|
25
|
+
* the same entity TF024, TF025 and TF026 fire from.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import type {
|
|
29
|
+
PostSynthCheck,
|
|
30
|
+
PostSynthContext,
|
|
31
|
+
PostSynthDiagnostic,
|
|
32
|
+
} from "@intentius/chant/lint/post-synth";
|
|
33
|
+
import { isResourceDeclarable } from "@intentius/chant/declarable";
|
|
34
|
+
import { LIVE_TYPE } from "../../hcl/parse";
|
|
35
|
+
|
|
36
|
+
export const tf029: PostSynthCheck = {
|
|
37
|
+
id: "TF029",
|
|
38
|
+
description: "Live root names its estate both in chant.config and in its own HCL",
|
|
39
|
+
|
|
40
|
+
check(ctx: PostSynthContext): PostSynthDiagnostic[] {
|
|
41
|
+
const diagnostics: PostSynthDiagnostic[] = [];
|
|
42
|
+
const flagged = new Set<string>();
|
|
43
|
+
|
|
44
|
+
for (const [name, entity] of ctx.entities) {
|
|
45
|
+
if (entity.entityType !== LIVE_TYPE) continue;
|
|
46
|
+
if (!isResourceDeclarable(entity)) continue;
|
|
47
|
+
const props = entity.props as { root?: unknown; estate?: unknown; configEstate?: unknown };
|
|
48
|
+
|
|
49
|
+
// Both halves must be present. A root with only a declaration is the
|
|
50
|
+
// ordinary case; a root with only a config estate is exactly what
|
|
51
|
+
// #2479 added and must stay silent, or the feature would refuse
|
|
52
|
+
// itself.
|
|
53
|
+
const declared = typeof props.estate === "string" ? props.estate : undefined;
|
|
54
|
+
const configured = typeof props.configEstate === "string" ? props.configEstate : undefined;
|
|
55
|
+
if (declared === undefined || configured === undefined) continue;
|
|
56
|
+
|
|
57
|
+
const root = typeof props.root === "string" ? props.root : "";
|
|
58
|
+
if (flagged.has(root)) continue;
|
|
59
|
+
flagged.add(root);
|
|
60
|
+
|
|
61
|
+
// Say both values even when they agree. Two settings that happen to
|
|
62
|
+
// match today still means one of them is doing nothing, and the next
|
|
63
|
+
// edit to the ignored one is the incident this rule exists to prevent.
|
|
64
|
+
const sameNote =
|
|
65
|
+
declared === configured
|
|
66
|
+
? " They name the same estate today, which makes this harmless until one of them is edited - at which point the edit to the config value would be silently ignored."
|
|
67
|
+
: "";
|
|
68
|
+
|
|
69
|
+
diagnostics.push({
|
|
70
|
+
checkId: "TF029",
|
|
71
|
+
severity: "error",
|
|
72
|
+
message:
|
|
73
|
+
`Root "${root}" names its estate twice: terraform.roots.${root}.estate = "${configured}" in chant.config, ` +
|
|
74
|
+
`and "${declared}" in its own HCL. The declaration wins - choudoufu refuses \`-estate\` beside one, so ` +
|
|
75
|
+
`this lexicon never passes the config value and it has no effect.${sameNote} ` +
|
|
76
|
+
`Remove terraform.roots.${root}.estate, or remove the estate from the root's \`live\` block / ` +
|
|
77
|
+
`\`estate.chdf.hcl\` sidecar so the root can be pointed at an estate per environment.`,
|
|
78
|
+
entity: name,
|
|
79
|
+
lexicon: "terraform",
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return diagnostics;
|
|
84
|
+
},
|
|
85
|
+
};
|
|
@@ -851,7 +851,19 @@ async function resolveRoot(args: TerraformRootArgs, signal?: AbortSignal): Promi
|
|
|
851
851
|
const dir = resolve(projectRoot, root.dir);
|
|
852
852
|
await ensureChoudoufuVersion(binary, signal);
|
|
853
853
|
const estate = binary === "choudoufu" ? detectLiveEstate(dir) : undefined;
|
|
854
|
-
|
|
854
|
+
// `estate` stays what it has always been: the estate the root's own HCL
|
|
855
|
+
// declares, which is what decides whether `-estate` may be passed at all.
|
|
856
|
+
// `live` is the broader question, and a root that names its estate in
|
|
857
|
+
// chant.config rather than in HCL (#2479) is just as live - that is the
|
|
858
|
+
// `-estate` flag form, choudoufu's own supported second pipeline.
|
|
859
|
+
const configEstate = binary === "choudoufu" ? root.estate : undefined;
|
|
860
|
+
return {
|
|
861
|
+
binary,
|
|
862
|
+
root,
|
|
863
|
+
dir,
|
|
864
|
+
...(estate !== undefined ? { estate } : {}),
|
|
865
|
+
live: estate !== undefined || configEstate !== undefined,
|
|
866
|
+
};
|
|
855
867
|
}
|
|
856
868
|
|
|
857
869
|
/** The shape `promisify(exec)` rejects with: an Error carrying the child's exit code and output. */
|
|
@@ -1098,17 +1110,27 @@ export async function terraformShow(
|
|
|
1098
1110
|
}
|
|
1099
1111
|
|
|
1100
1112
|
/**
|
|
1101
|
-
* The estate a choudoufu-only activity runs against
|
|
1102
|
-
*
|
|
1103
|
-
*
|
|
1104
|
-
*
|
|
1113
|
+
* The estate a choudoufu-only activity runs against, in precedence order:
|
|
1114
|
+
* `args.estate` when the step names one, then the root's own `estate`
|
|
1115
|
+
* (#2479), then the one {@link resolveRoot} auto-detected from the root's
|
|
1116
|
+
* `live` block or `estate.chdf.hcl` sidecar. Throws when none of the three
|
|
1117
|
+
* names one, since `live-plan`/`live-ls` need an estate to filter on, unlike
|
|
1118
|
+
* a stock command.
|
|
1119
|
+
*
|
|
1120
|
+
* The order is step, then root, then declaration - narrowest first. A root's
|
|
1121
|
+
* `estate` and a declared one cannot both be in play on a healthy project:
|
|
1122
|
+
* TF028 refuses that pair at build time, for the same reason choudoufu
|
|
1123
|
+
* refuses `-estate` beside a `live` block. The precedence here is what
|
|
1124
|
+
* happens if that refusal is ever bypassed, and it deliberately lets the
|
|
1125
|
+
* declaration win, because the declaration is the thing choudoufu itself
|
|
1126
|
+
* will act on.
|
|
1105
1127
|
*/
|
|
1106
1128
|
function resolveEstate(args: { estate?: string }, resolved: ResolvedRoot, activity: string): string {
|
|
1107
|
-
const estate = args.estate ?? resolved.estate;
|
|
1129
|
+
const estate = args.estate ?? resolved.estate ?? resolved.root.estate;
|
|
1108
1130
|
if (!estate) {
|
|
1109
1131
|
throw new Error(
|
|
1110
1132
|
`${activity}: no estate to run against. Declare one in the root's \`live\` block or ` +
|
|
1111
|
-
"`estate.chdf.hcl` sidecar, or pass `estate` explicitly.",
|
|
1133
|
+
"`estate.chdf.hcl` sidecar, give the root an `estate` in chant.config, or pass `estate` explicitly.",
|
|
1112
1134
|
);
|
|
1113
1135
|
}
|
|
1114
1136
|
return estate;
|