@intentius/chant-lexicon-terraform 0.124.55 → 0.124.57

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.
@@ -1 +1 @@
1
- {"version":3,"file":"capability-plugin.d.ts","sourceRoot":"","sources":["../../src/components/capability-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4HG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAiC,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExH,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACzG,OAAO,KAAK,EAAmB,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AA0BlI,OAAO,EAA0D,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGjH,0CAA0C;AAC1C,MAAM,WAAW,uBAAuB;IACtC,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,gFAAgF;IAChF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+HAA+H;IAC/H,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yGAAyG;IACzG,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC7B,qFAAqF;IACrF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gHAAgH;IAChH,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AAED,6FAA6F;AAC7F,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,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AAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,oBAAoB,CAEhI;AAID;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,kBAInC,CAAC;AA4BF,4GAA4G;AAC5G,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAEzD,iHAAiH;AACjH,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,IAAI,EAAE,uBAAuB,CAAC;CAC/B;AAsFD;;;;;;;GAOG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;aAEpB,IAAI,EAAE,MAAM;IADxC,QAAQ,CAAC,SAAS,QAAQ;IAC1B,YAA4B,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAGxD;CACF;AA6DD,eAAO,MAAM,wBAAwB,EAAE,UAAU,CAAC,uBAAuB,EAAE,wBAAwB,CAwHlG,CAAC;AAEF,eAAO,MAAM,uBAAuB;aAClC,KAAK,YAAG,iBAAiB;aAEzB,KAAK,YAAG,wBAAwB,EAAE,sBAAsB;aACxD,IAAI,YAAG,gBAAgB;CACf,CAAC;AAEX,eAAO,MAAM,yBAAyB,EAAE,gBAcvC,CAAC"}
@@ -134,6 +134,7 @@ import { terraformPlanMoved } from "../exit-codes.js";
134
134
  import { terraformPlanShape } from "../plan-shape.js";
135
135
  import { plannerForBinary, terraformChangeSetPart } from "../change-set.js";
136
136
  import { terraformDefaultLockGrain, terraformLockGrainRefusal, terraformLockRows, terraformLockRowsFromPart } from "../lock-rows.js";
137
+ import { rootRowKey } from "@intentius/chant/lifecycle/lock-rows";
137
138
  import { rootTexts } from "../compose/hcl.js";
138
139
  import { declaredVariables } from "../compose/root.js";
139
140
  import { terraformComposeGroup } from "./compose-group.js";
@@ -462,6 +463,13 @@ export const terraformApplyCapability = {
462
463
  rollbackPolicy: "needs-opt-out",
463
464
  // #4300: `--target` passes through as `-target`, and the saved plan holds those addresses alone.
464
465
  targets: "accept",
466
+ // #4627: `plan` refreshes the root's state before it plans unless told `-refresh=false`, which chant never passes,
467
+ // so `--refresh` asks for what every plan does and the digest still binds it. `-target` plans a resource with what it
468
+ // depends on and never what depends on it, so `--target-dependents` has nothing to map onto.
469
+ planFlags: {
470
+ refresh: "accept",
471
+ targetDependents: { refuse: "terraform and tofu plan a -target with what it depends on, never what depends on it, so there is no flag to widen it to its dependents; name each dependent with --target" },
472
+ },
465
473
  async plan(ctx, given) {
466
474
  requireRoot(given);
467
475
  // #4545: a root reading an upstream's output that is not there yet is a hole naming the upstream.
@@ -523,6 +531,11 @@ export const terraformApplyCapability = {
523
531
  const binary = (await rootDir(input).catch(() => undefined))?.binary;
524
532
  return terraformLockGrainRefusal(grain, await plannerOf(input, plan), binary);
525
533
  },
534
+ // The ruling for ci-products (2026-10-28): a Terraform, tofu or Terragrunt root waits for its root row on the ledger in place of
535
+ // the backend's lock. A choudoufu root stays on the resource grain and never asks for this row.
536
+ targetLockRow(input) {
537
+ return typeof input?.root === "string" && input.root !== "" ? { key: rootRowKey(input.root), target: input.root, address: input.root } : undefined;
538
+ },
526
539
  lockRows(input, plan) {
527
540
  const kept = plan.artifact?.lockRows;
528
541
  if (Array.isArray(kept))
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "af9cf95e7eeffef70272429ce0affe71750ff95b7413c9cedb6f6e7fffb8a7d3",
4
+ "manifest.json": "fd96faaa2af8305a7195930eb1df376fa5a0ffe710227048d672d31630c5c344",
5
5
  "meta.json": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356",
6
6
  "types/index.d.ts": "022927e6a7b351cc4cf52d5f973f60ccd140e5810e17b32fb8868965aa1db161",
7
7
  "rules/plan-before-apply.ts": "7c10245b2c3335253b48ee7d8b075d89f43116bde20313a5d1031b343fef1282",
@@ -59,5 +59,5 @@
59
59
  "rules/tf047.ts": "bfa86f85c4c5efff297280fc2f15104d6319fa96dfc444a31829fb7353224092",
60
60
  "skills/chant-terraform.md": "53dd11c7b289652f92fdaf2c03766abda46d8964e31fe709e8b142ced4f19c50"
61
61
  },
62
- "composite": "2eb9399e124a118b190f5c350cf23b746058b7b97ed3ef4a3e63e9ac59c9be8b"
62
+ "composite": "da933455020d701804e48e82031f7a8cc1479bc7985240575245eef3216c34c4"
63
63
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terraform",
3
- "version": "0.124.55",
3
+ "version": "0.124.57",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "Terraform"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-terraform",
3
- "version": "0.124.55",
3
+ "version": "0.124.57",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/",
@@ -88,7 +88,7 @@
88
88
  "access": "public"
89
89
  },
90
90
  "peerDependencies": {
91
- "@intentius/chant": "^0.124.55",
91
+ "@intentius/chant": "^0.124.57",
92
92
  "zod": "^4.3.6"
93
93
  },
94
94
  "description": "terraform lexicon for chant, existing Terraform root modules as declarable entities",
@@ -153,7 +153,7 @@ import { terraformPlanMoved } from "../exit-codes";
153
153
  import { terraformPlanShape } from "../plan-shape";
154
154
  import { plannerForBinary, terraformChangeSetPart } from "../change-set";
155
155
  import { terraformDefaultLockGrain, terraformLockGrainRefusal, terraformLockRows, terraformLockRowsFromPart } from "../lock-rows";
156
- import type { LockRow } from "@intentius/chant/lifecycle/lock-rows";
156
+ import { rootRowKey, type LockRow } from "@intentius/chant/lifecycle/lock-rows";
157
157
  import type { TerraformConfig } from "../config";
158
158
  import { rootTexts } from "../compose/hcl";
159
159
  import { declaredVariables } from "../compose/root";
@@ -544,6 +544,13 @@ export const terraformApplyCapability: Capability<TerraformApplyStepInput, Terra
544
544
  rollbackPolicy: "needs-opt-out",
545
545
  // #4300: `--target` passes through as `-target`, and the saved plan holds those addresses alone.
546
546
  targets: "accept",
547
+ // #4627: `plan` refreshes the root's state before it plans unless told `-refresh=false`, which chant never passes,
548
+ // so `--refresh` asks for what every plan does and the digest still binds it. `-target` plans a resource with what it
549
+ // depends on and never what depends on it, so `--target-dependents` has nothing to map onto.
550
+ planFlags: {
551
+ refresh: "accept",
552
+ targetDependents: { refuse: "terraform and tofu plan a -target with what it depends on, never what depends on it, so there is no flag to widen it to its dependents; name each dependent with --target" },
553
+ },
547
554
  async plan(ctx: DeployContext, given: TerraformApplyStepInput): Promise<CapabilityPlan> {
548
555
  requireRoot(given);
549
556
  // #4545: a root reading an upstream's output that is not there yet is a hole naming the upstream.
@@ -603,6 +610,11 @@ export const terraformApplyCapability: Capability<TerraformApplyStepInput, Terra
603
610
  const binary = (await rootDir(input).catch(() => undefined))?.binary;
604
611
  return terraformLockGrainRefusal(grain, await plannerOf(input, plan), binary);
605
612
  },
613
+ // The ruling for ci-products (2026-10-28): a Terraform, tofu or Terragrunt root waits for its root row on the ledger in place of
614
+ // the backend's lock. A choudoufu root stays on the resource grain and never asks for this row.
615
+ targetLockRow(input) {
616
+ return typeof input?.root === "string" && input.root !== "" ? { key: rootRowKey(input.root), target: input.root, address: input.root } : undefined;
617
+ },
606
618
  lockRows(input, plan) {
607
619
  const kept = (plan.artifact as { lockRows?: LockRow[] } | undefined)?.lockRows;
608
620
  if (Array.isArray(kept)) return kept;
@@ -6,6 +6,7 @@
6
6
  import { describe, expect, test } from "vitest";
7
7
  import type { ChangeSetPart } from "@intentius/chant/change-set";
8
8
  import { terraformDefaultLockGrain, terraformLockGrainRefusal, terraformLockRows, terraformLockRowsFromPart } from "./lock-rows";
9
+ import { terraformApplyCapability } from "./components/capability-plugin";
9
10
 
10
11
  const plan = {
11
12
  resource_changes: [
@@ -68,3 +69,10 @@ describe("the grain", () => {
68
69
  expect(terraformLockGrainRefusal("repo", "tofu")).toBeUndefined();
69
70
  });
70
71
  });
72
+
73
+ describe("the ledger lock (ruling for ci-products 2026-10-28)", () => {
74
+ test("a root's target row is `root <root>`, which a Terraform, tofu or Terragrunt apply waits for", async () => {
75
+ expect(await terraformApplyCapability.targetLockRow!({ root: "stacks/net" } as never)).toEqual({ key: "root stacks/net", target: "stacks/net", address: "stacks/net" });
76
+ expect(await terraformApplyCapability.targetLockRow!({ root: "" } as never)).toBeUndefined();
77
+ });
78
+ });