@intentius/chant-lexicon-terraform 0.124.98 → 0.124.99

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.
Files changed (1312) hide show
  1. package/dist/__fixtures__/capabilities/chant.config.d.ts +0 -1
  2. package/dist/__fixtures__/effective-topology/chant.config.d.ts +0 -1
  3. package/dist/__fixtures__/kind-type/chant.config.d.ts +0 -1
  4. package/dist/__fixtures__/pr-loop/estate.component.d.ts +0 -1
  5. package/dist/__fixtures__/report/generate.d.ts +0 -1
  6. package/dist/__fixtures__/search-roots/chant.config.d.ts +0 -1
  7. package/dist/__fixtures__/sensitive-default/chant.config.d.ts +0 -1
  8. package/dist/__fixtures__/terragrunt/affected-cases.d.ts +0 -1
  9. package/dist/__fixtures__/terragrunt/record.d.ts +0 -1
  10. package/dist/action-ops.d.ts +0 -1
  11. package/dist/applied-state.d.ts +0 -1
  12. package/dist/backend-config.d.ts +0 -1
  13. package/dist/behaviour/index.d.ts +0 -1
  14. package/dist/behaviour/kinds.d.ts +0 -1
  15. package/dist/behaviour/predict.d.ts +0 -1
  16. package/dist/behaviour/reference-catalog.d.ts +0 -1
  17. package/dist/behaviour/request.d.ts +0 -1
  18. package/dist/capabilities/adapter.d.ts +0 -1
  19. package/dist/capabilities/mapping.json +164 -164
  20. package/dist/change-set.d.ts +0 -1
  21. package/dist/changed-roots.d.ts +0 -1
  22. package/dist/chant-floors.d.ts +0 -1
  23. package/dist/ci-setup.d.ts +0 -1
  24. package/dist/codegen/docs-cli.d.ts +0 -1
  25. package/dist/codegen/docs.d.ts +0 -1
  26. package/dist/codegen/generate-cli.d.ts +0 -1
  27. package/dist/codegen/generate.d.ts +0 -1
  28. package/dist/codegen/package.d.ts +0 -1
  29. package/dist/commands.d.ts +0 -1
  30. package/dist/components/capability-plugin.d.ts +0 -1
  31. package/dist/components/compose-group.d.ts +0 -1
  32. package/dist/components/placeholder-preview.d.ts +0 -1
  33. package/dist/components/release-inputs.d.ts +0 -1
  34. package/dist/components/trace-facts.d.ts +0 -1
  35. package/dist/compose/apply-events.d.ts +0 -1
  36. package/dist/compose/estate.d.ts +0 -1
  37. package/dist/compose/hcl.d.ts +0 -1
  38. package/dist/compose/module-address.d.ts +0 -1
  39. package/dist/compose/root.d.ts +0 -1
  40. package/dist/compose/run.d.ts +0 -1
  41. package/dist/compose/slice.d.ts +0 -1
  42. package/dist/compose/state-address.d.ts +0 -1
  43. package/dist/compose/state-merge.d.ts +0 -1
  44. package/dist/compose.d.ts +0 -1
  45. package/dist/composites/terraform-adopt-op.d.ts +0 -1
  46. package/dist/composites/terraform-apply-op.d.ts +0 -1
  47. package/dist/composites/terraform-pin-rollout-op.d.ts +0 -1
  48. package/dist/composites/terraform-watch-op.d.ts +0 -1
  49. package/dist/cone.d.ts +0 -1
  50. package/dist/config.d.ts +0 -1
  51. package/dist/cost-hold.d.ts +0 -1
  52. package/dist/describe-resources.d.ts +0 -1
  53. package/dist/drift-read.d.ts +0 -1
  54. package/dist/drift-record.d.ts +0 -1
  55. package/dist/drift-rows.d.ts +0 -1
  56. package/dist/engine-runner.d.ts +0 -1
  57. package/dist/engine-timings.d.ts +0 -1
  58. package/dist/estate-migration.d.ts +0 -1
  59. package/dist/exit-codes.d.ts +0 -1
  60. package/dist/generated/index.d.ts +0 -1
  61. package/dist/hcl/descend.d.ts +0 -1
  62. package/dist/hcl/edges.d.ts +0 -1
  63. package/dist/hcl/evaluate.d.ts +0 -1
  64. package/dist/hcl/files.d.ts +0 -1
  65. package/dist/hcl/instances.d.ts +0 -1
  66. package/dist/hcl/jsonencode.d.ts +0 -1
  67. package/dist/hcl/marker.d.ts +0 -1
  68. package/dist/hcl/parse.d.ts +0 -1
  69. package/dist/hcl/redact.d.ts +0 -1
  70. package/dist/hcl/references.d.ts +0 -1
  71. package/dist/hcl/roots.d.ts +0 -1
  72. package/dist/hcl/suppressions.d.ts +0 -1
  73. package/dist/hcl/value.d.ts +0 -1
  74. package/dist/index.d.ts +0 -1
  75. package/dist/init-turn.d.ts +0 -1
  76. package/dist/integrity.json +2 -2
  77. package/dist/lint/audit-catalog.d.ts +0 -1
  78. package/dist/lint/audit-lineage.d.ts +0 -1
  79. package/dist/lint/post-synth/blocks.d.ts +0 -1
  80. package/dist/lint/post-synth/fixtures/load.d.ts +0 -1
  81. package/dist/lint/post-synth/flat-attributes.d.ts +0 -1
  82. package/dist/lint/post-synth/index.d.ts +0 -1
  83. package/dist/lint/post-synth/module-source.d.ts +0 -1
  84. package/dist/lint/post-synth/record-store.d.ts +0 -1
  85. package/dist/lint/post-synth/scope.d.ts +0 -1
  86. package/dist/lint/post-synth/terragrunt.d.ts +0 -1
  87. package/dist/lint/post-synth/tf001.d.ts +0 -1
  88. package/dist/lint/post-synth/tf002.d.ts +0 -1
  89. package/dist/lint/post-synth/tf003.d.ts +0 -1
  90. package/dist/lint/post-synth/tf004.d.ts +0 -1
  91. package/dist/lint/post-synth/tf005.d.ts +0 -1
  92. package/dist/lint/post-synth/tf006.d.ts +0 -1
  93. package/dist/lint/post-synth/tf007.d.ts +0 -1
  94. package/dist/lint/post-synth/tf008.d.ts +0 -1
  95. package/dist/lint/post-synth/tf009.d.ts +0 -1
  96. package/dist/lint/post-synth/tf010.d.ts +0 -1
  97. package/dist/lint/post-synth/tf011.d.ts +0 -1
  98. package/dist/lint/post-synth/tf012.d.ts +0 -1
  99. package/dist/lint/post-synth/tf013.d.ts +0 -1
  100. package/dist/lint/post-synth/tf014.d.ts +0 -1
  101. package/dist/lint/post-synth/tf015.d.ts +0 -1
  102. package/dist/lint/post-synth/tf016.d.ts +0 -1
  103. package/dist/lint/post-synth/tf017.d.ts +0 -1
  104. package/dist/lint/post-synth/tf018.d.ts +0 -1
  105. package/dist/lint/post-synth/tf019.d.ts +0 -1
  106. package/dist/lint/post-synth/tf020.d.ts +0 -1
  107. package/dist/lint/post-synth/tf021.d.ts +0 -1
  108. package/dist/lint/post-synth/tf022.d.ts +0 -1
  109. package/dist/lint/post-synth/tf024.d.ts +0 -1
  110. package/dist/lint/post-synth/tf025.d.ts +0 -1
  111. package/dist/lint/post-synth/tf026.d.ts +0 -1
  112. package/dist/lint/post-synth/tf027.d.ts +0 -1
  113. package/dist/lint/post-synth/tf028.d.ts +0 -1
  114. package/dist/lint/post-synth/tf029.d.ts +0 -1
  115. package/dist/lint/post-synth/tf030.d.ts +0 -1
  116. package/dist/lint/post-synth/tf031.d.ts +0 -1
  117. package/dist/lint/post-synth/tf032.d.ts +0 -1
  118. package/dist/lint/post-synth/tf033.d.ts +0 -1
  119. package/dist/lint/post-synth/tf034.d.ts +0 -1
  120. package/dist/lint/post-synth/tf035.d.ts +0 -1
  121. package/dist/lint/post-synth/tf036.d.ts +0 -1
  122. package/dist/lint/post-synth/tf037.d.ts +0 -1
  123. package/dist/lint/post-synth/tf038.d.ts +0 -1
  124. package/dist/lint/post-synth/tf039.d.ts +0 -1
  125. package/dist/lint/post-synth/tf040.d.ts +0 -1
  126. package/dist/lint/post-synth/tf041.d.ts +0 -1
  127. package/dist/lint/post-synth/tf042.d.ts +0 -1
  128. package/dist/lint/post-synth/tf043.d.ts +0 -1
  129. package/dist/lint/post-synth/tf044.d.ts +0 -1
  130. package/dist/lint/post-synth/tf045.d.ts +0 -1
  131. package/dist/lint/post-synth/tf046.d.ts +0 -1
  132. package/dist/lint/post-synth/tf047.d.ts +0 -1
  133. package/dist/lint/rules/fixtures/load.d.ts +0 -1
  134. package/dist/lint/rules/index.d.ts +0 -1
  135. package/dist/lint/rules/plan-before-apply.d.ts +0 -1
  136. package/dist/lint/secret-shape.d.ts +0 -1
  137. package/dist/live-ownership.d.ts +0 -1
  138. package/dist/live-plan-reasons.d.ts +0 -1
  139. package/dist/live-roots.d.ts +0 -1
  140. package/dist/lock-rows.d.ts +0 -1
  141. package/dist/lock-timeout.d.ts +0 -1
  142. package/dist/lsp/completions.d.ts +0 -1
  143. package/dist/lsp/context.d.ts +0 -1
  144. package/dist/lsp/hover.d.ts +0 -1
  145. package/dist/lsp/option-keys.d.ts +0 -1
  146. package/dist/manifest.json +1 -1
  147. package/dist/migration-history.d.ts +0 -1
  148. package/dist/module-catalog/index.d.ts +0 -1
  149. package/dist/module-catalog/refresh-cli.d.ts +0 -1
  150. package/dist/module-catalog/static-tier.d.ts +0 -1
  151. package/dist/module-catalog/types.d.ts +0 -1
  152. package/dist/op/activities/index.d.ts +0 -1
  153. package/dist/op/activities/live-detect.d.ts +0 -1
  154. package/dist/op/activities/pin-rollout.d.ts +0 -1
  155. package/dist/op/activities/terraform.d.ts +0 -1
  156. package/dist/op/activity-contracts.d.ts +0 -1
  157. package/dist/op/adoption.d.ts +0 -1
  158. package/dist/op/builders.d.ts +0 -1
  159. package/dist/op/command-hook.d.ts +0 -1
  160. package/dist/op/resolve-root-mode.d.ts +0 -1
  161. package/dist/package-cli.d.ts +0 -1
  162. package/dist/pin/consumers.d.ts +0 -1
  163. package/dist/pin/edit-ts.d.ts +0 -1
  164. package/dist/pin/edit.d.ts +0 -1
  165. package/dist/pin/forge.d.ts +0 -1
  166. package/dist/pin/index.d.ts +0 -1
  167. package/dist/pin/rollout.d.ts +0 -1
  168. package/dist/pin/scan.d.ts +0 -1
  169. package/dist/pin/source.d.ts +0 -1
  170. package/dist/pin/waves.d.ts +0 -1
  171. package/dist/plan-digest.d.ts +0 -1
  172. package/dist/plan-observation.d.ts +0 -1
  173. package/dist/plan-shape.d.ts +0 -1
  174. package/dist/plugin.d.ts +0 -1
  175. package/dist/pr-env.d.ts +0 -1
  176. package/dist/reach.d.ts +0 -1
  177. package/dist/registry/address.d.ts +0 -1
  178. package/dist/registry/catalog-read.d.ts +0 -1
  179. package/dist/registry/deprecated.d.ts +0 -1
  180. package/dist/registry/docs.d.ts +0 -1
  181. package/dist/registry/edge/edge.d.ts +0 -1
  182. package/dist/registry/edge/index.d.ts +0 -1
  183. package/dist/registry/edge/lambda-edge.d.ts +0 -1
  184. package/dist/registry/edge/sigv4-web.d.ts +0 -1
  185. package/dist/registry/edge/token-source.d.ts +0 -1
  186. package/dist/registry/edge/worker.d.ts +0 -1
  187. package/dist/registry/handler.d.ts +0 -1
  188. package/dist/registry/headers-file.d.ts +0 -1
  189. package/dist/registry/index.d.ts +0 -1
  190. package/dist/registry/mirror-paths.d.ts +0 -1
  191. package/dist/registry/mirror.d.ts +0 -1
  192. package/dist/registry/proxies.d.ts +0 -1
  193. package/dist/registry/reader.d.ts +0 -1
  194. package/dist/registry/semver.d.ts +0 -1
  195. package/dist/registry/serve.d.ts +0 -1
  196. package/dist/registry/source-forms.d.ts +0 -1
  197. package/dist/registry/targets/artifactory.d.ts +0 -1
  198. package/dist/registry/targets/fake-artifactory.d.ts +0 -1
  199. package/dist/registry/targets/fake-gitlab.d.ts +0 -1
  200. package/dist/registry/targets/fake-hcp.d.ts +0 -1
  201. package/dist/registry/targets/fake-http.d.ts +0 -1
  202. package/dist/registry/targets/fake-nexus.d.ts +0 -1
  203. package/dist/registry/targets/gitlab.d.ts +0 -1
  204. package/dist/registry/targets/hcp.d.ts +0 -1
  205. package/dist/registry/targets/hosted.d.ts +0 -1
  206. package/dist/registry/targets/index.d.ts +0 -1
  207. package/dist/registry/targets/module-target.d.ts +0 -1
  208. package/dist/registry/targets/nexus.d.ts +0 -1
  209. package/dist/registry/targets/zip.d.ts +0 -1
  210. package/dist/registry/writer.d.ts +0 -1
  211. package/dist/report.d.ts +0 -1
  212. package/dist/serializer.d.ts +0 -1
  213. package/dist/state/azure-blob.d.ts +0 -1
  214. package/dist/state/backend.d.ts +0 -1
  215. package/dist/state/exec.d.ts +0 -1
  216. package/dist/state/gcs.d.ts +0 -1
  217. package/dist/state/gitlab.d.ts +0 -1
  218. package/dist/state/index.d.ts +0 -1
  219. package/dist/state/locks.d.ts +0 -1
  220. package/dist/state/object-store.d.ts +0 -1
  221. package/dist/state/root-states.d.ts +0 -1
  222. package/dist/state/s3.d.ts +0 -1
  223. package/dist/state/source.d.ts +0 -1
  224. package/dist/state/store.d.ts +0 -1
  225. package/dist/state/versions.d.ts +0 -1
  226. package/dist/state-migration.d.ts +0 -1
  227. package/dist/state-ops.d.ts +0 -1
  228. package/dist/state-ownership.d.ts +0 -1
  229. package/dist/state-reads.d.ts +0 -1
  230. package/dist/template/index.d.ts +0 -1
  231. package/dist/template/render.d.ts +0 -1
  232. package/dist/terragrunt/affected.d.ts +0 -1
  233. package/dist/terragrunt/capability.d.ts +0 -1
  234. package/dist/terragrunt/index.d.ts +0 -1
  235. package/dist/terragrunt/mocks.d.ts +0 -1
  236. package/dist/terragrunt/place.d.ts +0 -1
  237. package/dist/terragrunt/run.d.ts +0 -1
  238. package/dist/terragrunt/units.d.ts +0 -1
  239. package/dist/terragrunt/wave.d.ts +0 -1
  240. package/dist/used-sources.d.ts +0 -1
  241. package/dist/validate-cli.d.ts +0 -1
  242. package/dist/validate.d.ts +0 -1
  243. package/package.json +3 -4
  244. package/dist/__fixtures__/capabilities/chant.config.d.ts.map +0 -1
  245. package/dist/__fixtures__/effective-topology/chant.config.d.ts.map +0 -1
  246. package/dist/__fixtures__/kind-type/chant.config.d.ts.map +0 -1
  247. package/dist/__fixtures__/pr-loop/estate.component.d.ts.map +0 -1
  248. package/dist/__fixtures__/report/generate.d.ts.map +0 -1
  249. package/dist/__fixtures__/search-roots/chant.config.d.ts.map +0 -1
  250. package/dist/__fixtures__/sensitive-default/chant.config.d.ts.map +0 -1
  251. package/dist/__fixtures__/terragrunt/affected-cases.d.ts.map +0 -1
  252. package/dist/__fixtures__/terragrunt/record.d.ts.map +0 -1
  253. package/dist/action-ops.d.ts.map +0 -1
  254. package/dist/applied-state.d.ts.map +0 -1
  255. package/dist/backend-config.d.ts.map +0 -1
  256. package/dist/behaviour/index.d.ts.map +0 -1
  257. package/dist/behaviour/kinds.d.ts.map +0 -1
  258. package/dist/behaviour/predict.d.ts.map +0 -1
  259. package/dist/behaviour/reference-catalog.d.ts.map +0 -1
  260. package/dist/behaviour/request.d.ts.map +0 -1
  261. package/dist/capabilities/adapter.d.ts.map +0 -1
  262. package/dist/change-set.d.ts.map +0 -1
  263. package/dist/changed-roots.d.ts.map +0 -1
  264. package/dist/chant-floors.d.ts.map +0 -1
  265. package/dist/ci-setup.d.ts.map +0 -1
  266. package/dist/codegen/docs-cli.d.ts.map +0 -1
  267. package/dist/codegen/docs.d.ts.map +0 -1
  268. package/dist/codegen/generate-cli.d.ts.map +0 -1
  269. package/dist/codegen/generate.d.ts.map +0 -1
  270. package/dist/codegen/package.d.ts.map +0 -1
  271. package/dist/commands.d.ts.map +0 -1
  272. package/dist/components/capability-plugin.d.ts.map +0 -1
  273. package/dist/components/compose-group.d.ts.map +0 -1
  274. package/dist/components/placeholder-preview.d.ts.map +0 -1
  275. package/dist/components/release-inputs.d.ts.map +0 -1
  276. package/dist/components/trace-facts.d.ts.map +0 -1
  277. package/dist/compose/apply-events.d.ts.map +0 -1
  278. package/dist/compose/estate.d.ts.map +0 -1
  279. package/dist/compose/hcl.d.ts.map +0 -1
  280. package/dist/compose/module-address.d.ts.map +0 -1
  281. package/dist/compose/root.d.ts.map +0 -1
  282. package/dist/compose/run.d.ts.map +0 -1
  283. package/dist/compose/slice.d.ts.map +0 -1
  284. package/dist/compose/state-address.d.ts.map +0 -1
  285. package/dist/compose/state-merge.d.ts.map +0 -1
  286. package/dist/compose.d.ts.map +0 -1
  287. package/dist/composites/terraform-adopt-op.d.ts.map +0 -1
  288. package/dist/composites/terraform-apply-op.d.ts.map +0 -1
  289. package/dist/composites/terraform-pin-rollout-op.d.ts.map +0 -1
  290. package/dist/composites/terraform-watch-op.d.ts.map +0 -1
  291. package/dist/cone.d.ts.map +0 -1
  292. package/dist/config.d.ts.map +0 -1
  293. package/dist/cost-hold.d.ts.map +0 -1
  294. package/dist/describe-resources.d.ts.map +0 -1
  295. package/dist/drift-read.d.ts.map +0 -1
  296. package/dist/drift-record.d.ts.map +0 -1
  297. package/dist/drift-rows.d.ts.map +0 -1
  298. package/dist/engine-runner.d.ts.map +0 -1
  299. package/dist/engine-timings.d.ts.map +0 -1
  300. package/dist/estate-migration.d.ts.map +0 -1
  301. package/dist/exit-codes.d.ts.map +0 -1
  302. package/dist/generated/index.d.ts.map +0 -1
  303. package/dist/hcl/descend.d.ts.map +0 -1
  304. package/dist/hcl/edges.d.ts.map +0 -1
  305. package/dist/hcl/evaluate.d.ts.map +0 -1
  306. package/dist/hcl/files.d.ts.map +0 -1
  307. package/dist/hcl/instances.d.ts.map +0 -1
  308. package/dist/hcl/jsonencode.d.ts.map +0 -1
  309. package/dist/hcl/marker.d.ts.map +0 -1
  310. package/dist/hcl/parse.d.ts.map +0 -1
  311. package/dist/hcl/redact.d.ts.map +0 -1
  312. package/dist/hcl/references.d.ts.map +0 -1
  313. package/dist/hcl/roots.d.ts.map +0 -1
  314. package/dist/hcl/suppressions.d.ts.map +0 -1
  315. package/dist/hcl/value.d.ts.map +0 -1
  316. package/dist/index.d.ts.map +0 -1
  317. package/dist/init-turn.d.ts.map +0 -1
  318. package/dist/lint/audit-catalog.d.ts.map +0 -1
  319. package/dist/lint/audit-lineage.d.ts.map +0 -1
  320. package/dist/lint/post-synth/blocks.d.ts.map +0 -1
  321. package/dist/lint/post-synth/fixtures/load.d.ts.map +0 -1
  322. package/dist/lint/post-synth/flat-attributes.d.ts.map +0 -1
  323. package/dist/lint/post-synth/index.d.ts.map +0 -1
  324. package/dist/lint/post-synth/module-source.d.ts.map +0 -1
  325. package/dist/lint/post-synth/record-store.d.ts.map +0 -1
  326. package/dist/lint/post-synth/scope.d.ts.map +0 -1
  327. package/dist/lint/post-synth/terragrunt.d.ts.map +0 -1
  328. package/dist/lint/post-synth/tf001.d.ts.map +0 -1
  329. package/dist/lint/post-synth/tf002.d.ts.map +0 -1
  330. package/dist/lint/post-synth/tf003.d.ts.map +0 -1
  331. package/dist/lint/post-synth/tf004.d.ts.map +0 -1
  332. package/dist/lint/post-synth/tf005.d.ts.map +0 -1
  333. package/dist/lint/post-synth/tf006.d.ts.map +0 -1
  334. package/dist/lint/post-synth/tf007.d.ts.map +0 -1
  335. package/dist/lint/post-synth/tf008.d.ts.map +0 -1
  336. package/dist/lint/post-synth/tf009.d.ts.map +0 -1
  337. package/dist/lint/post-synth/tf010.d.ts.map +0 -1
  338. package/dist/lint/post-synth/tf011.d.ts.map +0 -1
  339. package/dist/lint/post-synth/tf012.d.ts.map +0 -1
  340. package/dist/lint/post-synth/tf013.d.ts.map +0 -1
  341. package/dist/lint/post-synth/tf014.d.ts.map +0 -1
  342. package/dist/lint/post-synth/tf015.d.ts.map +0 -1
  343. package/dist/lint/post-synth/tf016.d.ts.map +0 -1
  344. package/dist/lint/post-synth/tf017.d.ts.map +0 -1
  345. package/dist/lint/post-synth/tf018.d.ts.map +0 -1
  346. package/dist/lint/post-synth/tf019.d.ts.map +0 -1
  347. package/dist/lint/post-synth/tf020.d.ts.map +0 -1
  348. package/dist/lint/post-synth/tf021.d.ts.map +0 -1
  349. package/dist/lint/post-synth/tf022.d.ts.map +0 -1
  350. package/dist/lint/post-synth/tf024.d.ts.map +0 -1
  351. package/dist/lint/post-synth/tf025.d.ts.map +0 -1
  352. package/dist/lint/post-synth/tf026.d.ts.map +0 -1
  353. package/dist/lint/post-synth/tf027.d.ts.map +0 -1
  354. package/dist/lint/post-synth/tf028.d.ts.map +0 -1
  355. package/dist/lint/post-synth/tf029.d.ts.map +0 -1
  356. package/dist/lint/post-synth/tf030.d.ts.map +0 -1
  357. package/dist/lint/post-synth/tf031.d.ts.map +0 -1
  358. package/dist/lint/post-synth/tf032.d.ts.map +0 -1
  359. package/dist/lint/post-synth/tf033.d.ts.map +0 -1
  360. package/dist/lint/post-synth/tf034.d.ts.map +0 -1
  361. package/dist/lint/post-synth/tf035.d.ts.map +0 -1
  362. package/dist/lint/post-synth/tf036.d.ts.map +0 -1
  363. package/dist/lint/post-synth/tf037.d.ts.map +0 -1
  364. package/dist/lint/post-synth/tf038.d.ts.map +0 -1
  365. package/dist/lint/post-synth/tf039.d.ts.map +0 -1
  366. package/dist/lint/post-synth/tf040.d.ts.map +0 -1
  367. package/dist/lint/post-synth/tf041.d.ts.map +0 -1
  368. package/dist/lint/post-synth/tf042.d.ts.map +0 -1
  369. package/dist/lint/post-synth/tf043.d.ts.map +0 -1
  370. package/dist/lint/post-synth/tf044.d.ts.map +0 -1
  371. package/dist/lint/post-synth/tf045.d.ts.map +0 -1
  372. package/dist/lint/post-synth/tf046.d.ts.map +0 -1
  373. package/dist/lint/post-synth/tf047.d.ts.map +0 -1
  374. package/dist/lint/rules/fixtures/load.d.ts.map +0 -1
  375. package/dist/lint/rules/index.d.ts.map +0 -1
  376. package/dist/lint/rules/plan-before-apply.d.ts.map +0 -1
  377. package/dist/lint/secret-shape.d.ts.map +0 -1
  378. package/dist/live-ownership.d.ts.map +0 -1
  379. package/dist/live-plan-reasons.d.ts.map +0 -1
  380. package/dist/live-roots.d.ts.map +0 -1
  381. package/dist/lock-rows.d.ts.map +0 -1
  382. package/dist/lock-timeout.d.ts.map +0 -1
  383. package/dist/lsp/completions.d.ts.map +0 -1
  384. package/dist/lsp/context.d.ts.map +0 -1
  385. package/dist/lsp/hover.d.ts.map +0 -1
  386. package/dist/lsp/option-keys.d.ts.map +0 -1
  387. package/dist/migration-history.d.ts.map +0 -1
  388. package/dist/module-catalog/index.d.ts.map +0 -1
  389. package/dist/module-catalog/refresh-cli.d.ts.map +0 -1
  390. package/dist/module-catalog/static-tier.d.ts.map +0 -1
  391. package/dist/module-catalog/types.d.ts.map +0 -1
  392. package/dist/op/activities/index.d.ts.map +0 -1
  393. package/dist/op/activities/live-detect.d.ts.map +0 -1
  394. package/dist/op/activities/pin-rollout.d.ts.map +0 -1
  395. package/dist/op/activities/terraform.d.ts.map +0 -1
  396. package/dist/op/activity-contracts.d.ts.map +0 -1
  397. package/dist/op/adoption.d.ts.map +0 -1
  398. package/dist/op/builders.d.ts.map +0 -1
  399. package/dist/op/command-hook.d.ts.map +0 -1
  400. package/dist/op/resolve-root-mode.d.ts.map +0 -1
  401. package/dist/package-cli.d.ts.map +0 -1
  402. package/dist/pin/consumers.d.ts.map +0 -1
  403. package/dist/pin/edit-ts.d.ts.map +0 -1
  404. package/dist/pin/edit.d.ts.map +0 -1
  405. package/dist/pin/forge.d.ts.map +0 -1
  406. package/dist/pin/index.d.ts.map +0 -1
  407. package/dist/pin/rollout.d.ts.map +0 -1
  408. package/dist/pin/scan.d.ts.map +0 -1
  409. package/dist/pin/source.d.ts.map +0 -1
  410. package/dist/pin/waves.d.ts.map +0 -1
  411. package/dist/plan-digest.d.ts.map +0 -1
  412. package/dist/plan-observation.d.ts.map +0 -1
  413. package/dist/plan-shape.d.ts.map +0 -1
  414. package/dist/plugin.d.ts.map +0 -1
  415. package/dist/pr-env.d.ts.map +0 -1
  416. package/dist/reach.d.ts.map +0 -1
  417. package/dist/registry/address.d.ts.map +0 -1
  418. package/dist/registry/catalog-read.d.ts.map +0 -1
  419. package/dist/registry/deprecated.d.ts.map +0 -1
  420. package/dist/registry/docs.d.ts.map +0 -1
  421. package/dist/registry/edge/edge.d.ts.map +0 -1
  422. package/dist/registry/edge/index.d.ts.map +0 -1
  423. package/dist/registry/edge/lambda-edge.d.ts.map +0 -1
  424. package/dist/registry/edge/sigv4-web.d.ts.map +0 -1
  425. package/dist/registry/edge/token-source.d.ts.map +0 -1
  426. package/dist/registry/edge/worker.d.ts.map +0 -1
  427. package/dist/registry/handler.d.ts.map +0 -1
  428. package/dist/registry/headers-file.d.ts.map +0 -1
  429. package/dist/registry/index.d.ts.map +0 -1
  430. package/dist/registry/mirror-paths.d.ts.map +0 -1
  431. package/dist/registry/mirror.d.ts.map +0 -1
  432. package/dist/registry/proxies.d.ts.map +0 -1
  433. package/dist/registry/reader.d.ts.map +0 -1
  434. package/dist/registry/semver.d.ts.map +0 -1
  435. package/dist/registry/serve.d.ts.map +0 -1
  436. package/dist/registry/source-forms.d.ts.map +0 -1
  437. package/dist/registry/targets/artifactory.d.ts.map +0 -1
  438. package/dist/registry/targets/fake-artifactory.d.ts.map +0 -1
  439. package/dist/registry/targets/fake-gitlab.d.ts.map +0 -1
  440. package/dist/registry/targets/fake-hcp.d.ts.map +0 -1
  441. package/dist/registry/targets/fake-http.d.ts.map +0 -1
  442. package/dist/registry/targets/fake-nexus.d.ts.map +0 -1
  443. package/dist/registry/targets/gitlab.d.ts.map +0 -1
  444. package/dist/registry/targets/hcp.d.ts.map +0 -1
  445. package/dist/registry/targets/hosted.d.ts.map +0 -1
  446. package/dist/registry/targets/index.d.ts.map +0 -1
  447. package/dist/registry/targets/module-target.d.ts.map +0 -1
  448. package/dist/registry/targets/nexus.d.ts.map +0 -1
  449. package/dist/registry/targets/zip.d.ts.map +0 -1
  450. package/dist/registry/writer.d.ts.map +0 -1
  451. package/dist/report.d.ts.map +0 -1
  452. package/dist/serializer.d.ts.map +0 -1
  453. package/dist/state/azure-blob.d.ts.map +0 -1
  454. package/dist/state/backend.d.ts.map +0 -1
  455. package/dist/state/exec.d.ts.map +0 -1
  456. package/dist/state/gcs.d.ts.map +0 -1
  457. package/dist/state/gitlab.d.ts.map +0 -1
  458. package/dist/state/index.d.ts.map +0 -1
  459. package/dist/state/locks.d.ts.map +0 -1
  460. package/dist/state/object-store.d.ts.map +0 -1
  461. package/dist/state/root-states.d.ts.map +0 -1
  462. package/dist/state/s3.d.ts.map +0 -1
  463. package/dist/state/source.d.ts.map +0 -1
  464. package/dist/state/store.d.ts.map +0 -1
  465. package/dist/state/versions.d.ts.map +0 -1
  466. package/dist/state-migration.d.ts.map +0 -1
  467. package/dist/state-ops.d.ts.map +0 -1
  468. package/dist/state-ownership.d.ts.map +0 -1
  469. package/dist/state-reads.d.ts.map +0 -1
  470. package/dist/template/index.d.ts.map +0 -1
  471. package/dist/template/render.d.ts.map +0 -1
  472. package/dist/terragrunt/affected.d.ts.map +0 -1
  473. package/dist/terragrunt/capability.d.ts.map +0 -1
  474. package/dist/terragrunt/index.d.ts.map +0 -1
  475. package/dist/terragrunt/mocks.d.ts.map +0 -1
  476. package/dist/terragrunt/place.d.ts.map +0 -1
  477. package/dist/terragrunt/run.d.ts.map +0 -1
  478. package/dist/terragrunt/units.d.ts.map +0 -1
  479. package/dist/terragrunt/wave.d.ts.map +0 -1
  480. package/dist/used-sources.d.ts.map +0 -1
  481. package/dist/validate-cli.d.ts.map +0 -1
  482. package/dist/validate.d.ts.map +0 -1
  483. package/src/__fixtures__/ACCEPTANCE.md +0 -370
  484. package/src/__fixtures__/capabilities/catalog/main.tf +0 -105
  485. package/src/__fixtures__/capabilities/chant.config.ts +0 -15
  486. package/src/__fixtures__/capabilities/findings/main.tf +0 -225
  487. package/src/__fixtures__/capabilities/ledger/main.tf +0 -265
  488. package/src/__fixtures__/capabilities/package.json +0 -1
  489. package/src/__fixtures__/change-set/choudoufu-set-plan.change-set.golden.json +0 -95
  490. package/src/__fixtures__/change-set/choudoufu-set-plan.json +0 -76
  491. package/src/__fixtures__/change-set/choudoufu.part.golden.json +0 -173
  492. package/src/__fixtures__/change-set/choudoufu.plan.json +0 -610
  493. package/src/__fixtures__/change-set/terraform.import-forget.plan.json +0 -81
  494. package/src/__fixtures__/change-set/terraform.part.golden.json +0 -173
  495. package/src/__fixtures__/change-set/terraform.plan.json +0 -589
  496. package/src/__fixtures__/change-set/tofu.part.golden.json +0 -173
  497. package/src/__fixtures__/change-set/tofu.plan.json +0 -588
  498. package/src/__fixtures__/change-set/v1.tf.txt +0 -21
  499. package/src/__fixtures__/change-set/v2-module-app.tf.txt +0 -4
  500. package/src/__fixtures__/change-set/v2.tf.txt +0 -21
  501. package/src/__fixtures__/compose/apply-failed-in-app.jsonl +0 -12
  502. package/src/__fixtures__/compose/state-app.json +0 -66
  503. package/src/__fixtures__/compose/state-edge.json +0 -40
  504. package/src/__fixtures__/compose/state-net.json +0 -58
  505. package/src/__fixtures__/compose/three-app.plan.json +0 -184
  506. package/src/__fixtures__/compose/three-composed.plan.json +0 -509
  507. package/src/__fixtures__/compose/three-edge.plan.json +0 -144
  508. package/src/__fixtures__/compose/three-net.plan.json +0 -174
  509. package/src/__fixtures__/compose/unknown-composed.plan.json +0 -228
  510. package/src/__fixtures__/compose/working-after-apply.json +0 -145
  511. package/src/__fixtures__/config-blocks/app/main.tf +0 -61
  512. package/src/__fixtures__/config-blocks/app/modules/network/main.tf +0 -4
  513. package/src/__fixtures__/config-blocks/app-json/main.tf.json +0 -39
  514. package/src/__fixtures__/config-files/shadow/main.tf +0 -3
  515. package/src/__fixtures__/config-files/shadow/main.tofu +0 -3
  516. package/src/__fixtures__/config-files/shadow/other.tf +0 -3
  517. package/src/__fixtures__/config-files/tf/main.tf +0 -11
  518. package/src/__fixtures__/config-files/tf-json/main.tf.json +0 -18
  519. package/src/__fixtures__/config-files/tofu/main.tofu +0 -11
  520. package/src/__fixtures__/config-files/tofu-json/main.tofu.json +0 -18
  521. package/src/__fixtures__/config-files/tofu-only/main.tofu +0 -3
  522. package/src/__fixtures__/drift-record/README.md +0 -16
  523. package/src/__fixtures__/drift-record/live-plan-sections.json +0 -27
  524. package/src/__fixtures__/drift-rows/live-root-plan.json +0 -70
  525. package/src/__fixtures__/drift-rows/refresh-plan-module.json +0 -48
  526. package/src/__fixtures__/drift-rows/refresh-plan.json +0 -61
  527. package/src/__fixtures__/effective-topology/chant.config.ts +0 -11
  528. package/src/__fixtures__/effective-topology/net/main.tf +0 -176
  529. package/src/__fixtures__/effective-topology/package.json +0 -6
  530. package/src/__fixtures__/graph-roots/README.md +0 -21
  531. package/src/__fixtures__/graph-roots/app/main.tf +0 -41
  532. package/src/__fixtures__/graph-roots/app/modules/cdn/main.tf +0 -7
  533. package/src/__fixtures__/graph-roots/network/main.tf +0 -16
  534. package/src/__fixtures__/instance-forms/app/main.tf +0 -110
  535. package/src/__fixtures__/instance-forms/app/modules/svc/main.tf +0 -3
  536. package/src/__fixtures__/instance-vars/app/main.tf +0 -52
  537. package/src/__fixtures__/instance-vars/app/modules/app/main.tf +0 -12
  538. package/src/__fixtures__/instance-vars/app/modules/edge/main.tf +0 -3
  539. package/src/__fixtures__/instance-vars/app/terraform.tfvars +0 -1
  540. package/src/__fixtures__/kind-type/app/main.tf +0 -35
  541. package/src/__fixtures__/kind-type/chant.config.ts +0 -11
  542. package/src/__fixtures__/kind-type/package.json +0 -6
  543. package/src/__fixtures__/live/main.tf +0 -28
  544. package/src/__fixtures__/live-adopt/estate.chdf.hcl +0 -6
  545. package/src/__fixtures__/live-adopt/main.tf +0 -21
  546. package/src/__fixtures__/live-estate/README.md +0 -104
  547. package/src/__fixtures__/live-estate/adoptable.tf +0 -13
  548. package/src/__fixtures__/live-estate/compute.tf +0 -10
  549. package/src/__fixtures__/live-estate/estate.chdf.hcl +0 -1
  550. package/src/__fixtures__/live-estate/logs.tf +0 -8
  551. package/src/__fixtures__/live-estate/network.tf +0 -24
  552. package/src/__fixtures__/live-estate/rule.tf +0 -11
  553. package/src/__fixtures__/live-estate/unowned.tf +0 -21
  554. package/src/__fixtures__/live-estate/versions.tf +0 -31
  555. package/src/__fixtures__/live-ls.json +0 -98
  556. package/src/__fixtures__/live-module-keyed/live-graph.json +0 -259
  557. package/src/__fixtures__/live-module-keyed/live-plan.json +0 -87
  558. package/src/__fixtures__/live-module-keyed/root/estate.chdf.hcl +0 -1
  559. package/src/__fixtures__/live-module-keyed/root/main.tf +0 -21
  560. package/src/__fixtures__/live-module-keyed/root/modules/app/main.tf +0 -17
  561. package/src/__fixtures__/live-module-keyed/root/modules/edge/main.tf +0 -7
  562. package/src/__fixtures__/live-module-keyed/root/versions.tf +0 -30
  563. package/src/__fixtures__/live-module-keyed/show-state.json +0 -146
  564. package/src/__fixtures__/live-plan-depth/README.md +0 -59
  565. package/src/__fixtures__/live-plan-depth/live-plan.json +0 -110
  566. package/src/__fixtures__/live-plan-depth/show-plan-sensitive.json +0 -1
  567. package/src/__fixtures__/live-plan-depth/show-plan.json +0 -1
  568. package/src/__fixtures__/live-plan.json +0 -317
  569. package/src/__fixtures__/live-sidecar/estate.chdf.hcl +0 -3
  570. package/src/__fixtures__/live-sidecar/main.tf +0 -24
  571. package/src/__fixtures__/module-tree/README.md +0 -16
  572. package/src/__fixtures__/module-tree/cycle/main.tf +0 -3
  573. package/src/__fixtures__/module-tree/cycle/modules/a/main.tf +0 -9
  574. package/src/__fixtures__/module-tree/cycle/modules/b/main.tf +0 -9
  575. package/src/__fixtures__/module-tree/missing/main.tf +0 -9
  576. package/src/__fixtures__/module-tree/outside/root/main.tf +0 -9
  577. package/src/__fixtures__/module-tree/root/main.tf +0 -28
  578. package/src/__fixtures__/module-tree/root/modules/cdn/main.tf +0 -15
  579. package/src/__fixtures__/module-tree/root/modules/cdn/modules/bucket/main.tf +0 -11
  580. package/src/__fixtures__/module-tree/shared/main.tf +0 -5
  581. package/src/__fixtures__/no-backend/main.tf +0 -24
  582. package/src/__fixtures__/pin/choudoufu-live-waves-n5.json +0 -83
  583. package/src/__fixtures__/pin/largeset-oci-n5/apply-order.txt +0 -5
  584. package/src/__fixtures__/pin/largeset-oci-n5/estates/e01/estate.chdf.hcl +0 -6
  585. package/src/__fixtures__/pin/largeset-oci-n5/estates/e01/main.tf +0 -33
  586. package/src/__fixtures__/pin/largeset-oci-n5/estates/e02/estate.chdf.hcl +0 -6
  587. package/src/__fixtures__/pin/largeset-oci-n5/estates/e02/main.tf +0 -45
  588. package/src/__fixtures__/pin/largeset-oci-n5/estates/e03/estate.chdf.hcl +0 -6
  589. package/src/__fixtures__/pin/largeset-oci-n5/estates/e03/main.tf +0 -47
  590. package/src/__fixtures__/pin/largeset-oci-n5/estates/e04/estate.chdf.hcl +0 -6
  591. package/src/__fixtures__/pin/largeset-oci-n5/estates/e04/main.tf +0 -31
  592. package/src/__fixtures__/pin/largeset-oci-n5/estates/e05/estate.chdf.hcl +0 -6
  593. package/src/__fixtures__/pin/largeset-oci-n5/estates/e05/main.tf +0 -27
  594. package/src/__fixtures__/pin/largeset-oci-n5/fixture.json +0 -77
  595. package/src/__fixtures__/plan-read/main.tf +0 -46
  596. package/src/__fixtures__/plan-read/next.tfvars +0 -1
  597. package/src/__fixtures__/plan-read-drift/README.md +0 -33
  598. package/src/__fixtures__/plan-read-drift/main.tf +0 -63
  599. package/src/__fixtures__/plan-read-drift/next.tfvars +0 -1
  600. package/src/__fixtures__/plan-summary/largeset-n5-bump.json +0 -2071
  601. package/src/__fixtures__/plan-summary/largeset-n5.summary.golden.json +0 -95
  602. package/src/__fixtures__/plan-summary/largeset-n5.summary.golden.md +0 -22
  603. package/src/__fixtures__/plan-summary/largeset-n5.summary.golden.txt +0 -12
  604. package/src/__fixtures__/pr-loop/README.md +0 -50
  605. package/src/__fixtures__/pr-loop/chant.config.json +0 -13
  606. package/src/__fixtures__/pr-loop/estate.component.ts +0 -10
  607. package/src/__fixtures__/pr-loop/roots/a/main.tf +0 -11
  608. package/src/__fixtures__/pr-loop/roots/app/main.tf +0 -19
  609. package/src/__fixtures__/pr-loop/roots/b/main.tf +0 -7
  610. package/src/__fixtures__/pr-loop/roots/dns/main.tf +0 -3
  611. package/src/__fixtures__/pr-loop/roots/net/main.tf +0 -7
  612. package/src/__fixtures__/references/main.tf +0 -56
  613. package/src/__fixtures__/remote-backend/main.tf +0 -34
  614. package/src/__fixtures__/report/applied.show.json +0 -51
  615. package/src/__fixtures__/report/generate.ts +0 -63
  616. package/src/__fixtures__/report/plan.show.json +0 -200
  617. package/src/__fixtures__/report/tf-apply/change-set.json +0 -170
  618. package/src/__fixtures__/report/tf-apply/report.json +0 -338
  619. package/src/__fixtures__/report/tf-plan/change-set.json +0 -170
  620. package/src/__fixtures__/report/tf-plan/report.json +0 -320
  621. package/src/__fixtures__/resolved-arguments/build-trusted/extras.tf +0 -28
  622. package/src/__fixtures__/resolved-arguments/build-trusted/main.tf +0 -22
  623. package/src/__fixtures__/resolved-arguments/build-trusted/serviceaccounts.tf +0 -26
  624. package/src/__fixtures__/resolved-arguments/modules/gke-cluster/main.tf +0 -15
  625. package/src/__fixtures__/resolved-arguments/modules/gke-cluster/variables.tf +0 -12
  626. package/src/__fixtures__/resolved-arguments/modules/gke-project/main.tf +0 -9
  627. package/src/__fixtures__/resolved-arguments/modules/gke-project/outputs.tf +0 -9
  628. package/src/__fixtures__/resolved-arguments/modules/gke-project/variables.tf +0 -7
  629. package/src/__fixtures__/resolved-arguments/modules/workload-identity-service-account/main.tf +0 -16
  630. package/src/__fixtures__/resolved-arguments/modules/workload-identity-service-account/outputs.tf +0 -4
  631. package/src/__fixtures__/resolved-arguments/modules/workload-identity-service-account/variables.tf +0 -21
  632. package/src/__fixtures__/search-roots/chant.config.ts +0 -11
  633. package/src/__fixtures__/search-roots/net/main.tf +0 -73
  634. package/src/__fixtures__/search-roots/package.json +0 -6
  635. package/src/__fixtures__/sensitive-default/chant.config.ts +0 -11
  636. package/src/__fixtures__/sensitive-default/net/main.tf +0 -38
  637. package/src/__fixtures__/sensitive-default/package.json +0 -6
  638. package/src/__fixtures__/show-plan.json +0 -663
  639. package/src/__fixtures__/show-state.json +0 -68
  640. package/src/__fixtures__/terragrunt/affected/catalog/units/web/terragrunt.hcl +0 -3
  641. package/src/__fixtures__/terragrunt/affected/gitignore +0 -3
  642. package/src/__fixtures__/terragrunt/affected/live/dev/app/terragrunt.hcl +0 -3
  643. package/src/__fixtures__/terragrunt/affected/live/dev/vpc/terragrunt.hcl +0 -3
  644. package/src/__fixtures__/terragrunt/affected/live/prod/app/terragrunt.hcl +0 -3
  645. package/src/__fixtures__/terragrunt/affected/live/stg/terragrunt.stack.hcl +0 -5
  646. package/src/__fixtures__/terragrunt/affected/modules/app/main.tf +0 -6
  647. package/src/__fixtures__/terragrunt/affected/modules/app/policy.json +0 -1
  648. package/src/__fixtures__/terragrunt/affected/modules/net/main.tf +0 -2
  649. package/src/__fixtures__/terragrunt/affected/modules/thing/main.tf +0 -3
  650. package/src/__fixtures__/terragrunt/affected/root.hcl +0 -5
  651. package/src/__fixtures__/terragrunt/affected-cases.ts +0 -126
  652. package/src/__fixtures__/terragrunt/five-units/catalog/units/thing/terragrunt.hcl +0 -3
  653. package/src/__fixtures__/terragrunt/five-units/live/dev/app/terragrunt.hcl +0 -13
  654. package/src/__fixtures__/terragrunt/five-units/live/dev/db/terragrunt.hcl +0 -8
  655. package/src/__fixtures__/terragrunt/five-units/live/dev/vpc/terragrunt.hcl +0 -3
  656. package/src/__fixtures__/terragrunt/five-units/live/prod/app/terragrunt.hcl +0 -8
  657. package/src/__fixtures__/terragrunt/five-units/live/prod/vpc/terragrunt.hcl +0 -3
  658. package/src/__fixtures__/terragrunt/five-units/modules/thing/main.tf +0 -7
  659. package/src/__fixtures__/terragrunt/five-units/root.hcl +0 -5
  660. package/src/__fixtures__/terragrunt/record.ts +0 -56
  661. package/src/__fixtures__/terragrunt/recorded/affected-find.json +0 -50
  662. package/src/__fixtures__/terragrunt/recorded/failed-plan-report.json +0 -36
  663. package/src/__fixtures__/terragrunt/recorded/find.json +0 -67
  664. package/src/__fixtures__/terragrunt/recorded/version.txt +0 -1
  665. package/src/__fixtures__/terragrunt/recorded/wave-1/apply-report.json +0 -22
  666. package/src/__fixtures__/terragrunt/recorded/wave-1/json/live/dev/vpc/tfplan.json +0 -1
  667. package/src/__fixtures__/terragrunt/recorded/wave-1/json/live/prod/vpc/tfplan.json +0 -1
  668. package/src/__fixtures__/terragrunt/recorded/wave-1/plan-report.json +0 -22
  669. package/src/__fixtures__/terragrunt/recorded/wave-2/json/live/dev/db/tfplan.json +0 -1
  670. package/src/__fixtures__/terragrunt/recorded/wave-2/json/live/prod/app/tfplan.json +0 -1
  671. package/src/__fixtures__/terragrunt/recorded/wave-2/plan-report.json +0 -22
  672. package/src/__fixtures__/three-cloud-azure.graph.json +0 -290
  673. package/src/__fixtures__/used-sources/root/extra.tofu +0 -1
  674. package/src/__fixtures__/used-sources/root/main.tf +0 -31
  675. package/src/__fixtures__/used-sources/root/modules/net/main.tf +0 -14
  676. package/src/__fixtures__/used-sources/root/modules/net/versions.tf.json +0 -7
  677. package/src/__fixtures__/used-sources/unit/terragrunt.hcl +0 -3
  678. package/src/__fixtures__/with-backend/main.tf +0 -35
  679. package/src/__fixtures__/with-module/main.tf +0 -49
  680. package/src/__fixtures__/with-module/modules/inner/main.tf +0 -5
  681. package/src/action-ops.test.ts +0 -293
  682. package/src/action-ops.ts +0 -372
  683. package/src/applied-state.ts +0 -52
  684. package/src/backend-config.test.ts +0 -105
  685. package/src/backend-config.ts +0 -133
  686. package/src/behaviour/index.ts +0 -32
  687. package/src/behaviour/kinds.ts +0 -209
  688. package/src/behaviour/predict.test.ts +0 -549
  689. package/src/behaviour/predict.ts +0 -391
  690. package/src/behaviour/reference-catalog.plugin.test.ts +0 -164
  691. package/src/behaviour/reference-catalog.ts +0 -349
  692. package/src/behaviour/request.test.ts +0 -359
  693. package/src/behaviour/request.ts +0 -624
  694. package/src/capabilities/adapter.ts +0 -32
  695. package/src/capabilities/mapping.json +0 -166
  696. package/src/capabilities-workspace.e2e.test.ts +0 -251
  697. package/src/capabilities.test.ts +0 -264
  698. package/src/change-set-combined-run.test.ts +0 -157
  699. package/src/change-set-instances.test.ts +0 -98
  700. package/src/change-set.test.ts +0 -177
  701. package/src/change-set.ts +0 -292
  702. package/src/changed-roots.test.ts +0 -84
  703. package/src/changed-roots.ts +0 -100
  704. package/src/chant-floors.ts +0 -32
  705. package/src/ci-setup.test.ts +0 -20
  706. package/src/ci-setup.ts +0 -47
  707. package/src/codegen/docs-cli.ts +0 -4
  708. package/src/codegen/docs.ts +0 -50
  709. package/src/codegen/generate-cli.ts +0 -10
  710. package/src/codegen/generate.ts +0 -68
  711. package/src/codegen/lint-rules-page.test.ts +0 -45
  712. package/src/codegen/package.ts +0 -50
  713. package/src/commands.ts +0 -192
  714. package/src/components/capability-plugin.test.ts +0 -548
  715. package/src/components/capability-plugin.ts +0 -921
  716. package/src/components/change-set-graph.e2e.test.ts +0 -90
  717. package/src/components/compose-group.test.ts +0 -515
  718. package/src/components/compose-group.ts +0 -497
  719. package/src/components/compose-op-wave.test.ts +0 -134
  720. package/src/components/demo-composed-roots.e2e.test.ts +0 -440
  721. package/src/components/member-outputs.test.ts +0 -76
  722. package/src/components/placeholder-preview.test.ts +0 -147
  723. package/src/components/placeholder-preview.ts +0 -257
  724. package/src/components/pr-loop-compose.tofu.e2e.test.ts +0 -363
  725. package/src/components/pr-loop.tofu.test.ts +0 -384
  726. package/src/components/release-inputs.ts +0 -69
  727. package/src/components/terraform-apply-command-hook.test.ts +0 -200
  728. package/src/components/terraform-apply-op-wave.test.ts +0 -295
  729. package/src/components/terraform-apply-parallel.test.ts +0 -158
  730. package/src/components/trace-facts.test.ts +0 -21
  731. package/src/components/trace-facts.ts +0 -27
  732. package/src/compose/apply-events.test.ts +0 -62
  733. package/src/compose/apply-events.ts +0 -100
  734. package/src/compose/estate.choudoufu.e2e.test.ts +0 -112
  735. package/src/compose/estate.test.ts +0 -421
  736. package/src/compose/estate.ts +0 -443
  737. package/src/compose/hcl.ts +0 -311
  738. package/src/compose/module-address.ts +0 -49
  739. package/src/compose/root.test.ts +0 -416
  740. package/src/compose/root.ts +0 -592
  741. package/src/compose/run.test.ts +0 -440
  742. package/src/compose/run.tofu.test.ts +0 -176
  743. package/src/compose/run.ts +0 -527
  744. package/src/compose/slice.test.ts +0 -184
  745. package/src/compose/slice.ts +0 -290
  746. package/src/compose/state-address.ts +0 -157
  747. package/src/compose/state-merge.test.ts +0 -131
  748. package/src/compose/state-merge.ts +0 -148
  749. package/src/compose.test.ts +0 -248
  750. package/src/compose.ts +0 -628
  751. package/src/composites/terraform-adopt-op.acceptance.test.ts +0 -244
  752. package/src/composites/terraform-adopt-op.test.ts +0 -203
  753. package/src/composites/terraform-adopt-op.ts +0 -225
  754. package/src/composites/terraform-apply-op.acceptance.test.ts +0 -323
  755. package/src/composites/terraform-apply-op.test.ts +0 -400
  756. package/src/composites/terraform-apply-op.ts +0 -291
  757. package/src/composites/terraform-pin-rollout-op.test.ts +0 -69
  758. package/src/composites/terraform-pin-rollout-op.ts +0 -60
  759. package/src/composites/terraform-watch-op.test.ts +0 -338
  760. package/src/composites/terraform-watch-op.ts +0 -322
  761. package/src/cone.ts +0 -138
  762. package/src/config-file-listers.test.ts +0 -265
  763. package/src/config.ts +0 -213
  764. package/src/cost-hold.ts +0 -29
  765. package/src/describe-resources.engine-facts.test.ts +0 -411
  766. package/src/describe-resources.live-module-keyed.test.ts +0 -290
  767. package/src/describe-resources.live-plan.test.ts +0 -302
  768. package/src/describe-resources.live-root-unchanged.test.ts +0 -126
  769. package/src/describe-resources.live.test.ts +0 -670
  770. package/src/describe-resources.plan.test.ts +0 -437
  771. package/src/describe-resources.test.ts +0 -430
  772. package/src/describe-resources.ts +0 -1996
  773. package/src/drift-read.ts +0 -284
  774. package/src/drift-record.test.ts +0 -285
  775. package/src/drift-record.ts +0 -513
  776. package/src/drift-rows.test.ts +0 -224
  777. package/src/drift-rows.ts +0 -208
  778. package/src/effective-topology.test.ts +0 -134
  779. package/src/engine-runner.test.ts +0 -347
  780. package/src/engine-runner.ts +0 -201
  781. package/src/engine-timings.test.ts +0 -203
  782. package/src/engine-timings.ts +0 -718
  783. package/src/estate-migration.test.ts +0 -186
  784. package/src/estate-migration.ts +0 -563
  785. package/src/exit-codes.test.ts +0 -23
  786. package/src/exit-codes.ts +0 -59
  787. package/src/generated/index.d.ts +0 -2
  788. package/src/generated/index.ts +0 -4
  789. package/src/hcl/config-blocks.test.ts +0 -174
  790. package/src/hcl/descend.test.ts +0 -202
  791. package/src/hcl/descend.ts +0 -286
  792. package/src/hcl/edges.test.ts +0 -207
  793. package/src/hcl/edges.ts +0 -336
  794. package/src/hcl/evaluate.test.ts +0 -215
  795. package/src/hcl/evaluate.ts +0 -899
  796. package/src/hcl/files.ts +0 -234
  797. package/src/hcl/instance-forms.test.ts +0 -94
  798. package/src/hcl/instances.test.ts +0 -137
  799. package/src/hcl/instances.ts +0 -508
  800. package/src/hcl/jsonencode.test.ts +0 -226
  801. package/src/hcl/jsonencode.ts +0 -454
  802. package/src/hcl/marker.test.ts +0 -147
  803. package/src/hcl/marker.ts +0 -235
  804. package/src/hcl/parse.test.ts +0 -250
  805. package/src/hcl/parse.ts +0 -812
  806. package/src/hcl/redact.ts +0 -185
  807. package/src/hcl/references.test.ts +0 -184
  808. package/src/hcl/references.ts +0 -188
  809. package/src/hcl/roots.ts +0 -148
  810. package/src/hcl/suppressions.test.ts +0 -147
  811. package/src/hcl/suppressions.ts +0 -216
  812. package/src/hcl/value.test.ts +0 -73
  813. package/src/hcl/value.ts +0 -106
  814. package/src/index.ts +0 -218
  815. package/src/init-turn.ts +0 -36
  816. package/src/lint/audit-catalog.ts +0 -584
  817. package/src/lint/audit-lineage.ts +0 -570
  818. package/src/lint/audit.test.ts +0 -254
  819. package/src/lint/post-synth/blocks.ts +0 -109
  820. package/src/lint/post-synth/estate-2284.test.ts +0 -68
  821. package/src/lint/post-synth/fixtures/TF001/negative-cloud.tf +0 -28
  822. package/src/lint/post-synth/fixtures/TF001/negative-second-block.tf +0 -17
  823. package/src/lint/post-synth/fixtures/TF001/negative.tf +0 -30
  824. package/src/lint/post-synth/fixtures/TF001/positive-local.tf +0 -31
  825. package/src/lint/post-synth/fixtures/TF001/positive.tf +0 -24
  826. package/src/lint/post-synth/fixtures/TF002/module-cycle/cdn/back/main.tf +0 -3
  827. package/src/lint/post-synth/fixtures/TF002/module-cycle/cdn/main.tf +0 -3
  828. package/src/lint/post-synth/fixtures/TF002/module-cycle/main.tf +0 -14
  829. package/src/lint/post-synth/fixtures/TF002/module-nested/cdn/edge/main.tf +0 -8
  830. package/src/lint/post-synth/fixtures/TF002/module-nested/cdn/main.tf +0 -3
  831. package/src/lint/post-synth/fixtures/TF002/module-nested/main.tf +0 -14
  832. package/src/lint/post-synth/fixtures/TF002/module-other-provider/cdn/main.tf +0 -8
  833. package/src/lint/post-synth/fixtures/TF002/module-other-provider/main.tf +0 -14
  834. package/src/lint/post-synth/fixtures/TF002/module-pinned/cdn/main.tf +0 -12
  835. package/src/lint/post-synth/fixtures/TF002/module-pinned/main.tf +0 -14
  836. package/src/lint/post-synth/fixtures/TF002/module-unpinned/cdn/main.tf +0 -7
  837. package/src/lint/post-synth/fixtures/TF002/module-unpinned/main.tf +0 -14
  838. package/src/lint/post-synth/fixtures/TF002/negative.tf +0 -17
  839. package/src/lint/post-synth/fixtures/TF002/positive-legacy.tf +0 -10
  840. package/src/lint/post-synth/fixtures/TF002/positive-no-version.tf +0 -12
  841. package/src/lint/post-synth/fixtures/TF002/positive.tf +0 -7
  842. package/src/lint/post-synth/fixtures/TF003/negative.tf +0 -10
  843. package/src/lint/post-synth/fixtures/TF003/positive.tf +0 -8
  844. package/src/lint/post-synth/fixtures/TF004/negative-git.tf +0 -3
  845. package/src/lint/post-synth/fixtures/TF004/negative-local.tf +0 -3
  846. package/src/lint/post-synth/fixtures/TF004/negative.tf +0 -4
  847. package/src/lint/post-synth/fixtures/TF004/positive.tf +0 -3
  848. package/src/lint/post-synth/fixtures/TF005/negative-local.tf +0 -3
  849. package/src/lint/post-synth/fixtures/TF005/negative-registry.tf +0 -3
  850. package/src/lint/post-synth/fixtures/TF005/negative-sha.tf +0 -3
  851. package/src/lint/post-synth/fixtures/TF005/negative.tf +0 -3
  852. package/src/lint/post-synth/fixtures/TF005/positive-branch.tf +0 -3
  853. package/src/lint/post-synth/fixtures/TF005/positive-non-semver.tf +0 -3
  854. package/src/lint/post-synth/fixtures/TF005/positive.tf +0 -3
  855. package/src/lint/post-synth/fixtures/TF006/negative-null-default.tf +0 -12
  856. package/src/lint/post-synth/fixtures/TF006/negative.tf +0 -5
  857. package/src/lint/post-synth/fixtures/TF006/positive-empty-default.tf +0 -5
  858. package/src/lint/post-synth/fixtures/TF006/positive.tf +0 -6
  859. package/src/lint/post-synth/fixtures/TF007/negative-names.tf +0 -25
  860. package/src/lint/post-synth/fixtures/TF007/negative.tf +0 -10
  861. package/src/lint/post-synth/fixtures/TF007/positive.tf +0 -9
  862. package/src/lint/post-synth/fixtures/TF008/negative-variable.tf +0 -10
  863. package/src/lint/post-synth/fixtures/TF008/negative.tf +0 -8
  864. package/src/lint/post-synth/fixtures/TF008/positive-other-provider.tf +0 -10
  865. package/src/lint/post-synth/fixtures/TF008/positive.tf +0 -5
  866. package/src/lint/post-synth/fixtures/TF009/negative.tf +0 -10
  867. package/src/lint/post-synth/fixtures/TF009/positive.tf +0 -4
  868. package/src/lint/post-synth/fixtures/TF010/negative.tf +0 -5
  869. package/src/lint/post-synth/fixtures/TF010/positive.tf +0 -4
  870. package/src/lint/post-synth/fixtures/TF011/negative.tf +0 -5
  871. package/src/lint/post-synth/fixtures/TF011/positive-blank.tf +0 -5
  872. package/src/lint/post-synth/fixtures/TF011/positive.tf +0 -4
  873. package/src/lint/post-synth/fixtures/TF012/negative.tf +0 -4
  874. package/src/lint/post-synth/fixtures/TF012/positive.tf +0 -3
  875. package/src/lint/post-synth/fixtures/TF013/negative.tf +0 -8
  876. package/src/lint/post-synth/fixtures/TF013/positive-data.tf +0 -8
  877. package/src/lint/post-synth/fixtures/TF013/positive.tf +0 -8
  878. package/src/lint/post-synth/fixtures/TF014/negative/main.tf +0 -26
  879. package/src/lint/post-synth/fixtures/TF014/negative/modules/cdn/main.tf +0 -19
  880. package/src/lint/post-synth/fixtures/TF014/positive/main.tf +0 -16
  881. package/src/lint/post-synth/fixtures/TF014/positive/modules/cdn/main.tf +0 -15
  882. package/src/lint/post-synth/fixtures/TF015/negative/main.tf +0 -13
  883. package/src/lint/post-synth/fixtures/TF015/negative/modules/cdn/main.tf +0 -16
  884. package/src/lint/post-synth/fixtures/TF015/positive/main.tf +0 -13
  885. package/src/lint/post-synth/fixtures/TF015/positive/modules/cdn/main.tf +0 -14
  886. package/src/lint/post-synth/fixtures/TF016/negative-template.tf +0 -7
  887. package/src/lint/post-synth/fixtures/TF016/negative.tf +0 -16
  888. package/src/lint/post-synth/fixtures/TF016/positive-shared-file.tf +0 -12
  889. package/src/lint/post-synth/fixtures/TF016/positive.tf +0 -13
  890. package/src/lint/post-synth/fixtures/TF017/negative.tf +0 -4
  891. package/src/lint/post-synth/fixtures/TF017/positive.tf +0 -5
  892. package/src/lint/post-synth/fixtures/TF018/negative.tf +0 -9
  893. package/src/lint/post-synth/fixtures/TF018/positive-data.tf +0 -9
  894. package/src/lint/post-synth/fixtures/TF018/positive.tf +0 -4
  895. package/src/lint/post-synth/fixtures/TF019/negative.tf +0 -14
  896. package/src/lint/post-synth/fixtures/TF019/positive-output.tf +0 -5
  897. package/src/lint/post-synth/fixtures/TF019/positive.tf +0 -16
  898. package/src/lint/post-synth/fixtures/TF020/negative.tf +0 -43
  899. package/src/lint/post-synth/fixtures/TF020/positive.tf +0 -32
  900. package/src/lint/post-synth/fixtures/TF020/scoped/main.tf +0 -21
  901. package/src/lint/post-synth/fixtures/TF020/scoped/modules/cdn/main.tf +0 -13
  902. package/src/lint/post-synth/fixtures/TF021/negative.tf +0 -31
  903. package/src/lint/post-synth/fixtures/TF021/positive-length.tf +0 -8
  904. package/src/lint/post-synth/fixtures/TF021/positive.tf +0 -8
  905. package/src/lint/post-synth/fixtures/TF022/negative-locator.tf +0 -7
  906. package/src/lint/post-synth/fixtures/TF022/negative-secret-reference.tf +0 -32
  907. package/src/lint/post-synth/fixtures/TF022/negative.tf +0 -10
  908. package/src/lint/post-synth/fixtures/TF022/positive-nested.tf +0 -10
  909. package/src/lint/post-synth/fixtures/TF022/positive-secret-data.tf +0 -8
  910. package/src/lint/post-synth/fixtures/TF022/positive.tf +0 -6
  911. package/src/lint/post-synth/fixtures/TF023/negative/main.tf +0 -15
  912. package/src/lint/post-synth/fixtures/TF023/positive/main.tf +0 -9
  913. package/src/lint/post-synth/fixtures/TF023/positive/state.json +0 -24
  914. package/src/lint/post-synth/fixtures/TF024/live-backend-second-block/a-versions.tf +0 -3
  915. package/src/lint/post-synth/fixtures/TF024/live-backend-second-block/b-backend.tf +0 -10
  916. package/src/lint/post-synth/fixtures/TF024/live-clean/main.tf +0 -9
  917. package/src/lint/post-synth/fixtures/TF024/live-cloud-second-block/a-versions.tf +0 -3
  918. package/src/lint/post-synth/fixtures/TF024/live-cloud-second-block/b-cloud.tf +0 -9
  919. package/src/lint/post-synth/fixtures/TF024/live-with-backend/main.tf +0 -14
  920. package/src/lint/post-synth/fixtures/TF024/live-with-cloud/main.tf +0 -16
  921. package/src/lint/post-synth/fixtures/TF024/live-with-record-store/main.tf +0 -18
  922. package/src/lint/post-synth/fixtures/TF024/sidecar-backend-second-block/a-versions.tf +0 -3
  923. package/src/lint/post-synth/fixtures/TF024/sidecar-backend-second-block/b-backend.tf +0 -6
  924. package/src/lint/post-synth/fixtures/TF024/sidecar-backend-second-block/estate.chdf.hcl +0 -1
  925. package/src/lint/post-synth/fixtures/TF024/sidecar-with-backend/estate.chdf.hcl +0 -1
  926. package/src/lint/post-synth/fixtures/TF024/sidecar-with-backend/main.tf +0 -10
  927. package/src/lint/post-synth/fixtures/TF025/live-clean/main.tf +0 -13
  928. package/src/lint/post-synth/fixtures/TF025/live-with-workspace-ref/main.tf +0 -13
  929. package/src/lint/post-synth/fixtures/TF026/live-default/main.tf +0 -9
  930. package/src/lint/post-synth/fixtures/TF026/live-explicit-delete/main.tf +0 -13
  931. package/src/lint/post-synth/fixtures/TF026/live-keep/main.tf +0 -13
  932. package/src/lint/post-synth/fixtures/TF027/live-default/main.tf +0 -9
  933. package/src/lint/post-synth/fixtures/TF027/live-untagged-delete/main.tf +0 -13
  934. package/src/lint/post-synth/fixtures/TF027/live-untagged-delete-scoped/main.tf +0 -17
  935. package/src/lint/post-synth/fixtures/TF027/live-untagged-report/main.tf +0 -13
  936. package/src/lint/post-synth/fixtures/TF028/live/main.tf +0 -9
  937. package/src/lint/post-synth/fixtures/TF028/stock/main.tf +0 -10
  938. package/src/lint/post-synth/fixtures/TF029/declared/main.tf +0 -5
  939. package/src/lint/post-synth/fixtures/TF029/no-declaration/main.tf +0 -5
  940. package/src/lint/post-synth/fixtures/TF030/negative-rules.tf +0 -45
  941. package/src/lint/post-synth/fixtures/TF030/negative.tf +0 -55
  942. package/src/lint/post-synth/fixtures/TF030/not-determined-port.tf +0 -28
  943. package/src/lint/post-synth/fixtures/TF030/not-determined-standalone.tf +0 -32
  944. package/src/lint/post-synth/fixtures/TF030/not-determined-vpc-rule.tf +0 -21
  945. package/src/lint/post-synth/fixtures/TF030/not-determined.tf +0 -39
  946. package/src/lint/post-synth/fixtures/TF030/positive-ipv6.tf +0 -44
  947. package/src/lint/post-synth/fixtures/TF030/positive-mixed.tf +0 -36
  948. package/src/lint/post-synth/fixtures/TF030/positive-standalone.tf +0 -25
  949. package/src/lint/post-synth/fixtures/TF030/positive.tf +0 -43
  950. package/src/lint/post-synth/fixtures/TF031/negative.tf +0 -89
  951. package/src/lint/post-synth/fixtures/TF031/not-determined.tf +0 -139
  952. package/src/lint/post-synth/fixtures/TF031/positive-data-source.tf +0 -57
  953. package/src/lint/post-synth/fixtures/TF031/positive-heredoc.tf +0 -149
  954. package/src/lint/post-synth/fixtures/TF031/positive-jsonencode.tf +0 -115
  955. package/src/lint/post-synth/fixtures/TF032/negative-heredoc.tf +0 -20
  956. package/src/lint/post-synth/fixtures/TF032/negative-references.tf +0 -214
  957. package/src/lint/post-synth/fixtures/TF032/negative.tf +0 -99
  958. package/src/lint/post-synth/fixtures/TF032/positive-heredoc.tf +0 -22
  959. package/src/lint/post-synth/fixtures/TF032/positive-sidecar.tf +0 -197
  960. package/src/lint/post-synth/fixtures/TF032/positive.tf +0 -54
  961. package/src/lint/post-synth/fixtures/TF033/negative.tf +0 -39
  962. package/src/lint/post-synth/fixtures/TF033/not-determined-aurora.tf +0 -25
  963. package/src/lint/post-synth/fixtures/TF033/positive-absent.tf +0 -93
  964. package/src/lint/post-synth/fixtures/TF033/positive.tf +0 -50
  965. package/src/lint/post-synth/fixtures/TF034/negative.tf +0 -24
  966. package/src/lint/post-synth/fixtures/TF034/positive-absent.tf +0 -36
  967. package/src/lint/post-synth/fixtures/TF034/positive.tf +0 -14
  968. package/src/lint/post-synth/fixtures/TF035/negative-absent.tf +0 -43
  969. package/src/lint/post-synth/fixtures/TF035/negative.tf +0 -54
  970. package/src/lint/post-synth/fixtures/TF035/positive.tf +0 -37
  971. package/src/lint/post-synth/fixtures/TF036/negative.tf +0 -61
  972. package/src/lint/post-synth/fixtures/TF036/not-determined.tf +0 -28
  973. package/src/lint/post-synth/fixtures/TF036/positive.tf +0 -38
  974. package/src/lint/post-synth/fixtures/TF037/negative-exclusion.tf +0 -63
  975. package/src/lint/post-synth/fixtures/TF037/negative.tf +0 -27
  976. package/src/lint/post-synth/fixtures/TF037/not-determined.tf +0 -27
  977. package/src/lint/post-synth/fixtures/TF037/positive-absent.tf +0 -15
  978. package/src/lint/post-synth/fixtures/TF037/positive.tf +0 -26
  979. package/src/lint/post-synth/fixtures/TF038/positive.tf +0 -3
  980. package/src/lint/post-synth/fixtures/TF039/positive.tf +0 -4
  981. package/src/lint/post-synth/fixtures/TF041/negative/terragrunt.hcl +0 -12
  982. package/src/lint/post-synth/fixtures/TF041/positive/terragrunt.hcl +0 -7
  983. package/src/lint/post-synth/fixtures/TF041/positive-apply/terragrunt.hcl +0 -8
  984. package/src/lint/post-synth/fixtures/TF042/negative/terragrunt.hcl +0 -13
  985. package/src/lint/post-synth/fixtures/TF042/positive/terragrunt.hcl +0 -9
  986. package/src/lint/post-synth/fixtures/TF043/negative/terragrunt.hcl +0 -3
  987. package/src/lint/post-synth/fixtures/TF043/negative-other/terragrunt.hcl +0 -3
  988. package/src/lint/post-synth/fixtures/TF043/positive-git/terragrunt.hcl +0 -3
  989. package/src/lint/post-synth/fixtures/TF043/positive-oci/terragrunt.hcl +0 -3
  990. package/src/lint/post-synth/fixtures/TF043/positive-tfr/terragrunt.hcl +0 -3
  991. package/src/lint/post-synth/fixtures/TF044/negative/terragrunt.hcl +0 -9
  992. package/src/lint/post-synth/fixtures/TF044/positive/terragrunt.hcl +0 -7
  993. package/src/lint/post-synth/fixtures/TF044/positive-generate/terragrunt.hcl +0 -9
  994. package/src/lint/post-synth/fixtures/TF045/negative/root.hcl +0 -1
  995. package/src/lint/post-synth/fixtures/TF045/negative/terragrunt.hcl +0 -3
  996. package/src/lint/post-synth/fixtures/TF045/positive/root.hcl +0 -9
  997. package/src/lint/post-synth/fixtures/TF045/positive/terragrunt.hcl +0 -3
  998. package/src/lint/post-synth/fixtures/TF045/unit-only/terragrunt.hcl +0 -3
  999. package/src/lint/post-synth/fixtures/TF046/azurerm-no-resource-group/main.tf +0 -15
  1000. package/src/lint/post-synth/fixtures/TF046/backend-config-only/main.tf +0 -14
  1001. package/src/lint/post-synth/fixtures/TF046/derived-s3/backend.tf +0 -7
  1002. package/src/lint/post-synth/fixtures/TF046/derived-s3/main.tf +0 -9
  1003. package/src/lint/post-synth/fixtures/TF046/explicit-local/main.tf +0 -16
  1004. package/src/lint/post-synth/fixtures/TF046/explicit-s3-beside-local-backend/main.tf +0 -15
  1005. package/src/lint/post-synth/fixtures/TF046/implied-local/main.tf +0 -9
  1006. package/src/lint/post-synth/fixtures/TF046/sidecar-implied/estate.chdf.hcl +0 -1
  1007. package/src/lint/post-synth/fixtures/TF046/sidecar-implied/main.tf +0 -5
  1008. package/src/lint/post-synth/fixtures/TF047/clear/main.tf +0 -12
  1009. package/src/lint/post-synth/fixtures/TF047/refused/main.tf +0 -12
  1010. package/src/lint/post-synth/fixtures/TF047/unknown-module/main.tf +0 -12
  1011. package/src/lint/post-synth/fixtures/TF047/unknown-version/main.tf +0 -12
  1012. package/src/lint/post-synth/fixtures/estate-2284/clean/main.tf +0 -132
  1013. package/src/lint/post-synth/fixtures/estate-2284/violating/main.tf +0 -112
  1014. package/src/lint/post-synth/fixtures/load.ts +0 -108
  1015. package/src/lint/post-synth/flat-attributes.ts +0 -146
  1016. package/src/lint/post-synth/index.ts +0 -97
  1017. package/src/lint/post-synth/live-refusals-config-format.test.ts +0 -143
  1018. package/src/lint/post-synth/module-rules.test.ts +0 -153
  1019. package/src/lint/post-synth/module-source.test.ts +0 -116
  1020. package/src/lint/post-synth/module-source.ts +0 -176
  1021. package/src/lint/post-synth/post-synth.test.ts +0 -191
  1022. package/src/lint/post-synth/record-store.ts +0 -122
  1023. package/src/lint/post-synth/scope.ts +0 -107
  1024. package/src/lint/post-synth/single-block.test.ts +0 -286
  1025. package/src/lint/post-synth/suppression.test.ts +0 -110
  1026. package/src/lint/post-synth/terragrunt.ts +0 -76
  1027. package/src/lint/post-synth/tf001.ts +0 -160
  1028. package/src/lint/post-synth/tf002.test.ts +0 -137
  1029. package/src/lint/post-synth/tf002.ts +0 -188
  1030. package/src/lint/post-synth/tf003.test.ts +0 -75
  1031. package/src/lint/post-synth/tf003.ts +0 -71
  1032. package/src/lint/post-synth/tf004.test.ts +0 -47
  1033. package/src/lint/post-synth/tf004.ts +0 -63
  1034. package/src/lint/post-synth/tf005.test.ts +0 -57
  1035. package/src/lint/post-synth/tf005.ts +0 -76
  1036. package/src/lint/post-synth/tf006.ts +0 -58
  1037. package/src/lint/post-synth/tf007.ts +0 -78
  1038. package/src/lint/post-synth/tf008.ts +0 -75
  1039. package/src/lint/post-synth/tf009.ts +0 -59
  1040. package/src/lint/post-synth/tf010.ts +0 -51
  1041. package/src/lint/post-synth/tf011.ts +0 -49
  1042. package/src/lint/post-synth/tf012.ts +0 -47
  1043. package/src/lint/post-synth/tf013.ts +0 -63
  1044. package/src/lint/post-synth/tf014.ts +0 -72
  1045. package/src/lint/post-synth/tf015.ts +0 -72
  1046. package/src/lint/post-synth/tf016.ts +0 -75
  1047. package/src/lint/post-synth/tf017.ts +0 -50
  1048. package/src/lint/post-synth/tf018.ts +0 -72
  1049. package/src/lint/post-synth/tf019.ts +0 -72
  1050. package/src/lint/post-synth/tf020.ts +0 -123
  1051. package/src/lint/post-synth/tf021.ts +0 -126
  1052. package/src/lint/post-synth/tf022.ts +0 -78
  1053. package/src/lint/post-synth/tf024.test.ts +0 -84
  1054. package/src/lint/post-synth/tf024.ts +0 -153
  1055. package/src/lint/post-synth/tf025.test.ts +0 -46
  1056. package/src/lint/post-synth/tf025.ts +0 -101
  1057. package/src/lint/post-synth/tf026.test.ts +0 -56
  1058. package/src/lint/post-synth/tf026.ts +0 -84
  1059. package/src/lint/post-synth/tf027.test.ts +0 -62
  1060. package/src/lint/post-synth/tf027.ts +0 -74
  1061. package/src/lint/post-synth/tf028.test.ts +0 -92
  1062. package/src/lint/post-synth/tf028.ts +0 -96
  1063. package/src/lint/post-synth/tf029.test.ts +0 -72
  1064. package/src/lint/post-synth/tf029.ts +0 -85
  1065. package/src/lint/post-synth/tf030.test.ts +0 -219
  1066. package/src/lint/post-synth/tf030.ts +0 -290
  1067. package/src/lint/post-synth/tf031.test.ts +0 -229
  1068. package/src/lint/post-synth/tf031.ts +0 -370
  1069. package/src/lint/post-synth/tf032.test.ts +0 -127
  1070. package/src/lint/post-synth/tf032.ts +0 -226
  1071. package/src/lint/post-synth/tf033.test.ts +0 -126
  1072. package/src/lint/post-synth/tf033.ts +0 -160
  1073. package/src/lint/post-synth/tf034.test.ts +0 -71
  1074. package/src/lint/post-synth/tf034.ts +0 -63
  1075. package/src/lint/post-synth/tf035.test.ts +0 -68
  1076. package/src/lint/post-synth/tf035.ts +0 -74
  1077. package/src/lint/post-synth/tf036.test.ts +0 -87
  1078. package/src/lint/post-synth/tf036.ts +0 -119
  1079. package/src/lint/post-synth/tf037.test.ts +0 -88
  1080. package/src/lint/post-synth/tf037.ts +0 -101
  1081. package/src/lint/post-synth/tf038.test.ts +0 -51
  1082. package/src/lint/post-synth/tf038.ts +0 -71
  1083. package/src/lint/post-synth/tf039.test.ts +0 -40
  1084. package/src/lint/post-synth/tf039.ts +0 -64
  1085. package/src/lint/post-synth/tf040.test.ts +0 -55
  1086. package/src/lint/post-synth/tf040.ts +0 -76
  1087. package/src/lint/post-synth/tf041.test.ts +0 -50
  1088. package/src/lint/post-synth/tf041.ts +0 -56
  1089. package/src/lint/post-synth/tf042.test.ts +0 -19
  1090. package/src/lint/post-synth/tf042.ts +0 -42
  1091. package/src/lint/post-synth/tf043.test.ts +0 -65
  1092. package/src/lint/post-synth/tf043.ts +0 -49
  1093. package/src/lint/post-synth/tf044.test.ts +0 -27
  1094. package/src/lint/post-synth/tf044.ts +0 -51
  1095. package/src/lint/post-synth/tf045.test.ts +0 -30
  1096. package/src/lint/post-synth/tf045.ts +0 -47
  1097. package/src/lint/post-synth/tf046.test.ts +0 -137
  1098. package/src/lint/post-synth/tf046.ts +0 -204
  1099. package/src/lint/post-synth/tf047.test.ts +0 -56
  1100. package/src/lint/post-synth/tf047.ts +0 -114
  1101. package/src/lint/presets.test.ts +0 -72
  1102. package/src/lint/rules/fixtures/TF101/negative-op.ts +0 -2
  1103. package/src/lint/rules/fixtures/TF101/positive-op.ts +0 -2
  1104. package/src/lint/rules/fixtures/load.ts +0 -53
  1105. package/src/lint/rules/index.ts +0 -7
  1106. package/src/lint/rules/plan-before-apply.test.ts +0 -216
  1107. package/src/lint/rules/plan-before-apply.ts +0 -154
  1108. package/src/lint/secret-shape.test.ts +0 -180
  1109. package/src/lint/secret-shape.ts +0 -234
  1110. package/src/live-ownership.ts +0 -60
  1111. package/src/live-plan-depth.acceptance.e2e.test.ts +0 -193
  1112. package/src/live-plan-reasons.ts +0 -54
  1113. package/src/live-record-store.test.ts +0 -76
  1114. package/src/live-roots.test.ts +0 -80
  1115. package/src/live-roots.ts +0 -347
  1116. package/src/lock-rows.test.ts +0 -78
  1117. package/src/lock-rows.ts +0 -82
  1118. package/src/lock-timeout.ts +0 -34
  1119. package/src/lsp/completions.test.ts +0 -121
  1120. package/src/lsp/completions.ts +0 -101
  1121. package/src/lsp/context.test.ts +0 -152
  1122. package/src/lsp/context.ts +0 -349
  1123. package/src/lsp/hover.test.ts +0 -82
  1124. package/src/lsp/hover.ts +0 -44
  1125. package/src/lsp/option-keys.ts +0 -114
  1126. package/src/migration-history.test.ts +0 -83
  1127. package/src/migration-history.ts +0 -199
  1128. package/src/module-catalog/index.test.ts +0 -93
  1129. package/src/module-catalog/index.ts +0 -162
  1130. package/src/module-catalog/refresh-cli.ts +0 -68
  1131. package/src/module-catalog/static-tier.ts +0 -1659
  1132. package/src/module-catalog/types.ts +0 -88
  1133. package/src/op/activities/choudoufu-plan-set-op.test.ts +0 -111
  1134. package/src/op/activities/choudoufu-waves.test.ts +0 -176
  1135. package/src/op/activities/choudoufu.acceptance.test.ts +0 -127
  1136. package/src/op/activities/choudoufu.test.ts +0 -725
  1137. package/src/op/activities/index.ts +0 -97
  1138. package/src/op/activities/live-detect.test.ts +0 -143
  1139. package/src/op/activities/live-detect.ts +0 -278
  1140. package/src/op/activities/pin-rollout.ts +0 -80
  1141. package/src/op/activities/registry.test.ts +0 -38
  1142. package/src/op/activities/terraform.test.ts +0 -932
  1143. package/src/op/activities/terraform.ts +0 -2484
  1144. package/src/op/activity-contracts.test.ts +0 -151
  1145. package/src/op/activity-contracts.ts +0 -244
  1146. package/src/op/adoption.test.ts +0 -288
  1147. package/src/op/adoption.ts +0 -373
  1148. package/src/op/builders.test.ts +0 -145
  1149. package/src/op/builders.ts +0 -213
  1150. package/src/op/command-hook.ts +0 -237
  1151. package/src/op/resolve-root-mode.test.ts +0 -85
  1152. package/src/op/resolve-root-mode.ts +0 -86
  1153. package/src/op-wave-step.test.ts +0 -109
  1154. package/src/ops-doc-parity.test.ts +0 -147
  1155. package/src/package-cli.ts +0 -21
  1156. package/src/pin/__fixtures__/consumers/live/dev/main.tf +0 -4
  1157. package/src/pin/__fixtures__/consumers/live/prod/main.tf +0 -21
  1158. package/src/pin/__fixtures__/consumers/units/vpc/terragrunt.hcl +0 -7
  1159. package/src/pin/bundle.test.ts +0 -57
  1160. package/src/pin/consumers.test.ts +0 -57
  1161. package/src/pin/consumers.ts +0 -95
  1162. package/src/pin/edit-ts.test.ts +0 -39
  1163. package/src/pin/edit-ts.ts +0 -77
  1164. package/src/pin/edit.test.ts +0 -199
  1165. package/src/pin/edit.ts +0 -187
  1166. package/src/pin/forge.ts +0 -91
  1167. package/src/pin/index.ts +0 -22
  1168. package/src/pin/rollout.test.ts +0 -232
  1169. package/src/pin/rollout.ts +0 -462
  1170. package/src/pin/scan.ts +0 -320
  1171. package/src/pin/source.ts +0 -206
  1172. package/src/pin/waves.test.ts +0 -101
  1173. package/src/pin/waves.ts +0 -125
  1174. package/src/plan-digest.test.ts +0 -89
  1175. package/src/plan-digest.ts +0 -140
  1176. package/src/plan-observation.ts +0 -428
  1177. package/src/plan-read.acceptance.test.ts +0 -184
  1178. package/src/plan-shape.test.ts +0 -148
  1179. package/src/plan-shape.ts +0 -128
  1180. package/src/plan-summary.test.ts +0 -172
  1181. package/src/plugin.test.ts +0 -412
  1182. package/src/plugin.ts +0 -392
  1183. package/src/pr-env.test.ts +0 -132
  1184. package/src/pr-env.ts +0 -312
  1185. package/src/reach.test.ts +0 -72
  1186. package/src/reach.ts +0 -196
  1187. package/src/redact-ir.e2e.test.ts +0 -79
  1188. package/src/redact.test.ts +0 -119
  1189. package/src/registry/__fixtures__/docs/documented/.terraform-docs.yml +0 -3
  1190. package/src/registry/__fixtures__/docs/documented/README.md +0 -1
  1191. package/src/registry/__fixtures__/docs/documented/main.tf +0 -8
  1192. package/src/registry/__fixtures__/docs/json/main.tf.json +0 -14
  1193. package/src/registry/__fixtures__/docs/vpc/README.md +0 -3
  1194. package/src/registry/__fixtures__/docs/vpc/examples/complete/main.tf +0 -5
  1195. package/src/registry/__fixtures__/docs/vpc/examples/simple/README.md +0 -1
  1196. package/src/registry/__fixtures__/docs/vpc/examples/simple/main.tf +0 -4
  1197. package/src/registry/__fixtures__/docs/vpc/main.tf +0 -14
  1198. package/src/registry/__fixtures__/docs/vpc/outputs.tf +0 -9
  1199. package/src/registry/__fixtures__/docs/vpc/variables.tf +0 -16
  1200. package/src/registry/__fixtures__/proxied-root/main.tf +0 -12
  1201. package/src/registry/address.ts +0 -100
  1202. package/src/registry/catalog-read.ts +0 -56
  1203. package/src/registry/deprecated.test.ts +0 -139
  1204. package/src/registry/deprecated.ts +0 -76
  1205. package/src/registry/docs.test.ts +0 -140
  1206. package/src/registry/docs.ts +0 -299
  1207. package/src/registry/edge/bundle.test.ts +0 -50
  1208. package/src/registry/edge/edge.test.ts +0 -176
  1209. package/src/registry/edge/edge.ts +0 -211
  1210. package/src/registry/edge/index.ts +0 -10
  1211. package/src/registry/edge/lambda-edge.ts +0 -127
  1212. package/src/registry/edge/sigv4-web.ts +0 -79
  1213. package/src/registry/edge/token-source.test.ts +0 -258
  1214. package/src/registry/edge/token-source.ts +0 -169
  1215. package/src/registry/edge/worker.ts +0 -61
  1216. package/src/registry/handler.ts +0 -89
  1217. package/src/registry/headers-file.ts +0 -61
  1218. package/src/registry/index.ts +0 -32
  1219. package/src/registry/mirror-paths.ts +0 -10
  1220. package/src/registry/mirror.test.ts +0 -198
  1221. package/src/registry/mirror.ts +0 -395
  1222. package/src/registry/proxies.test.ts +0 -153
  1223. package/src/registry/proxies.ts +0 -132
  1224. package/src/registry/reader.ts +0 -225
  1225. package/src/registry/registry.test.ts +0 -262
  1226. package/src/registry/semver.ts +0 -34
  1227. package/src/registry/serve.ts +0 -82
  1228. package/src/registry/source-forms.test.ts +0 -87
  1229. package/src/registry/source-forms.ts +0 -216
  1230. package/src/registry/targets/artifactory.test.ts +0 -248
  1231. package/src/registry/targets/artifactory.ts +0 -257
  1232. package/src/registry/targets/fake-artifactory.ts +0 -158
  1233. package/src/registry/targets/fake-gitlab.ts +0 -161
  1234. package/src/registry/targets/fake-hcp.ts +0 -233
  1235. package/src/registry/targets/fake-http.ts +0 -97
  1236. package/src/registry/targets/fake-nexus.ts +0 -152
  1237. package/src/registry/targets/gitlab.test.ts +0 -208
  1238. package/src/registry/targets/gitlab.ts +0 -223
  1239. package/src/registry/targets/hcp.test.ts +0 -230
  1240. package/src/registry/targets/hcp.ts +0 -360
  1241. package/src/registry/targets/hosted.ts +0 -117
  1242. package/src/registry/targets/index.ts +0 -17
  1243. package/src/registry/targets/module-target.ts +0 -131
  1244. package/src/registry/targets/nexus.test.ts +0 -220
  1245. package/src/registry/targets/nexus.ts +0 -314
  1246. package/src/registry/targets/zip.test.ts +0 -65
  1247. package/src/registry/targets/zip.ts +0 -287
  1248. package/src/registry/writer.ts +0 -155
  1249. package/src/report.test.ts +0 -423
  1250. package/src/report.ts +0 -752
  1251. package/src/search-build-roots.test.ts +0 -125
  1252. package/src/search-count.test.ts +0 -144
  1253. package/src/search-kind-type.test.ts +0 -136
  1254. package/src/serializer.test.ts +0 -26
  1255. package/src/serializer.ts +0 -26
  1256. package/src/signal-only-root.test.ts +0 -72
  1257. package/src/skills/chant-terraform.md +0 -92
  1258. package/src/state/azure-blob.ts +0 -8
  1259. package/src/state/backend-verdict.test.ts +0 -188
  1260. package/src/state/backend.test.ts +0 -129
  1261. package/src/state/backend.ts +0 -563
  1262. package/src/state/engine-env.test.ts +0 -18
  1263. package/src/state/exec.ts +0 -158
  1264. package/src/state/gcs.ts +0 -7
  1265. package/src/state/gitlab.test.ts +0 -226
  1266. package/src/state/gitlab.ts +0 -331
  1267. package/src/state/index.ts +0 -18
  1268. package/src/state/locks.test.ts +0 -84
  1269. package/src/state/locks.ts +0 -201
  1270. package/src/state/object-store.ts +0 -7
  1271. package/src/state/root-states-floci.e2e.test.ts +0 -66
  1272. package/src/state/root-states.test.ts +0 -462
  1273. package/src/state/root-states.ts +0 -309
  1274. package/src/state/s3.ts +0 -22
  1275. package/src/state/source.ts +0 -289
  1276. package/src/state/store.ts +0 -360
  1277. package/src/state/versions.test.ts +0 -365
  1278. package/src/state/versions.ts +0 -183
  1279. package/src/state-export-unlock.test.ts +0 -230
  1280. package/src/state-migration-backends.test.ts +0 -277
  1281. package/src/state-migration.test.ts +0 -236
  1282. package/src/state-migration.ts +0 -595
  1283. package/src/state-ops.test.ts +0 -182
  1284. package/src/state-ops.ts +0 -469
  1285. package/src/state-ownership.ts +0 -32
  1286. package/src/state-reads.ts +0 -134
  1287. package/src/template/__fixtures__/app-root.golden.tf +0 -25
  1288. package/src/template/index.ts +0 -17
  1289. package/src/template/render.test.ts +0 -230
  1290. package/src/template/render.ts +0 -352
  1291. package/src/terragrunt/affected.acceptance.test.ts +0 -83
  1292. package/src/terragrunt/affected.test.ts +0 -188
  1293. package/src/terragrunt/affected.ts +0 -350
  1294. package/src/terragrunt/capability.test.ts +0 -421
  1295. package/src/terragrunt/capability.ts +0 -446
  1296. package/src/terragrunt/index.ts +0 -15
  1297. package/src/terragrunt/mocks.acceptance.test.ts +0 -105
  1298. package/src/terragrunt/mocks.test.ts +0 -422
  1299. package/src/terragrunt/mocks.ts +0 -399
  1300. package/src/terragrunt/place.test.ts +0 -42
  1301. package/src/terragrunt/place.ts +0 -75
  1302. package/src/terragrunt/run.ts +0 -532
  1303. package/src/terragrunt/terragrunt.acceptance.test.ts +0 -122
  1304. package/src/terragrunt/terragrunt.test.ts +0 -332
  1305. package/src/terragrunt/units.ts +0 -260
  1306. package/src/terragrunt/wave.ts +0 -203
  1307. package/src/used-sources.test.ts +0 -75
  1308. package/src/used-sources.ts +0 -204
  1309. package/src/validate-cli.ts +0 -5
  1310. package/src/validate.ts +0 -37
  1311. package/src/workspace-kinds.test.ts +0 -36
  1312. /package/{src → dist}/generated/lexicon-terraform.json +0 -0
@@ -1,2484 +0,0 @@
1
- /**
2
- * terraform Op activities (#2086) — init, plan, apply and show against a root
3
- * module named in the project's `terraform.roots` config namespace (#2083).
4
- *
5
- * Shaped after `lexicons/k3s/src/op/activities/k3s.ts`: `promisify(exec)` with
6
- * the caller's `AbortSignal` forwarded so a local timeout or Ctrl-C kills the
7
- * child, and every command and environment string produced by a pure exported
8
- * function so a test can assert on it without running terraform.
9
- *
10
- * Two invariants hold for every call:
11
- *
12
- * - `TF_IN_AUTOMATION=1` is in the environment, which is what tells terraform
13
- * it is not talking to a person.
14
- * - `-input=false` is on every command that accepts it, so a missing variable
15
- * fails the step instead of blocking on a prompt nobody will answer.
16
- * `terraform show` is the one command that does not accept the flag
17
- * (terraform answers `flag provided but not defined: -input`), so it
18
- * carries the environment variable alone.
19
- *
20
- * `terraformApply` takes a saved plan file and nothing else on a stock root,
21
- * since a bare apply re-plans at apply time, which is exactly the gap an
22
- * approval gate exists to close, so it is refused rather than offered. On a
23
- * live root (#2103, `terraform.binary: "choudoufu"` plus a declared estate)
24
- * it is the opposite: choudoufu refuses a plan file by design, so
25
- * `terraformApply` refuses one there and runs a bare `apply -auto-approve`
26
- * instead.
27
- *
28
- * `choudoufuLivePlan`, `choudoufuLiveLs` and `choudoufuLiveCheck` (#2103) are
29
- * choudoufu-only activities living in this same module for the same reason
30
- * the four above do: pure command builders, the `promisify(exec)` shape, and
31
- * no dependency on the lexicon's HCL parse. `./live-detect.ts` is a
32
- * deliberately separate, cheap regex-based read of "does this root declare a
33
- * live estate," used only to decide how `terraformApply` reads a non-zero
34
- * exit and to
35
- * auto-detect `-estate` for the two live-only reads that need it; the
36
- * accurate, AST-based version lives in `../../hcl/parse.ts` and stays out of
37
- * this module's dependency graph. `choudoufu version` is checked once per
38
- * module load (`ensureChoudoufuVersion`) and refuses a binary older than
39
- * {@link MIN_CHOUDOUFU_VERSION}.
40
- */
41
-
42
- import { exec } from "node:child_process";
43
- import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
44
- import { tmpdir } from "node:os";
45
- import { promisify } from "node:util";
46
- import { resolve, dirname, join, relative, sep } from "node:path";
47
- import { loadChantConfigUpward } from "@intentius/chant/config";
48
- import { findWorkspaceRoot } from "@intentius/chant/project-root";
49
- import { liveReadKey, memoLiveRead } from "@intentius/chant/live-read-session";
50
- import { terraformPlanDigest } from "../../plan-digest";
51
- import { choudoufuSetPlanParts, plannerForBinary, terraformChangeSetPart } from "../../change-set";
52
- import type { ChangeSetPart } from "@intentius/chant/change-set";
53
- import type { TerraformConfig, TerraformRootConfig } from "../../config";
54
- import { detectLiveEstate } from "./live-detect";
55
- import { commandWords, currentCommandScope, scopedCommand, type TerraformCommand } from "../command-hook";
56
- import { backendConfigValues } from "../../backend-config";
57
- import { lockTimeoutArgs } from "../../lock-timeout";
58
- import { coneArgs, readPlanCone, type PlanCone } from "../../cone";
59
- import {
60
- parseAdoptionCommands,
61
- readAdoptionLedger,
62
- renderAdoptionLedger,
63
- type AdoptionCandidate,
64
- } from "../adoption";
65
-
66
- const execAsync = promisify(exec);
67
-
68
- /**
69
- * `terraform show -json` on a large estate runs to megabytes, well past
70
- * `exec`'s 1 MiB default, and the failure mode there is a truncated buffer
71
- * rather than a clear error.
72
- */
73
- const MAX_BUFFER = 64 * 1024 * 1024;
74
-
75
- /** Plan file written into the root directory when a step names none. */
76
- export const DEFAULT_PLAN_FILE = "chant.tfplan";
77
-
78
- /** Binary used when the `terraform` namespace records no preference. */
79
- export const DEFAULT_TERRAFORM_BINARY = "terraform";
80
-
81
- /** Where the {@link choudoufuLivePlan} Op activity writes GitHub issue #788's JSON document, relative to the root directory. */
82
- export const DEFAULT_LIVE_PLAN_DOCUMENT_FILE = "chant.live-plan.json";
83
-
84
- /**
85
- * choudoufu below this refuses. v0.12.0 brought `live-plan -json`, `live-ls`
86
- * and `live-check -json` (#2103); v0.13.0 brought the approval artifact
87
- * ([choudoufu #878](https://github.com/INTENTIUS/choudoufu/issues/878), PR
88
- * 889): under a live block `plan -out=FILE` is accepted and `apply FILE`
89
- * re-plans the live system and refuses on a mismatch with exit status 3.
90
- * v0.14.0 brought the `-json` document on a configuration that names its own
91
- * estate ([choudoufu #894](https://github.com/INTENTIUS/choudoufu/issues/894),
92
- * PR 915), which is the shape every chant live root has: before it,
93
- * {@link choudoufuLivePlan} could not produce the document for a real root at
94
- * all. v0.15.0 brought the document's `adoptable` section and the `swept`
95
- * list beside it
96
- * ([choudoufu #962](https://github.com/INTENTIUS/choudoufu/issues/962), PR
97
- * 963), which is the only place a content match reaches a machine: before it,
98
- * a declared resource whose identity the provider assigns could never be
99
- * adopted through the document at all, and `TerraformAdoptOp`'s own
100
- * acceptance suite had never passed on any binary (#2241).
101
- *
102
- * {@link terraformApply} depends on the exit-3 refusal, `describeResources()`
103
- * and both document-reading Ops depend on the document, and the adopt path
104
- * depends on the `adoptable` section, so the floor is the release that
105
- * shipped the last of the three.
106
- */
107
- export const MIN_CHOUDOUFU_VERSION = "0.15.0";
108
-
109
- /**
110
- * The choudoufu release a gated wave needs for a choudoufu root (#3459):
111
- * the set digest on `live-plan-set -json`, and `live-wave-apply` with its
112
- * resume file (choudoufu#1754, merged as choudoufu PR 1816 after v0.21.0).
113
- * choudoufu's changelog lists both under `v0.22.0 (Unreleased)`, so this is
114
- * the version main releases as.
115
- *
116
- * Only the wave path checks it, so plain `terraform` and `tofu` roots, and a
117
- * choudoufu root run any other way, do not wait on it. A dev build prints no
118
- * release version. For one, the check is the capability itself: a set plan
119
- * document without a top-level `digest` came from a choudoufu older than
120
- * choudoufu#1754, and {@link choudoufuPlanSet} refuses it.
121
- */
122
- export const MIN_CHOUDOUFU_WAVES_VERSION = "0.22.0";
123
-
124
- /**
125
- * The choudoufu release a composed run of estates needs (#4445): a root with
126
- * no `live` block that calls estate directories as modules, planned and
127
- * applied as one walk, with a `terraform_estate_outputs` read of another
128
- * estate in the run answered inside it (choudoufu#2059, first released in
129
- * v0.31.0). Only the composed estate run (`compose/estate.ts`) checks it;
130
- * below it the members plan wave by wave. A dev build names no release and
131
- * passes, as for the other floors.
132
- */
133
- export const MIN_CHOUDOUFU_ESTATES_VERSION = "0.31.0";
134
-
135
- /**
136
- * The choudoufu release whose `live-graph -json -from-plan=<file>` prints the
137
- * engine graph document (chant#4520's design section 4, choudoufu#2285), the
138
- * one `describeResources()` reads engine facts from on a live root
139
- * (chant#4528). choudoufu's changelog lists the command under
140
- * `v0.32.0 (Unreleased)`, so this is the version it releases as. The chant
141
- * side of the same contract, the first chant that writes those facts, is
142
- * `ENGINE_FACTS_FLOOR` in core's engine-facts.ts, which is NEXT_RELEASE
143
- * until the cut.
144
- *
145
- * Not a refusal. Facts are for people and never feed a decision, so a
146
- * choudoufu without the command (a usage error, see
147
- * {@link classifyLiveGraphFailure}) leaves `facts` absent with one note
148
- * naming this version, and the rest of the read is unchanged. The check is
149
- * the capability, not the version string: a local or dev build names a
150
- * version below this or none at all, and still carries the command.
151
- */
152
- export const MIN_CHOUDOUFU_GRAPH_VERSION = "0.32.0";
153
-
154
- /**
155
- * Where a choudoufu root's wave files live, relative to the project root:
156
- * `<root>/plan-set.json` (the set plan document chant planned and the
157
- * approver approved), `<root>/resume-<digest>.json` (choudoufu's resume
158
- * file) and `<root>/out/` (plan files and logs).
159
- */
160
- export const CHOUDOUFU_WAVES_DIR = ".chant/choudoufu-waves";
161
-
162
- /** `live-wave-apply`'s exit statuses (choudoufu#1754). */
163
- export const CHOUDOUFU_WAVE_EXIT = { landed: 0, error: 1, setMoved: 3, rootFailed: 4 } as const;
164
-
165
- /**
166
- * choudoufu's own refusal summary for `-out` on the `live-plan -estate`
167
- * surface (`internal/command/live_mode.go`). That is the one surface where a
168
- * saved plan file is still refused: a directory reached through `-estate` has
169
- * no `live` block, so plain `plan` and `apply` there are ordinary state-backed
170
- * commands and a file written from this form would be applied by something
171
- * that never heard of the estate. Under a `live` block `plan -out` is
172
- * accepted (choudoufu #878).
173
- */
174
- export const CHOUDOUFU_LIVE_PLAN_OUT_REFUSAL =
175
- "Saved plan files are not available under live resource markers";
176
-
177
- /** Exit status choudoufu's approval refusals carry: not 1 (any ordinary failure), not 2 (`-detailed-exitcode`). */
178
- export const CHOUDOUFU_APPROVAL_EXIT_CODE = 3;
179
-
180
- /** Summary line of choudoufu's refusal when the fresh live plan differs from the approved plan file. */
181
- export const CHOUDOUFU_APPROVAL_MISMATCH_REFUSAL = "The approved plan no longer matches the live system";
182
-
183
- /** Summary line of choudoufu's sibling refusal when the plan file was produced against another estate. */
184
- export const CHOUDOUFU_WRONG_ESTATE_REFUSAL = "The approved plan belongs to a different estate";
185
-
186
- // ── Args and results ────────────────────────────────────────────────────────
187
-
188
- /** Fields every activity here takes: which root, and where the project is. */
189
- export interface TerraformRootArgs {
190
- /**
191
- * Key into `terraform.roots`. Not a directory — the directory, workspace,
192
- * var files and backend config all come from the named entry, so an Op step
193
- * cannot drift from what the project declared.
194
- */
195
- root: string;
196
- /**
197
- * Directory to start the `chant.config.*` search from. Default:
198
- * `process.cwd()`, which is the project root under `chant run`.
199
- */
200
- cwd?: string;
201
- /**
202
- * The directory the root's files are read from in place of the entry's
203
- * `dir`, relative to the project root (chant#4542). A promote or rollback
204
- * under a release sets it to the release's recorded copy of the root; the
205
- * entry's workspace, var files, backend config and estate still apply, and
206
- * its var files and backend-config files resolve against this directory.
207
- *
208
- * With no `terraform.roots` entry named `root`, a `dir` names the root's
209
- * directory itself (chant#4842): the root plans there with the namespace's
210
- * binary and no workspace, var files or backend config of an entry.
211
- */
212
- dir?: string;
213
- /**
214
- * Environment variables every command for the root runs with, over the
215
- * job's and the root's own (`TF_WORKSPACE`), such as a role's credentials
216
- * (chant#4842). An op wave's run hook gives them per run through
217
- * `DeployContext.processEnv`.
218
- */
219
- env?: Record<string, string>;
220
- /**
221
- * The workspace the root runs in, in place of its entry's (chant#4854),
222
- * created when the backend does not list it yet. `terraformInit` inits in
223
- * `default`, which every backend has, then runs `workspace select
224
- * -or-create=true <workspace>` with `TF_WORKSPACE` unset, since init
225
- * refuses a selected workspace the backend does not list. Every other
226
- * command runs with `TF_WORKSPACE` set to it, over `env`. An entry's own
227
- * `workspace` keeps its old behaviour: `TF_WORKSPACE` on every command,
228
- * init included, and nothing created.
229
- */
230
- workspace?: string;
231
- /**
232
- * The binary to run, a name on `PATH` or a path, in place of
233
- * `terraform.binary` (terragucci issue 1303): a root that pins its own
234
- * release. Absent: `terraform.binary`.
235
- */
236
- binary?: string;
237
- }
238
-
239
- export interface TerraformInitArgs extends TerraformRootArgs {
240
- /** `-upgrade`: re-resolve provider and module versions within constraints. */
241
- upgrade?: boolean;
242
- /** `-reconfigure`: ignore any existing backend state and configure afresh. */
243
- reconfigure?: boolean;
244
- }
245
-
246
- export interface TerraformPlanArgs extends TerraformRootArgs {
247
- /** Plan file to write, relative to the root directory. Default: {@link DEFAULT_PLAN_FILE}. */
248
- planFile?: string;
249
- /** `-destroy`: plan the removal of everything the root manages. */
250
- destroy?: boolean;
251
- /**
252
- * Input variables, passed as `-var` after the root's `-var-file`s, so they
253
- * win over a var file that sets the same name (#3049). A string goes as it
254
- * is; anything else as JSON, which terraform reads as HCL for a list, a map
255
- * or an object. This is how a value another root produced, wired with
256
- * `stackOutput()`, reaches the plan.
257
- */
258
- vars?: Record<string, unknown>;
259
- /**
260
- * Resource addresses to plan alone, each passed as `-target` (#4300). The
261
- * saved plan then holds only these and what they depend on, so the apply
262
- * of that file changes nothing else.
263
- */
264
- targets?: string[];
265
- /**
266
- * `false` skips `show -no-color`, the human-readable render (#4479). The
267
- * plan then runs one `show` process, `show -json`, whose document gives the
268
- * digest, the change set and everything a caller derives from `json`, and
269
- * {@link TerraformPlanResult.text} is `""`. For a caller that never reads
270
- * the text, such as the `terraform-apply` capability. Default: `true`.
271
- */
272
- text?: boolean;
273
- /**
274
- * How long the plan waits for another run's state lock (#4545), passed as
275
- * `-lock-timeout` unless `TF_CLI_ARGS` or `TF_CLI_ARGS_plan` names one.
276
- * Default: no flag, terraform's own (no wait).
277
- */
278
- lockTimeout?: string;
279
- /**
280
- * choudoufu only (#4545): plan the cone of the change since this revision
281
- * (`-cone=<base>`) on a root under a `live` block that is not an estate
282
- * file. Any other root, binary, or a plan with `targets` or `destroy`,
283
- * plans in full. {@link TerraformPlanResult.cone} says which it was.
284
- */
285
- cone?: string;
286
- }
287
-
288
- export interface TerraformApplyArgs extends TerraformRootArgs {
289
- /**
290
- * The saved plan file to apply, relative to the root directory, normally
291
- * `plan.out.planFile`, the Plan step's own output. Required: this activity
292
- * applies a saved plan and has no bare-apply mode, on either kind of root.
293
- *
294
- * On a live root this file is the approval artifact
295
- * [choudoufu #878](https://github.com/INTENTIUS/choudoufu/issues/878) asked
296
- * for, in the stock form choudoufu v0.13.0 shipped (PR 889). `plan -out`
297
- * writes stock's own plan file; `apply <planfile>` never replays it, and
298
- * never reads it as prior state or as an ownership answer. It re-plans
299
- * against the live system the way every live-markers run does, then
300
- * compares its fresh plan with the file's, down to the planned values, and
301
- * refuses with exit status 3 when they differ. So the seam #2106 left named
302
- * and unused on these args is now this field itself, and there is nothing
303
- * separate to pass.
304
- */
305
- planFile?: string;
306
- /** How long the apply waits for another run's state lock (#4545), as {@link TerraformPlanArgs.lockTimeout}. */
307
- lockTimeout?: string;
308
- }
309
-
310
- export interface TerraformShowArgs extends TerraformRootArgs {
311
- /** Show this saved plan file. Omitted, the activity shows current state. */
312
- planFile?: string;
313
- }
314
-
315
- export interface ChoudoufuLivePlanArgs extends TerraformRootArgs {
316
- /**
317
- * The estate whose ownership markers this run looks for (`-estate`).
318
- * Omitted, it is auto-detected from the root's `live` block or
319
- * `estate.chdf.hcl` sidecar, the same estate the root's own configuration
320
- * declares, which is what a live root's every other activity assumes too.
321
- */
322
- estate?: string;
323
- /**
324
- * Render the human half as choudoufu's adoption ledger (`-adoption-only`)
325
- * instead of the ordinary plan (#2105).
326
- *
327
- * This activity already makes two live reads, one for the `-json` document
328
- * and one for the human render, because the document carries no rendering of
329
- * the plan itself. This flag changes only the second of them, which is what
330
- * makes it possible at all: choudoufu refuses `-adoption-only` and `-json` on
331
- * one invocation ("this run cannot produce both reports at once"), so the two
332
- * reports have to come from two runs whether or not chant wants both. The
333
- * cost is that the second read asks the estate-wide sweep the account-bounded
334
- * question ("which live resources carry no ownership marker at all"), so it
335
- * is slower than the ordinary render, not faster.
336
- *
337
- * Since #2241 the flag also puts `TOFU_LIVE_COLLECT_UNCLAIMED=1` on the
338
- * `-json` run, so the document carries the same sweep's answer as its
339
- * `adoptable` and `swept` sections rather than only the render carrying it.
340
- * That is what an adoption reads: the render's rows are prose, and the
341
- * document's are addresses, marker values and a tagging command.
342
- */
343
- adoptionOnly?: boolean;
344
- }
345
-
346
- export interface ChoudoufuLiveLsArgs extends TerraformRootArgs {
347
- /** The estate to list (`-estate`). Omitted, auto-detected the same way {@link ChoudoufuLivePlanArgs.estate} is. */
348
- estate?: string;
349
- /** `-consistent`: poll past the Resource Groups Tagging API's eventual-consistency window. */
350
- consistent?: boolean;
351
- }
352
-
353
- export type ChoudoufuLiveCheckArgs = TerraformRootArgs;
354
-
355
- export interface ChoudoufuAdoptArgs extends TerraformRootArgs {
356
- /**
357
- * The adoptable matches to claim, normally `ledger.out.adoptions` from a
358
- * {@link choudoufuLivePlan} step run with `adoptionOnly`. Each carries the
359
- * two marker values and, where choudoufu printed one, the tagging command
360
- * that writes them.
361
- */
362
- adoptions: AdoptionCandidate[];
363
- /**
364
- * The contested candidates the same ledger refused, normally
365
- * `ledger.out.contested`. Passed in so the Op's result names what was not
366
- * adopted and why, beside what was; nothing here is ever written.
367
- */
368
- contested?: AdoptionCandidate[];
369
- }
370
-
371
- /** What {@link terraformInit} resolved. */
372
- export interface TerraformInitResult {
373
- /** Absolute path of the root module directory that was initialized. */
374
- dir: string;
375
- /** Workspace the run selected via `TF_WORKSPACE`, when the root names one. */
376
- workspace?: string;
377
- /**
378
- * The root module directory relative to the chant workspace root, with `/`
379
- * separators (chant#4482), when the root sits inside a workspace. A
380
- * TerraformApplyOp publishes it as the `TerraformRootPath` run outcome, so a
381
- * ledger read can name the member whose directory holds the root it applied.
382
- */
383
- rootPath?: string;
384
- }
385
-
386
- /** Counts projected out of a plan's `resource_changes`. */
387
- export interface PlanChangeCounts {
388
- /** Resources to create. A replace counts here and in `destroys`, as terraform's own summary does. */
389
- adds: number;
390
- /** Resources to update in place. */
391
- changes: number;
392
- /** Resources to destroy. This is the number an approval gate exists for. */
393
- destroys: number;
394
- }
395
-
396
- export { terraformPlanChangeSet, terraformPlanDigest, type TerraformPlannedChange } from "../../plan-digest";
397
-
398
- /** What {@link terraformPlan} resolved. Carries the plan itself, so no later step re-plans. */
399
- export interface TerraformPlanResult extends PlanChangeCounts {
400
- /** `true` when terraform reported exit 2 under `-detailed-exitcode`: the plan proposes changes. */
401
- changed: boolean;
402
- /** The written plan file, relative to `dir` — hand this straight to {@link terraformApply}. */
403
- planFile: string;
404
- /** Absolute path of the root module directory. */
405
- dir: string;
406
- /** `terraform show -json <planFile>`, parsed. */
407
- json: unknown;
408
- /** `terraform show -no-color <planFile>` — the human-readable plan. `""` when the plan ran with `text: false`. */
409
- text: string;
410
- /**
411
- * This plan's identity (#2300) — {@link terraformPlanDigest} over
412
- * {@link TerraformPlanResult.json}. Hand it to a gate step's `plan` so the
413
- * approval binds to this plan and not to the next run: `gate(name, { plan:
414
- * plan.out.planDigest })`.
415
- */
416
- planDigest: string;
417
- /**
418
- * This root's part of a change-set document (#3181): every proposed change
419
- * as an entry, the root's name as the member, and {@link planDigest} as the
420
- * member's plan digest. Hand the parts of a run's roots to
421
- * `composeChangeSet` and bind the run's gate to the document's digest.
422
- */
423
- changeSet: ChangeSetPart;
424
- /** Set when the plan was asked for a cone (#4545): the cone it planned, or why it planned the whole estate. */
425
- cone?: PlanCone;
426
- }
427
-
428
- /**
429
- * Why a live apply refused the approval artifact it was handed. Both are
430
- * choudoufu's exit status 3, which is neither 1 (any ordinary failure, which
431
- * a pipeline must not route back to a reviewer) nor `-detailed-exitcode`'s 2.
432
- *
433
- * - `"approval-mismatch"`: the fresh live plan's change set or planned
434
- * values differ from the approved file's.
435
- * - `"wrong-estate"`: the file was produced from a configuration naming
436
- * another estate.
437
- */
438
- export type TerraformApprovalRefusal = "approval-mismatch" | "wrong-estate";
439
-
440
- /** What {@link terraformApply} resolved. */
441
- export interface TerraformApplyResult {
442
- /** The plan file that was applied, or that was refused. */
443
- planFile?: string;
444
- /** Absolute path of the root module directory. */
445
- dir: string;
446
- /** `true` when the plan was applied. `false` exactly when {@link refused} is set. */
447
- applied: boolean;
448
- /**
449
- * Set when a live apply refused the approval artifact (choudoufu exit 3).
450
- * This is a result, not a thrown error, so a workflow can route the run
451
- * back to review instead of treating it as a broken step.
452
- */
453
- refused?: TerraformApprovalRefusal;
454
- /** choudoufu's own refusal text, verbatim, when {@link refused} is set. */
455
- refusal?: string;
456
- }
457
-
458
- /** Counts projected out of `live-plan -json`'s `unowned` and `adoptable` sections. */
459
- export interface LivePlanUnownedCounts {
460
- /**
461
- * `unowned[]`'s length: live resources sitting at an identity this
462
- * configuration declares, carrying no ownership marker for this estate.
463
- */
464
- unowned: number;
465
- /**
466
- * Every live resource this run could claim with a tag write, from both
467
- * sections: the `unowned[]` rows choudoufu offered marker values for, plus
468
- * the `adoptable[]` rows the estate-wide sweep content-matched to a
469
- * declaration that carries no identity of its own (choudoufu #962). Those
470
- * two sections are disjoint, so this is a sum and never a double count.
471
- * `adoptable[]` is populated only on an adoption run (#2241), so an
472
- * observation read's document contributes nothing to it.
473
- */
474
- adoptable: number;
475
- }
476
-
477
- /**
478
- * What {@link choudoufuLivePlan} resolved. `adds`/`changes`/`destroys` (#2106,
479
- * {@link PlanChangeCounts}) are parsed off the human-readable render's own
480
- * "Plan: N to add, N to change, N to destroy." summary line
481
- * ({@link parseChoudoufuPlanSummary}), not off GitHub issue #788's JSON
482
- * document: that document is deliberately scoped to the three sections a
483
- * stock plan's `-json` has no notion of at all (`bound`, `omissions`,
484
- * `unowned`; `internal/command/views/live_plan.go`'s own `LivePlanDocument`
485
- * doc comment says as much — "the stock plan's -json...can stay separate")
486
- * and carries no resource-change diff of its own. The ordinary create/change/
487
- * destroy diff — including the delete choudoufu's own `undeclared_tagged`
488
- * quadrant folds into it for an orphaned marked resource, per that same
489
- * file's `StatelessRemoval` doc comment ("the plan's own resource diff
490
- * carries the destroy itself for those") — renders only in the human form,
491
- * the same summary line a stock `terraform plan` prints
492
- * (`internal/command/views/operation_test.go`'s own fixtures confirm the
493
- * exact wording), which is why the human run's text, already fetched here for
494
- * the approver to read, is what this activity parses instead of the JSON.
495
- */
496
- export interface ChoudoufuLivePlanResult extends LivePlanUnownedCounts, PlanChangeCounts {
497
- /** `true` when `-detailed-exitcode` reported exit 2: the live plan proposes changes. */
498
- drift: boolean;
499
- /**
500
- * GitHub issue #788's JSON document (`bound`, `omissions`, `unowned`, and
501
- * since choudoufu v0.15.0 `adoptable` and `swept`), captured whole.
502
- */
503
- json: unknown;
504
- /**
505
- * The human-readable plan, from a second `live-plan` run without `-json`
506
- * (the document carries no render of it) — or, under
507
- * {@link ChoudoufuLivePlanArgs.adoptionOnly}, choudoufu's own adoption ledger.
508
- */
509
- text: string;
510
- /**
511
- * chant's rendering of the adoption ledger over the `-json` document
512
- * (#2105): one line per adoptable match with its address, its live identity
513
- * and the two marker values, then any contested address, listed and never
514
- * offered. Present on every run, `-adoption-only` or not, since it is a
515
- * projection of the document rather than a second report.
516
- */
517
- ledger: string;
518
- /**
519
- * What a finding mode posts: {@link ChoudoufuLivePlanResult.text} and then
520
- * {@link ChoudoufuLivePlanResult.ledger}. The one field an issue or PR body
521
- * references, so that the JSON document has no path into a body at all.
522
- */
523
- finding: string;
524
- /** Adoptable matches: exactly one live resource at the declared address, with the marker pair that claims it. */
525
- adoptions: AdoptionCandidate[];
526
- /** Every candidate at a declared address more than one live resource sits at. Never adoptable. */
527
- contested: AdoptionCandidate[];
528
- /** How many declared addresses are contested — the count `contested` above spells out. */
529
- ambiguous: number;
530
- /**
531
- * `swept[]`: the resource types the estate-wide sweep listed in full on this
532
- * run. Empty on any run that did not ask for the sweep, which is every run
533
- * without {@link ChoudoufuLivePlanArgs.adoptionOnly}, so an empty
534
- * `adoptions` beside an empty `swept` means the question was never put.
535
- */
536
- swept: string[];
537
- /** Absolute path of the root module directory. */
538
- dir: string;
539
- /** Where the JSON document was written, relative to `dir`; {@link DEFAULT_LIVE_PLAN_DOCUMENT_FILE} unless overridden. */
540
- documentPath: string;
541
- /** The estate this plan ran against. */
542
- estate: string;
543
- }
544
-
545
- /** What {@link choudoufuLiveLs} resolved. */
546
- export interface ChoudoufuLiveLsResult {
547
- /** The `-json` listing, parsed: every resource the account holds under the estate. */
548
- json: unknown;
549
- /** Absolute path of the root module directory (`live-ls` needs no configuration, but this activity still runs in it). */
550
- dir: string;
551
- /** The estate that was listed. */
552
- estate: string;
553
- }
554
-
555
- /** One adoption {@link choudoufuAdopt} declined, with the reason an operator acts on. */
556
- export interface AdoptionRefusal {
557
- /** The declared instance address that was not claimed. */
558
- addr: string;
559
- /** The live resource's identity, when the refusal is about a particular one. */
560
- identity: string;
561
- /** Why, in a sentence, always naming the two marker values a hand-write would need. */
562
- reason: string;
563
- }
564
-
565
- /** What {@link choudoufuAdopt} resolved. */
566
- export interface ChoudoufuAdoptResult {
567
- /**
568
- * How the markers were written. Only `"tag-write"` today; the field exists
569
- * because #2105 weighed a second mechanism (choudoufu's `adopt` policy verb)
570
- * and a later run of this activity should say which one it used rather than
571
- * leave a reader to infer it from the absence of a field. See the activity's
572
- * own doc for why the policy verb is not reachable from outside the
573
- * configuration.
574
- */
575
- mechanism: "tag-write";
576
- /** The declared addresses whose live resources now carry this estate's markers. */
577
- adopted: string[];
578
- /** `adopted.length`, as a scalar an outcome attribute can carry. */
579
- adoptedCount: number;
580
- /** Every candidate this run declined, contested addresses included, with the reason. */
581
- refused: AdoptionRefusal[];
582
- /** How many declared addresses were contested — never adopted, always reported. */
583
- ambiguous: number;
584
- /** Absolute path of the root module directory. */
585
- dir: string;
586
- }
587
-
588
- /** What {@link choudoufuLiveCheck} resolved. */
589
- export interface ChoudoufuLiveCheckResult {
590
- /** `true` when the configuration is refused under live resource markers (a non-zero exit). */
591
- refused: boolean;
592
- /** GitHub issue #790's declared roster, parsed, when the output could be parsed as JSON. */
593
- json: unknown;
594
- /** The raw `-json` output. */
595
- text: string;
596
- /** Absolute path of the root module directory. */
597
- dir: string;
598
- }
599
-
600
- /** What {@link terraformShow} resolved. */
601
- export interface TerraformShowResult extends PlanChangeCounts {
602
- /** Whether the output describes a saved plan or current state. */
603
- source: "plan" | "state";
604
- /** The `-json` output, parsed. */
605
- json: unknown;
606
- /** The `-no-color` output. */
607
- text: string;
608
- /** Absolute path of the root module directory. */
609
- dir: string;
610
- /** Present when `source` is `"plan"`. */
611
- planFile?: string;
612
- }
613
-
614
- // ── Pure command and environment builders ───────────────────────────────────
615
-
616
- /**
617
- * Quote a command-line argument for the shell `exec` runs it through, leaving
618
- * ordinary paths and `key=value` pairs untouched so command strings stay
619
- * readable in logs and in tests.
620
- */
621
- export function quoteArg(value: string): string {
622
- return /^[A-Za-z0-9._/:=@,+-]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
623
- }
624
-
625
- /** Which CLI drives the roots: `terraform.binary`, defaulting to `terraform`. */
626
- export function terraformBinary(config?: TerraformConfig): string {
627
- return config?.binary ?? DEFAULT_TERRAFORM_BINARY;
628
- }
629
-
630
- /**
631
- * Environment for every invocation. `TF_IN_AUTOMATION` suppresses the
632
- * "run terraform apply next" hand-holding and is terraform's own signal that
633
- * no human is watching; `TF_WORKSPACE` is how a workspace gets selected
634
- * without a separate `terraform workspace select` round-trip.
635
- */
636
- export function terraformEnvironment(root?: Pick<TerraformRootConfig, "workspace">): Record<string, string> {
637
- return {
638
- TF_IN_AUTOMATION: "1",
639
- ...(root?.workspace ? { TF_WORKSPACE: root.workspace } : {}),
640
- // chant#4842: the run's own environment, which resolveRoot ties to the root it resolved.
641
- ...(root ? rootProcessEnv.get(root) : undefined),
642
- // chant#4854: a workspace the step names wins over the run's environment.
643
- ...(root && rootOwnWorkspace.has(root) ? { TF_WORKSPACE: rootOwnWorkspace.get(root)! } : {}),
644
- };
645
- }
646
-
647
- /** The `env` a root was resolved with (chant#4842), by the resolved root's entry, so every command run for it gets it. */
648
- const rootProcessEnv = new WeakMap<object, Record<string, string>>();
649
-
650
- /** The workspace a root was resolved with (chant#4854, `TerraformRootArgs.workspace`), which init selects or creates. */
651
- const rootOwnWorkspace = new WeakMap<object, string>();
652
-
653
- /** `<binary> workspace select -or-create=true <workspace>` (chant#4854): select the workspace, creating it when the backend does not list it. */
654
- export function terraformWorkspaceSelectCommand(opts: { binary: string; workspace: string }): string {
655
- return `${opts.binary} workspace select -or-create=true ${quoteArg(opts.workspace)}`;
656
- }
657
-
658
- /**
659
- * `terraform init`, with the root's `backendConfigFiles` as
660
- * `-backend-config=<path>` flags and then its `backendConfig` as
661
- * `-backend-config=k=v` flags (chant#4459): init applies later flags over
662
- * earlier ones, so a pair overrides a file. A path is passed as written; init
663
- * runs in the root's directory, which a relative one resolves against.
664
- */
665
- export function terraformInitCommand(opts: {
666
- binary: string;
667
- backendConfig?: Record<string, string>;
668
- backendConfigFiles?: readonly string[];
669
- upgrade?: boolean;
670
- reconfigure?: boolean;
671
- }): string {
672
- const parts = [opts.binary, "init", "-input=false"];
673
- if (opts.upgrade) parts.push("-upgrade");
674
- if (opts.reconfigure) parts.push("-reconfigure");
675
- for (const value of backendConfigValues(opts)) parts.push(`-backend-config=${quoteArg(value)}`);
676
- return parts.join(" ");
677
- }
678
-
679
- /**
680
- * `terraform plan`. `-detailed-exitcode` is what makes the run answerable:
681
- * 0 means no changes, 2 means changes, and anything else is a failure. See
682
- * {@link terraformPlan}.
683
- */
684
- export function terraformPlanCommand(opts: {
685
- binary: string;
686
- planFile: string;
687
- varFiles?: string[];
688
- vars?: Record<string, unknown>;
689
- destroy?: boolean;
690
- targets?: string[];
691
- /** Extra flags after the fixed ones (#4545): `-lock-timeout`, `-cone`. */
692
- extra?: readonly string[];
693
- }): string {
694
- const parts = [opts.binary, "plan", "-input=false", "-detailed-exitcode"];
695
- if (opts.destroy) parts.push("-destroy");
696
- for (const flag of opts.extra ?? []) parts.push(quoteArg(flag));
697
- for (const target of [...new Set(opts.targets ?? [])].sort()) parts.push(`-target=${quoteArg(target)}`);
698
- for (const varFile of opts.varFiles ?? []) parts.push(`-var-file=${quoteArg(varFile)}`);
699
- for (const [name, value] of Object.entries(opts.vars ?? {}).sort(([a], [b]) => a.localeCompare(b))) {
700
- if (value === undefined) continue;
701
- parts.push(`-var=${quoteArg(`${name}=${typeof value === "string" ? value : JSON.stringify(value)}`)}`);
702
- }
703
- parts.push(`-out=${quoteArg(opts.planFile)}`);
704
- return parts.join(" ");
705
- }
706
-
707
- /**
708
- * `terraform apply <planFile>` — a saved plan, never a bare apply. The same
709
- * command on a live root: choudoufu v0.13.0 admits a plan file under a `live`
710
- * block, and a matched one applies without re-prompting, exactly as stock's
711
- * own `apply <planfile>` does, so no `-auto-approve` is needed or passed.
712
- */
713
- export function terraformApplyCommand(opts: { binary: string; planFile: string; extra?: readonly string[] }): string {
714
- const extra = (opts.extra ?? []).map((f) => ` ${quoteArg(f)}`).join("");
715
- return `${opts.binary} apply -input=false${extra} ${quoteArg(opts.planFile)}`;
716
- }
717
-
718
- /**
719
- * `live-plan -detailed-exitcode [-json] [-estate=<estate>]`. `-json` is what
720
- * prints GitHub issue #788's document instead of the plan; the human render
721
- * needs a second invocation without it (see {@link choudoufuLivePlan}).
722
- *
723
- * `estate` is omitted exactly when the configuration names its own estate.
724
- * choudoufu refuses `-estate` beside a `live` block or an `estate.chdf.hcl`
725
- * sidecar ("Estate named by both the live block and -estate"), and since
726
- * v0.14.0 it does not need one: the run reads the declared name itself and
727
- * prints the same document ([choudoufu #894](https://github.com/INTENTIUS/choudoufu/issues/894),
728
- * PR 915). The flag is still how a root that declares nothing names an
729
- * estate for the run.
730
- *
731
- * `adoptionOnly` makes that second invocation print the adoption ledger and
732
- * nothing else (GitHub issue #587). It is refused here alongside `json`
733
- * because choudoufu refuses the pair itself, and a builder that emitted a
734
- * command the binary rejects would move the error to the far side of a
735
- * process spawn for no gain.
736
- */
737
- export function choudoufuLivePlanCommand(opts: {
738
- binary: string;
739
- estate?: string;
740
- json: boolean;
741
- adoptionOnly?: boolean;
742
- noColor?: boolean;
743
- }): string {
744
- if (opts.json && opts.adoptionOnly) {
745
- throw new Error(
746
- "choudoufuLivePlanCommand: -adoption-only and -json cannot be combined. choudoufu refuses the pair " +
747
- "(-adoption-only asks for the adoption ledger and -json asks for the bound/omissions/unowned " +
748
- "document), so the two reports come from two runs.",
749
- );
750
- }
751
- const parts = [opts.binary, "live-plan", "-detailed-exitcode"];
752
- if (opts.json) parts.push("-json");
753
- if (opts.adoptionOnly) parts.push("-adoption-only");
754
- if (opts.noColor) parts.push("-no-color");
755
- if (opts.estate !== undefined) parts.push(`-estate=${quoteArg(opts.estate)}`);
756
- return parts.join(" ");
757
- }
758
-
759
- /**
760
- * `live-graph -json -from-plan=<file> [-estate=<estate>]` (choudoufu#2285).
761
- * No `DIR` argument: like {@link choudoufuLiveCheckCommand}, the activity
762
- * runs in the root directory, which is DIR's default. `-estate` follows
763
- * {@link choudoufuLivePlanCommand}'s rule: only for a root that does not
764
- * name its own estate. `-history` is never passed: record versions take a
765
- * listing per record and `s3:ListBucketVersions`, and an observation read
766
- * has no use for them (the #4520 ruling, Q6: opt-in).
767
- */
768
- export function choudoufuLiveGraphCommand(opts: { binary: string; fromPlan: string; estate?: string }): string {
769
- const parts = [opts.binary, "live-graph", "-json", `-from-plan=${quoteArg(opts.fromPlan)}`];
770
- if (opts.estate !== undefined) parts.push(`-estate=${quoteArg(opts.estate)}`);
771
- return parts.join(" ");
772
- }
773
-
774
- /**
775
- * Whether a failed `live-graph` run is a choudoufu that has no such command
776
- * or flag (`"unsupported"`), or a real failure (`"failed"`). Older builds
777
- * answer an unknown command two ways: the new CLI prints `OpenTofu has no
778
- * command named "live-graph"` and exits 1 (cmd/choudoufu/command_main.go),
779
- * and the older mitchellh/cli path prints its usage and exits 127. A build
780
- * whose `live-graph` predates `-from-plan` fails the flag parse with `flag
781
- * provided but not defined`.
782
- */
783
- export function classifyLiveGraphFailure(code: unknown, output: string): "unsupported" | "failed" {
784
- if (code === 127) return "unsupported";
785
- if (/no command named "?live-graph"?/i.test(output)) return "unsupported";
786
- if (/flag provided but not defined: -(?:from-plan|json|estate)\b/.test(output)) return "unsupported";
787
- return "failed";
788
- }
789
-
790
- /** `live-ls -estate=<estate> -json [-consistent]`. */
791
- export function choudoufuLiveLsCommand(opts: { binary: string; estate: string; consistent?: boolean }): string {
792
- const parts = [opts.binary, "live-ls", `-estate=${quoteArg(opts.estate)}`, "-json"];
793
- if (opts.consistent) parts.push("-consistent");
794
- return parts.join(" ");
795
- }
796
-
797
- /**
798
- * `live-check -json`. No `DIR` argument: the activity already runs in the
799
- * root directory (`cwd`), so `-json` alone checks it, since DIR defaults to
800
- * `.`. Makes no cloud calls; a non-zero exit is a refusal, not a failure this
801
- * builder's caller need distinguish from one.
802
- */
803
- export function choudoufuLiveCheckCommand(opts: { binary: string }): string {
804
- return `${opts.binary} live-check -json`;
805
- }
806
-
807
- /**
808
- * Project `live-plan -json`'s `unowned` section into counts: how many live
809
- * resources at a declared identity carry no ownership marker for this
810
- * estate, and of those, how many an exact content match makes adoptable
811
- * (`adopt_tofu_estate`/`adopt_tofu_address` present).
812
- */
813
- export function countLivePlanUnowned(document: unknown): LivePlanUnownedCounts {
814
- const doc = (document ?? {}) as { unowned?: unknown; adoptable?: unknown };
815
- const unowned = Array.isArray(doc.unowned) ? doc.unowned : [];
816
- const claimable = (entry: unknown): boolean => {
817
- const e = entry as { adopt_tofu_estate?: unknown; adopt_tofu_address?: unknown } | null | undefined;
818
- return Boolean(e?.adopt_tofu_estate || e?.adopt_tofu_address);
819
- };
820
- const matched = Array.isArray(doc.adoptable) ? doc.adoptable.filter(claimable).length : 0;
821
- return { unowned: unowned.length, adoptable: unowned.filter(claimable).length + matched };
822
- }
823
-
824
- /**
825
- * `terraform show`. The one command here that takes no `-input` flag
826
- * (terraform answers `flag provided but not defined: -input`), so automation
827
- * rests on `TF_IN_AUTOMATION` alone. Show reads an artifact and prompts for
828
- * nothing in the first place.
829
- */
830
- export function terraformShowCommand(opts: { binary: string; json: boolean; planFile?: string }): string {
831
- const parts = [opts.binary, "show", opts.json ? "-json" : "-no-color"];
832
- if (opts.planFile) parts.push(quoteArg(opts.planFile));
833
- return parts.join(" ");
834
- }
835
-
836
- /**
837
- * Project a plan's `resource_changes` into add/change/destroy counts, the same
838
- * three terraform prints at the end of a plan. A replace (`["delete","create"]`)
839
- * counts as one add and one destroy, exactly as terraform reports it.
840
- */
841
- export function countPlanChanges(planJson: unknown): PlanChangeCounts {
842
- const counts: PlanChangeCounts = { adds: 0, changes: 0, destroys: 0 };
843
- const changes = (planJson as { resource_changes?: unknown } | null | undefined)?.resource_changes;
844
- if (!Array.isArray(changes)) return counts;
845
- for (const entry of changes) {
846
- const actions = (entry as { change?: { actions?: unknown } } | null | undefined)?.change?.actions;
847
- if (!Array.isArray(actions)) continue;
848
- if (actions.includes("create")) counts.adds++;
849
- if (actions.includes("update")) counts.changes++;
850
- if (actions.includes("delete")) counts.destroys++;
851
- }
852
- return counts;
853
- }
854
-
855
- /**
856
- * Parse the ordinary "Plan: N to add, N to change, N to destroy." (or "...N
857
- * to import, N to add...") summary line out of a human-readable `live-plan`
858
- * render (#2106). "No changes." — the exit-0 case — matches nothing and
859
- * reads as zero on every count, the same conservative default
860
- * {@link countPlanChanges} falls back to on a shape it does not recognize.
861
- */
862
- export function parseChoudoufuPlanSummary(text: string): PlanChangeCounts {
863
- const match = /Plan:\s*(?:\d+\s+to import,\s*)?(\d+)\s+to add,\s*(\d+)\s+to change,\s*(\d+)\s+to destroy\./.exec(
864
- text,
865
- );
866
- if (!match) return { adds: 0, changes: 0, destroys: 0 };
867
- return { adds: Number(match[1]), changes: Number(match[2]), destroys: Number(match[3]) };
868
- }
869
-
870
- // ── choudoufu version check ─────────────────────────────────────────────────
871
-
872
- /**
873
- * Parse a semver-ish string's leading `major.minor.patch`, ignoring anything
874
- * after (a `-dev`/`-rc1` suffix, say). Unparseable input reads as `0.0.0`,
875
- * which sorts as "older than everything" rather than crashing, since a
876
- * version string this check cannot make sense of should not be quietly trusted.
877
- */
878
- function parseVersionCore(version: string): [number, number, number] {
879
- const m = /(\d+)\.(\d+)\.(\d+)/.exec(version);
880
- if (!m) return [0, 0, 0];
881
- return [Number(m[1]), Number(m[2]), Number(m[3])];
882
- }
883
-
884
- /** Whether `version` is strictly older than `min`, comparing `major.minor.patch` numerically. */
885
- export function isOlderVersion(version: string, min: string): boolean {
886
- const a = parseVersionCore(version);
887
- const b = parseVersionCore(min);
888
- for (let i = 0; i < 3; i++) {
889
- if (a[i] !== b[i]) return a[i] < b[i];
890
- }
891
- return false;
892
- }
893
-
894
- /**
895
- * Extract the release version from `choudoufu version`'s human-readable
896
- * output: `"choudoufu v0.13.0 (based on OpenTofu v1.13.0)\non darwin_arm64"`.
897
- * `choudoufu version -json`'s `terraform_version` field is the wrong number
898
- * here: it names the upstream OpenTofu base this build forked from, not the
899
- * choudoufu release itself (`internal/command/views/version.go`), so this
900
- * reads the human form's `choudoufu vX.Y.Z` prefix instead. A dev build with
901
- * no release tag baked in (`version.Fork` unset) prints only the upstream
902
- * line and carries no choudoufu version to check at all: `undefined` here,
903
- * same as an output this cannot parse.
904
- */
905
- export function parseChoudoufuVersion(versionOutput: string): string | undefined {
906
- const m = /^choudoufu\s+v?(\d+\.\d+\.\d+)/m.exec(versionOutput);
907
- return m?.[1];
908
- }
909
-
910
- /** Cached per activity-module load (#2103): `choudoufu version` runs at most once per process. */
911
- let choudoufuVersionCheck: Promise<void> | undefined;
912
-
913
- /**
914
- * Refuse a choudoufu binary older than {@link MIN_CHOUDOUFU_VERSION}. Runs
915
- * `choudoufu version` (never `-json`; see {@link parseChoudoufuVersion}) at
916
- * most once per module load, cached across every activity call regardless of
917
- * which one triggered it. A no-op for `terraform`/`tofu`, and a no-op when
918
- * the version cannot be determined at all (a dev build): this refuses a
919
- * known-old binary, not an unknown one.
920
- */
921
- async function ensureChoudoufuVersion(binary: string, signal?: AbortSignal): Promise<void> {
922
- if (binary !== "choudoufu") return;
923
- choudoufuVersionCheck ??= (async () => {
924
- const { stdout } = await execAsync(`${binary} version`, { env: process.env, signal });
925
- const version = parseChoudoufuVersion(stdout);
926
- if (version === undefined) return;
927
- if (isOlderVersion(version, MIN_CHOUDOUFU_VERSION)) {
928
- throw new Error(
929
- `choudoufu ${version} is older than the minimum supported version v${MIN_CHOUDOUFU_VERSION} ` +
930
- "(needed for live-plan -json, live-ls, live-check -json, the approval artifact `plan -out` / " +
931
- "`apply <planfile>` pair, and the document's adoptable section). Upgrade choudoufu.",
932
- );
933
- }
934
- })();
935
- return choudoufuVersionCheck;
936
- }
937
-
938
- /** Test-only: clear the cached version check so a test can simulate a fresh module load. */
939
- export function __resetChoudoufuVersionCheckForTests(): void {
940
- choudoufuVersionCheck = undefined;
941
- choudoufuWavesVersionCheck = undefined;
942
- }
943
-
944
- /**
945
- * Why `choudoufu version`'s output cannot drive a gated wave, or `undefined`
946
- * when it can (#3459). A release older than
947
- * {@link MIN_CHOUDOUFU_WAVES_VERSION} is refused. A dev build names no
948
- * release and passes here; {@link parseChoudoufuPlanSet} then refuses a set
949
- * plan document with no digest, which is what an older dev build prints.
950
- */
951
- export function choudoufuWavesVersionRefusal(versionOutput: string): string | undefined {
952
- const version = parseChoudoufuVersion(versionOutput);
953
- if (version === undefined || !isOlderVersion(version, MIN_CHOUDOUFU_WAVES_VERSION)) return undefined;
954
- return (
955
- `choudoufu ${version} is older than v${MIN_CHOUDOUFU_WAVES_VERSION}, the first release with the set digest and ` +
956
- "live-wave-apply (choudoufu#1754) that a gated wave uses for a choudoufu root. Upgrade choudoufu, or run the " +
957
- "fan-out without --wave-gate."
958
- );
959
- }
960
-
961
- /** Cached like {@link choudoufuVersionCheck}, and only ever run on the wave path. */
962
- let choudoufuWavesVersionCheck: Promise<void> | undefined;
963
-
964
- async function ensureChoudoufuWavesVersion(binary: string, signal?: AbortSignal): Promise<void> {
965
- choudoufuWavesVersionCheck ??= (async () => {
966
- const { stdout } = await execAsync(`${binary} version`, { env: process.env, signal });
967
- const refusal = choudoufuWavesVersionRefusal(stdout);
968
- if (refusal) throw new Error(refusal);
969
- })();
970
- return choudoufuWavesVersionCheck;
971
- }
972
-
973
- // ── Root resolution ─────────────────────────────────────────────────────────
974
-
975
- /** A root entry resolved against the project config, ready to run in. */
976
- interface ResolvedRoot {
977
- binary: string;
978
- root: TerraformRootConfig;
979
- /** Absolute path of `root.dir`, resolved against the project root. */
980
- dir: string;
981
- /** The declared estate, when `binary` is `"choudoufu"` and one is detected. */
982
- estate?: string;
983
- /** `true` exactly when this root is live: `binary` is `"choudoufu"` and `estate` is set. */
984
- live: boolean;
985
- /** The directory the project's `chant.config.*` lives in, which `root.dir` resolves against. */
986
- projectRoot: string;
987
- }
988
-
989
- /**
990
- * Read `terraform.roots` out of the project config and resolve one entry.
991
- * The walk is {@link loadChantConfigUpward}, so a step invoked from a
992
- * subdirectory still finds the project's `chant.config.*`, and `dir` resolves
993
- * against the directory that config lives in rather than against the cwd.
994
- *
995
- * Also runs {@link ensureChoudoufuVersion} and, on a choudoufu root,
996
- * {@link detectLiveEstate}, so every activity answers "is this root live"
997
- * the same way without repeating either check itself.
998
- */
999
- async function resolveRoot(args: TerraformRootArgs, signal?: AbortSignal): Promise<ResolvedRoot> {
1000
- const start = resolve(args.cwd ?? process.cwd());
1001
- const { config, configPath } = await loadChantConfigUpward(start);
1002
- const projectRoot = configPath ? dirname(configPath) : start;
1003
- const namespace = (config as { terraform?: TerraformConfig }).terraform;
1004
- const roots = namespace?.roots ?? {};
1005
- // chant#4842: a root with no entry and a dir of its own plans that directory.
1006
- const declared = roots[args.root] ?? (args.dir !== undefined ? { dir: args.dir } : undefined);
1007
- const own = args.workspace !== undefined && args.workspace !== "" ? args.workspace : undefined;
1008
- const root = declared && (args.env || own) ? { ...declared, ...(own ? { workspace: own } : {}) } : declared;
1009
- if (root && args.env) rootProcessEnv.set(root, args.env);
1010
- if (root && own) rootOwnWorkspace.set(root, own);
1011
- if (!root) {
1012
- const known = Object.keys(roots).sort();
1013
- throw new Error(
1014
- `terraform: no root named "${args.root}" in terraform.roots` +
1015
- `${configPath ? ` (${configPath})` : ""} — ` +
1016
- (known.length > 0 ? `known roots: ${known.join(", ")}` : "the namespace declares no roots"),
1017
- );
1018
- }
1019
- const binary = args.binary !== undefined && args.binary !== "" ? args.binary : terraformBinary(namespace);
1020
- const dir = resolve(projectRoot, args.dir ?? root.dir);
1021
- await ensureChoudoufuVersion(binary, signal);
1022
- const estate = binary === "choudoufu" ? detectLiveEstate(dir) : undefined;
1023
- // `estate` stays what it has always been: the estate the root's own HCL
1024
- // declares, which is what decides whether `-estate` may be passed at all.
1025
- // `live` is the broader question, and a root that names its estate in
1026
- // chant.config rather than in HCL (#2479) is just as live - that is the
1027
- // `-estate` flag form, choudoufu's own supported second pipeline.
1028
- const configEstate = binary === "choudoufu" ? root.estate : undefined;
1029
- return {
1030
- binary,
1031
- root,
1032
- dir,
1033
- ...(estate !== undefined ? { estate } : {}),
1034
- live: estate !== undefined || configEstate !== undefined,
1035
- projectRoot,
1036
- };
1037
- }
1038
-
1039
- /** The shape `promisify(exec)` rejects with: an Error carrying the child's exit code and output. */
1040
- interface ExecFailure {
1041
- code?: unknown;
1042
- stdout?: string;
1043
- stderr?: string;
1044
- }
1045
-
1046
- export {
1047
- asUpstreamCommands,
1048
- commandWords,
1049
- withTerraformCommandHook,
1050
- type TerraformCommand,
1051
- type TerraformCommandHook,
1052
- type TerraformCommandResult,
1053
- type TerraformCommandRun,
1054
- } from "../command-hook";
1055
-
1056
- /** Run `cmd` in `dir`, forwarding the signal so an abort kills the child. */
1057
- function runPlain(cmd: string, dir: string, env: Record<string, string>, signal?: AbortSignal, unset: readonly string[] = []): Promise<{ stdout: string; stderr: string }> {
1058
- const merged: NodeJS.ProcessEnv = { ...process.env, ...env };
1059
- for (const name of unset) delete merged[name];
1060
- return execAsync(cmd, { cwd: dir, env: merged, signal, maxBuffer: MAX_BUFFER });
1061
- }
1062
-
1063
- /**
1064
- * Run `cmd` in `dir` ({@link runPlain}), through the command hook of the
1065
- * step call it runs in (chant#4865): the hook's variables over `env`, still
1066
- * less `unset`, and its `after` with the exit code, time and output.
1067
- */
1068
- async function run(
1069
- cmd: string,
1070
- dir: string,
1071
- env: Record<string, string>,
1072
- signal?: AbortSignal,
1073
- unset: readonly string[] = [],
1074
- ): Promise<{ stdout: string; stderr: string }> {
1075
- const scope = currentCommandScope();
1076
- if (!scope) return runPlain(cmd, dir, env, signal, unset);
1077
- const words = commandWords(cmd);
1078
- const args = words.slice(1);
1079
- const command: TerraformCommand = {
1080
- ...scopedCommand(scope),
1081
- binary: words[0] ?? "",
1082
- name: args.find((a) => !a.startsWith("-")) ?? "",
1083
- args,
1084
- line: cmd,
1085
- cwd: dir,
1086
- env: { ...env },
1087
- };
1088
- const given = (await scope.hook(command)) ?? {};
1089
- const start = performance.now();
1090
- const took = () => (performance.now() - start) / 1000;
1091
- let out: { stdout: string; stderr: string };
1092
- try {
1093
- out = await runPlain(cmd, dir, given.env ? { ...env, ...given.env } : env, signal, unset);
1094
- } catch (err) {
1095
- const failure = err as ExecFailure;
1096
- const seconds = took();
1097
- await given.after?.({
1098
- code: typeof failure.code === "number" ? failure.code : null,
1099
- seconds,
1100
- stdout: failure.stdout ?? "",
1101
- stderr: failure.stderr ?? (err instanceof Error ? err.message : String(err)),
1102
- });
1103
- throw err;
1104
- }
1105
- await given.after?.({ code: 0, seconds: took(), stdout: out.stdout, stderr: out.stderr });
1106
- return out;
1107
- }
1108
-
1109
- /**
1110
- * Echo a subprocess's own output to the console for a human watching a
1111
- * `chant run` step. Both streams land on real stderr (`console.error`),
1112
- * never on real stdout (chant#2395): every activity here is reachable two
1113
- * ways — as a declared Op step, where a human is watching the terminal and
1114
- * stdout/stderr are both visible to them, and as an internal read a reader
1115
- * like `describeResources()` makes on a caller's behalf (`choudoufuLivePlan`,
1116
- * via `../../describe-resources.ts`), where the caller's own stdout is
1117
- * reserved for exactly one thing: the command's own JSON document, when one
1118
- * was asked for. Putting the subprocess's raw output on real stdout used to
1119
- * mean a caller running under `--json` (`chant lifecycle plan --live --json`,
1120
- * `chant components status --live --json`) got that raw `choudoufu
1121
- * live-plan -json` text landing on stdout ahead of chant's own document — two
1122
- * concatenated JSON values on one stream, which broke `convergeTick`'s bare
1123
- * `JSON.parse(stdout)` (`packages/core/src/op/activities/converge.ts`) with
1124
- * `Unexpected non-whitespace character after JSON at position …`. Stderr is
1125
- * still on the same terminal for an interactive `chant run`, so a human loses
1126
- * nothing; a `--json` caller now gets exactly one document on stdout.
1127
- */
1128
- function report(stdout: string, stderr: string): void {
1129
- if (stdout) console.error(stdout);
1130
- if (stderr) console.error(stderr);
1131
- }
1132
-
1133
- // ── Activities ──────────────────────────────────────────────────────────────
1134
-
1135
- /**
1136
- * `terraform init` in the named root, with the root's `backendConfigFiles` and
1137
- * `backendConfig` supplied as `-backend-config` flags. Uses the longInfra profile: init downloads
1138
- * providers and modules, a network call of unpredictable size.
1139
- */
1140
- export async function terraformInit(
1141
- args: TerraformInitArgs,
1142
- signal?: AbortSignal,
1143
- ): Promise<TerraformInitResult> {
1144
- const { binary, root, dir } = await resolveRoot(args, signal);
1145
- const cmd = terraformInitCommand({
1146
- binary,
1147
- ...(root.backendConfig ? { backendConfig: root.backendConfig } : {}),
1148
- ...(root.backendConfigFiles ? { backendConfigFiles: root.backendConfigFiles } : {}),
1149
- ...(args.upgrade ? { upgrade: true } : {}),
1150
- ...(args.reconfigure ? { reconfigure: true } : {}),
1151
- });
1152
-
1153
- // Known once the root resolves, before init runs (chant#4512), so a failed
1154
- // init still publishes them and the ledger names the root it was for.
1155
- const rootPath = workspaceRelativePath(dir);
1156
- const result: TerraformInitResult = { dir, ...(root.workspace ? { workspace: root.workspace } : {}), ...(rootPath !== undefined ? { rootPath } : {}) };
1157
-
1158
- // chant#4854: a workspace the step names is created after an init in default, which every backend lists.
1159
- const own = rootOwnWorkspace.get(root);
1160
- let out: { stdout: string; stderr: string };
1161
- try {
1162
- out = await run(cmd, dir, own ? { ...terraformEnvironment(root), TF_WORKSPACE: "default" } : terraformEnvironment(root), signal);
1163
- if (own) {
1164
- report(out.stdout, out.stderr);
1165
- // TF_WORKSPACE would override the select, so the binary runs it with none.
1166
- const { TF_WORKSPACE: _selected, ...selectEnv } = terraformEnvironment(root);
1167
- out = await run(terraformWorkspaceSelectCommand({ binary, workspace: own }), dir, selectEnv, signal, ["TF_WORKSPACE"]);
1168
- }
1169
- } catch (err) {
1170
- throw withKnownOutputs(err, result);
1171
- }
1172
- report(out.stdout, out.stderr);
1173
- return result;
1174
- }
1175
-
1176
- /**
1177
- * `err` carrying `outputs` as the outputs the activity knew when it failed
1178
- * (chant#4512): the `knownOutputs` property core's executor reads a failed
1179
- * step's outcome attributes from (core's `withKnownOutputs`). It is set here
1180
- * rather than imported so the lexicon needs no newer core; an older executor
1181
- * reads the error as any other failure.
1182
- */
1183
- function withKnownOutputs(err: unknown, outputs: object): Error {
1184
- const e = err instanceof Error ? err : new Error(String(err));
1185
- return Object.assign(e, { knownOutputs: outputs });
1186
- }
1187
-
1188
- /**
1189
- * `dir` relative to the chant workspace that holds it, `/`-separated, or
1190
- * undefined outside a workspace or outside its root (chant#4482). The
1191
- * workspace root `"."` stands for itself.
1192
- */
1193
- export function workspaceRelativePath(dir: string): string | undefined {
1194
- const found = findWorkspaceRoot(dir);
1195
- if (!found) return undefined;
1196
- const rel = relative(found.dir, dir);
1197
- if (rel.startsWith("..")) return undefined;
1198
- return rel === "" ? "." : rel.split(sep).join("/");
1199
- }
1200
-
1201
- /**
1202
- * `terraform plan -detailed-exitcode -out=<planFile>` in the named root, then
1203
- * `terraform show` over the written plan in both `-json` and `-no-color` form
1204
- * (`-json` alone with `text: false`).
1205
- *
1206
- * The exit code is the answer, not an error condition: 0 is a plan with no
1207
- * changes, 2 is a plan with changes, and anything else, 1 included, is a
1208
- * failure thrown with terraform's own stderr attached. Both `show` renders
1209
- * come back with the result, so a gate, a report or an apply downstream reads
1210
- * the plan that ran instead of planning again against a moved world.
1211
- *
1212
- * Uses the longInfra profile: plan refreshes every resource against its
1213
- * provider.
1214
- */
1215
- export async function terraformPlan(
1216
- args: TerraformPlanArgs,
1217
- signal?: AbortSignal,
1218
- ): Promise<TerraformPlanResult> {
1219
- const { binary, root, dir, live } = await resolveRoot(args, signal);
1220
- const planFile = args.planFile ?? DEFAULT_PLAN_FILE;
1221
- const env = terraformEnvironment(root);
1222
- const lock = args.lockTimeout !== undefined ? lockTimeoutArgs("plan", args.lockTimeout) : [];
1223
- // #4545: a cone only on a live root that is not an estate file; -target and -destroy plan in full.
1224
- const fixed = [...(args.destroy ? ["-destroy"] : []), ...((args.targets ?? []).length > 0 ? ["-target"] : [])];
1225
- const cone = args.cone !== undefined ? coneArgs(binary, args.cone, fixed, live && !existsSync(join(dir, "estate.chdf.hcl"))) : [];
1226
- const cmd = terraformPlanCommand({
1227
- binary,
1228
- planFile,
1229
- ...(root.varFiles ? { varFiles: root.varFiles } : {}),
1230
- ...(args.vars ? { vars: args.vars } : {}),
1231
- ...(args.destroy ? { destroy: true } : {}),
1232
- ...(args.targets && args.targets.length > 0 ? { targets: args.targets } : {}),
1233
- ...(cone.length + lock.length > 0 ? { extra: [...cone, ...lock] } : {}),
1234
- });
1235
-
1236
- let changed: boolean;
1237
- let output = "";
1238
- try {
1239
- const { stdout, stderr } = await run(cmd, dir, env, signal);
1240
- report(stdout, stderr);
1241
- output = `${stdout}\n${stderr}`;
1242
- changed = false;
1243
- } catch (err) {
1244
- // An abort or a spawn failure carries no numeric exit code. That is not
1245
- // terraform answering, so it propagates untouched.
1246
- const failure = err as ExecFailure;
1247
- if (typeof failure.code !== "number") throw err;
1248
- if (failure.code !== 2) {
1249
- const detail = (failure.stderr ?? "").trim() || (failure.stdout ?? "").trim();
1250
- throw new Error(
1251
- `${binary} plan failed in ${dir} (exit ${failure.code})${detail ? `\n${detail}` : ""}`,
1252
- );
1253
- }
1254
- report(failure.stdout ?? "", failure.stderr ?? "");
1255
- output = `${failure.stdout ?? ""}\n${failure.stderr ?? ""}`;
1256
- changed = true;
1257
- }
1258
-
1259
- const jsonRun = await run(terraformShowCommand({ binary, json: true, planFile }), dir, env, signal);
1260
- const text = args.text === false ? "" : (await run(terraformShowCommand({ binary, json: false, planFile }), dir, env, signal)).stdout;
1261
- const json: unknown = JSON.parse(jsonRun.stdout);
1262
-
1263
- return {
1264
- changed,
1265
- planFile,
1266
- dir,
1267
- json,
1268
- text,
1269
- planDigest: terraformPlanDigest(json),
1270
- changeSet: terraformChangeSetPart({
1271
- member: args.root,
1272
- plan: json,
1273
- planner: plannerForBinary(binary),
1274
- ...((root.estate ?? root.workspace) ? { scope: root.estate ?? root.workspace } : {}),
1275
- }),
1276
- ...countPlanChanges(json),
1277
- ...(cone.length > 0 ? { cone: readPlanCone(output, join(dir, planFile), args.cone!) } : {}),
1278
- };
1279
- }
1280
-
1281
- /**
1282
- * Which of choudoufu's two approval refusals an exit-3 apply printed, or
1283
- * `undefined` when the output carries neither summary line. Reads both the
1284
- * stderr the diagnostic is written to and the stdout the fresh plan is
1285
- * rendered on, since the two travel separately.
1286
- */
1287
- export function classifyApprovalRefusal(output: string): TerraformApprovalRefusal | undefined {
1288
- if (output.includes(CHOUDOUFU_WRONG_ESTATE_REFUSAL)) return "wrong-estate";
1289
- if (output.includes(CHOUDOUFU_APPROVAL_MISMATCH_REFUSAL)) return "approval-mismatch";
1290
- return undefined;
1291
- }
1292
-
1293
- /**
1294
- * `terraform apply <planFile>` in the named root, on a stock root and on a
1295
- * live one alike.
1296
- *
1297
- * Neither kind has a bare-apply mode here: without a saved `planFile`, apply
1298
- * re-plans at apply time and acts on something no gate ever saw, so a missing
1299
- * one is refused before the CLI runs. choudoufu v0.13.0 is what makes the
1300
- * live half of that true (choudoufu #878, PR 889): `plan -out` is accepted
1301
- * under a `live` block, and `apply <planfile>` re-plans against the live
1302
- * system, compares its fresh plan with the file's down to the planned values,
1303
- * and applies only when they agree.
1304
- *
1305
- * When they do not, choudoufu exits **3**, neither 1 (any ordinary failure)
1306
- * nor `-detailed-exitcode`'s 2, with one of two named refusals. That is an
1307
- * answer rather than a breakage, so it comes back as a result (`refused`,
1308
- * `refusal`) instead of a thrown error, and a workflow can route the run back
1309
- * to review. Exit 3 is read this way only on a live root; on a stock root
1310
- * nothing produces it and every non-zero exit stays a failure.
1311
- *
1312
- * Uses the longInfra profile.
1313
- */
1314
- export async function terraformApply(
1315
- args: TerraformApplyArgs,
1316
- signal?: AbortSignal,
1317
- ): Promise<TerraformApplyResult> {
1318
- const { binary, root, dir, live } = await resolveRoot(args, signal);
1319
- const hasPlanFile = typeof args.planFile === "string" && args.planFile.trim() !== "";
1320
-
1321
- if (!hasPlanFile) {
1322
- throw new Error(
1323
- "terraformApply: planFile is required — this activity applies a saved plan and has no bare-apply mode. " +
1324
- "Pass the Plan step's own output (`plan.out.planFile`).",
1325
- );
1326
- }
1327
-
1328
- const planFile = args.planFile!;
1329
- const lock = args.lockTimeout !== undefined ? lockTimeoutArgs("apply", args.lockTimeout) : [];
1330
- const cmd = terraformApplyCommand({ binary, planFile, ...(lock.length > 0 ? { extra: lock } : {}) });
1331
-
1332
- try {
1333
- const { stdout, stderr } = await run(cmd, dir, terraformEnvironment(root), signal);
1334
- report(stdout, stderr);
1335
- return { planFile, dir, applied: true };
1336
- } catch (err) {
1337
- // An abort or a spawn failure carries no numeric exit code. That is not
1338
- // the CLI answering, so it propagates untouched, same as terraformPlan.
1339
- const failure = err as ExecFailure;
1340
- const refused =
1341
- live && failure.code === CHOUDOUFU_APPROVAL_EXIT_CODE
1342
- ? classifyApprovalRefusal(`${failure.stderr ?? ""}\n${failure.stdout ?? ""}`)
1343
- : undefined;
1344
- if (refused === undefined) throw err;
1345
- report(failure.stdout ?? "", failure.stderr ?? "");
1346
- return {
1347
- planFile,
1348
- dir,
1349
- applied: false,
1350
- refused,
1351
- refusal: (failure.stderr ?? "").trim() || (failure.stdout ?? "").trim(),
1352
- };
1353
- }
1354
- }
1355
-
1356
- /**
1357
- * `terraform output -json` in the named root, as `{ name: value }` (#3049).
1358
- * A sensitive output's value comes back like any other, since the caller
1359
- * asked for the values to hand them on.
1360
- */
1361
- export async function terraformOutputs(
1362
- args: TerraformRootArgs,
1363
- signal?: AbortSignal,
1364
- ): Promise<Record<string, unknown>> {
1365
- return outputsIn(await resolveRoot(args, signal), signal);
1366
- }
1367
-
1368
- /** `<binary> output -json` in a resolved root, as `{ name: value }`. */
1369
- async function outputsIn({ binary, root, dir }: ResolvedRoot, signal?: AbortSignal): Promise<Record<string, unknown>> {
1370
- const { stdout } = await run(`${binary} output -json`, dir, terraformEnvironment(root), signal);
1371
- const parsed = JSON.parse(stdout || "{}") as Record<string, { value?: unknown }>;
1372
- return Object.fromEntries(Object.entries(parsed).map(([name, entry]) => [name, entry?.value]));
1373
- }
1374
-
1375
- // ── choudoufu gated waves (#3459) ───────────────────────────────────────────
1376
-
1377
- /**
1378
- * `live-plan-set -json` over one root, from the project root, so the
1379
- * document names the root by its path from there, which is what
1380
- * `live-wave-apply` resolves it against.
1381
- */
1382
- export function choudoufuPlanSetCommand(opts: { binary: string; root: string; outDir: string }): string {
1383
- return [opts.binary, "live-plan-set", "-json", `-out-dir=${quoteArg(opts.outDir)}`, quoteArg(opts.root)].join(" ");
1384
- }
1385
-
1386
- /**
1387
- * `live-wave-apply` over a one-root set. The set chant hands choudoufu is
1388
- * one root, so choudoufu's waves over it are a single wave and `-wave=1` is
1389
- * always that root's. chant's waves are the order; choudoufu's command is
1390
- * the apply, with its set check and its resume file.
1391
- */
1392
- export function choudoufuWaveApplyCommand(opts: {
1393
- binary: string;
1394
- planSet: string;
1395
- digest: string;
1396
- resume: string;
1397
- outDir: string;
1398
- }): string {
1399
- return [
1400
- opts.binary,
1401
- "live-wave-apply",
1402
- `-plan-set=${quoteArg(opts.planSet)}`,
1403
- `-digest=${quoteArg(opts.digest)}`,
1404
- "-wave=1",
1405
- `-resume=${quoteArg(opts.resume)}`,
1406
- `-out-dir=${quoteArg(opts.outDir)}`,
1407
- "-json",
1408
- ].join(" ");
1409
- }
1410
-
1411
- /**
1412
- * The root's directory as a set plan document names it: its path from the
1413
- * project root, with forward slashes. `undefined` when the root is the
1414
- * project root itself or outside it, since choudoufu takes only roots inside
1415
- * the working directory.
1416
- */
1417
- export function choudoufuSetRootPath(projectRoot: string, dir: string): string | undefined {
1418
- const rel = relative(projectRoot, dir);
1419
- if (rel === "" || rel === ".." || rel.startsWith(`..${sep}`) || resolve(projectRoot, rel) !== resolve(dir)) return undefined;
1420
- return rel.split(sep).join("/");
1421
- }
1422
-
1423
- /** A root that a gated wave runs through `live-plan-set` and `live-wave-apply`. */
1424
- export interface ChoudoufuWaveRootArgs extends TerraformRootArgs {
1425
- /** The step's `-var` values. A root given any is not a wave root: see {@link choudoufuWaveRoot}. */
1426
- vars?: Record<string, unknown>;
1427
- }
1428
-
1429
- /**
1430
- * Whether a gated wave runs this root through choudoufu's own set commands
1431
- * (#3459), and if not, why not. It does for a live choudoufu root that
1432
- * `live-plan-set` can plan as chant would: those commands run plain `init`
1433
- * and `plan` in each root, with no `-var-file`, no `-var` and no
1434
- * `-backend-config`, so a root that needs any of them goes the `plan -out`
1435
- * and `apply PLANFILE` way instead, where choudoufu's per-root refusal
1436
- * (choudoufu #878) still stands in front of the apply.
1437
- */
1438
- export async function choudoufuWaveRoot(
1439
- args: ChoudoufuWaveRootArgs,
1440
- signal?: AbortSignal,
1441
- ): Promise<{ wave: true; root: string } | { wave: false; reason: string }> {
1442
- const resolved = await resolveRoot(args, signal);
1443
- if (resolved.binary !== "choudoufu") return { wave: false, reason: `the root runs ${resolved.binary}` };
1444
- if (!resolved.live) return { wave: false, reason: "the root declares no live estate" };
1445
- if (args.workspace) return { wave: false, reason: "the step names the root's workspace, which live-plan-set does not select or create" };
1446
- if (args.vars && Object.values(args.vars).some((v) => v !== undefined)) {
1447
- return { wave: false, reason: "the step passes -var values, which live-plan-set does not take" };
1448
- }
1449
- if (resolved.root.varFiles && resolved.root.varFiles.length > 0) {
1450
- return { wave: false, reason: "the root has var files, which live-plan-set does not take" };
1451
- }
1452
- if ((resolved.root.backendConfig && Object.keys(resolved.root.backendConfig).length > 0) || (resolved.root.backendConfigFiles?.length ?? 0) > 0) {
1453
- return { wave: false, reason: "the root has backend config, which live-plan-set does not take" };
1454
- }
1455
- const root = choudoufuSetRootPath(resolved.projectRoot, resolved.dir);
1456
- if (root === undefined) return { wave: false, reason: "the root's directory is not inside the project" };
1457
- return { wave: true, root };
1458
- }
1459
-
1460
- /** What {@link parseChoudoufuPlanSet} read out of a one-root set plan document. */
1461
- export interface ChoudoufuPlanSet {
1462
- /** choudoufu's set digest: what `live-wave-apply -digest` takes. */
1463
- setDigest: string;
1464
- /** choudoufu's digest of the one root. */
1465
- rootDigest: string;
1466
- /** chant's {@link terraformPlanDigest} over the root's embedded plan: what the wave gate binds. */
1467
- planDigest: string;
1468
- changed: boolean;
1469
- /** The root's `show -json` plan, as the document embeds it. */
1470
- json: unknown;
1471
- /** The member's change-set part, with choudoufu's root digest as `nativeDigest`. */
1472
- changeSet: ChangeSetPart;
1473
- }
1474
-
1475
- const isObjectValue = (value: unknown): value is Record<string, unknown> =>
1476
- typeof value === "object" && value !== null && !Array.isArray(value);
1477
-
1478
- /**
1479
- * Read `live-plan-set -json`'s document for one root (#3459). Refuses a
1480
- * document with no set digest: that choudoufu predates choudoufu#1754, and
1481
- * this is how a dev build, which names no release, is held to
1482
- * {@link MIN_CHOUDOUFU_WAVES_VERSION}. Refuses a root that did not plan,
1483
- * with choudoufu's own error.
1484
- */
1485
- export function parseChoudoufuPlanSet(stdout: string, opts: { member: string; root: string }): ChoudoufuPlanSet {
1486
- let doc: unknown;
1487
- try {
1488
- doc = JSON.parse(stdout);
1489
- } catch {
1490
- throw new Error(`choudoufu live-plan-set printed no JSON document for root "${opts.member}"`);
1491
- }
1492
- if (!isObjectValue(doc) || !Array.isArray(doc.roots)) {
1493
- throw new Error(`choudoufu live-plan-set printed no set plan document for root "${opts.member}"`);
1494
- }
1495
- if (typeof doc.digest !== "string" || doc.digest === "") {
1496
- throw new Error(
1497
- `choudoufu's set plan document for root "${opts.member}" carries no set digest, so this choudoufu predates ` +
1498
- `choudoufu#1754. A gated wave over a choudoufu root needs v${MIN_CHOUDOUFU_WAVES_VERSION} or later.`,
1499
- );
1500
- }
1501
- const roots = doc.roots.filter(isObjectValue);
1502
- const entry = roots.find((r) => r.root === opts.root);
1503
- if (roots.length !== 1 || !entry) {
1504
- throw new Error(
1505
- `choudoufu's set plan document for root "${opts.member}" names ${roots.map((r) => String(r.root)).join(", ") || "no root"}, ` +
1506
- `not only "${opts.root}"`,
1507
- );
1508
- }
1509
- if (entry.status !== "planned" || !isObjectValue(entry.plan)) {
1510
- const stage = typeof entry.stage === "string" && entry.stage ? ` at ${entry.stage}` : "";
1511
- const error = typeof entry.error === "string" && entry.error ? `: ${entry.error}` : "";
1512
- throw new Error(`choudoufu could not plan root "${opts.member}"${stage}${error}`);
1513
- }
1514
- if (typeof entry.digest !== "string" || entry.digest === "") {
1515
- throw new Error(`choudoufu's set plan document gives root "${opts.member}" no digest`);
1516
- }
1517
- const [changeSet] = choudoufuSetPlanParts({ document: doc, memberFor: () => opts.member });
1518
- return {
1519
- setDigest: doc.digest,
1520
- rootDigest: entry.digest,
1521
- planDigest: terraformPlanDigest(entry.plan),
1522
- changed: entry.changes === true,
1523
- json: entry.plan,
1524
- changeSet: changeSet!,
1525
- };
1526
- }
1527
-
1528
- /** The directory a root's wave files go in, absolute. */
1529
- function choudoufuWavesDir(projectRoot: string, root: string): string {
1530
- return join(projectRoot, CHOUDOUFU_WAVES_DIR, root.replace(/[^A-Za-z0-9._-]/g, "_"));
1531
- }
1532
-
1533
- /** A path under the project root as choudoufu, run from there, should be given it. */
1534
- function fromProject(projectRoot: string, path: string): string {
1535
- return relative(projectRoot, path).split(sep).join("/");
1536
- }
1537
-
1538
- /** What {@link choudoufuPlanSet} planned. */
1539
- export interface ChoudoufuPlanSetResult extends ChoudoufuPlanSet {
1540
- /** The set plan document, written as choudoufu printed it. `live-wave-apply -plan-set` reads this file. */
1541
- planSetFile: string;
1542
- /** The root's path as the document names it. */
1543
- root: string;
1544
- }
1545
-
1546
- /**
1547
- * Plan one live choudoufu root as a one-root set: `live-plan-set -json` from
1548
- * the project root (#3459). The document goes to
1549
- * `<CHOUDOUFU_WAVES_DIR>/<root>/plan-set.json`, the file a later
1550
- * `live-wave-apply` hands back to choudoufu with the set digest.
1551
- */
1552
- export async function choudoufuPlanSet(args: TerraformRootArgs, signal?: AbortSignal): Promise<ChoudoufuPlanSetResult> {
1553
- return planSetIn(await resolveRoot(args, signal), args.root, signal);
1554
- }
1555
-
1556
- /** {@link choudoufuPlanSet} over a resolved root, `key` naming it in errors, in the waves directory and as the change-set member. */
1557
- async function planSetIn(resolved: ResolvedRoot, key: string, signal?: AbortSignal): Promise<ChoudoufuPlanSetResult> {
1558
- const { binary, root, dir, projectRoot } = resolved;
1559
- if (binary !== "choudoufu") throw new Error(`choudoufuPlanSet: root "${key}" runs ${binary}, not choudoufu`);
1560
- await ensureChoudoufuWavesVersion(binary, signal);
1561
- const rootPath = choudoufuSetRootPath(projectRoot, dir);
1562
- if (rootPath === undefined) throw new Error(`choudoufuPlanSet: root "${key}" (${dir}) is not inside ${projectRoot}`);
1563
- const wavesDir = choudoufuWavesDir(projectRoot, key);
1564
- mkdirSync(wavesDir, { recursive: true });
1565
- const cmd = choudoufuPlanSetCommand({ binary, root: rootPath, outDir: fromProject(projectRoot, join(wavesDir, "out")) });
1566
-
1567
- let stdout: string;
1568
- try {
1569
- const out = await run(cmd, projectRoot, terraformEnvironment(root), signal);
1570
- report("", out.stderr);
1571
- stdout = out.stdout;
1572
- } catch (err) {
1573
- // 2 is "planned, with changes" and 4 is "a root failed", which the
1574
- // document itself explains. Anything else is the command not running.
1575
- const failure = err as ExecFailure;
1576
- if (failure.code !== 2 && failure.code !== 4) throw err;
1577
- report("", failure.stderr ?? "");
1578
- stdout = failure.stdout ?? "";
1579
- }
1580
-
1581
- const parsed = parseChoudoufuPlanSet(stdout, { member: key, root: rootPath });
1582
- const planSetFile = join(wavesDir, "plan-set.json");
1583
- writeFileSync(planSetFile, stdout);
1584
- return { ...parsed, planSetFile, root: rootPath };
1585
- }
1586
-
1587
- // ── A choudoufu workspace member's outputs (#4455) ─────────────────────────
1588
-
1589
- /**
1590
- * A choudoufu member of the workspace, as `member-outputs` names it: not a
1591
- * `terraform.roots` entry of the reading project but a directory the
1592
- * workspace declaration gives. Its binary is `choudoufu`, it has no var
1593
- * files, workspace or backend config, and it runs from `projectRoot`, a
1594
- * directory above it (the workspace root), since `live-plan-set` plans only
1595
- * roots inside the directory it runs in.
1596
- */
1597
- export interface ChoudoufuMemberArgs {
1598
- /** The member's name: the waves directory's name, and the plan's member in errors. */
1599
- member: string;
1600
- /** The member's directory, absolute. */
1601
- dir: string;
1602
- /** Where `live-plan-set` runs from, absolute: a directory above `dir`. */
1603
- projectRoot: string;
1604
- }
1605
-
1606
- async function resolveMemberRoot(args: ChoudoufuMemberArgs, signal?: AbortSignal): Promise<ResolvedRoot> {
1607
- const binary = "choudoufu";
1608
- await ensureChoudoufuVersion(binary, signal);
1609
- const dir = resolve(args.dir);
1610
- const estate = detectLiveEstate(dir);
1611
- return { binary, root: { dir }, dir, ...(estate !== undefined ? { estate } : {}), live: estate !== undefined, projectRoot: resolve(args.projectRoot) };
1612
- }
1613
-
1614
- /**
1615
- * The member's outputs as applied (#4455): `choudoufu init`, then `choudoufu
1616
- * output -json` in its directory, the read the `terraform-apply` capability's
1617
- * `outputs` makes for a root. A live estate's outputs come from its record
1618
- * store.
1619
- */
1620
- export async function choudoufuMemberOutputs(args: ChoudoufuMemberArgs, signal?: AbortSignal): Promise<Record<string, unknown>> {
1621
- const resolved = await resolveMemberRoot(args, signal);
1622
- const { stdout, stderr } = await run(terraformInitCommand({ binary: resolved.binary }), resolved.dir, terraformEnvironment(resolved.root), signal);
1623
- report(stdout, stderr);
1624
- return outputsIn(resolved, signal);
1625
- }
1626
-
1627
- /**
1628
- * The member planned as a one-root set (#4455), the way a choudoufu root in
1629
- * a gated wave is ({@link choudoufuPlanSet}): `live-plan-set -json` from
1630
- * `projectRoot`. The document's embedded plan carries `planned_values` and
1631
- * `output_changes`, which say what the member's outputs will be.
1632
- */
1633
- export async function choudoufuMemberPlanSet(args: ChoudoufuMemberArgs, signal?: AbortSignal): Promise<ChoudoufuPlanSetResult> {
1634
- const resolved = await resolveMemberRoot(args, signal);
1635
- if (!resolved.live) throw new Error(`choudoufu member "${args.member}" (${resolved.dir}) declares no live estate, so live-plan-set cannot plan it`);
1636
- return planSetIn(resolved, args.member, signal);
1637
- }
1638
-
1639
- /**
1640
- * What a choudoufu root keeps in the fan-out's attempt record (#3459):
1641
- * choudoufu's resume file, under the set digest it was written for.
1642
- */
1643
- export interface ChoudoufuCarriedResume {
1644
- kind: "choudoufu-wave-resume";
1645
- setDigest: string;
1646
- resume: unknown;
1647
- }
1648
-
1649
- /**
1650
- * The resume file to hand choudoufu for `setDigest`, from what an earlier
1651
- * attempt carried, or `undefined`. choudoufu refuses a resume file written
1652
- * for another digest, and a re-planned root with a moved plan has another
1653
- * digest, so only a file for this same set comes back.
1654
- */
1655
- export function carriedChoudoufuResume(carried: unknown, setDigest: string): unknown {
1656
- if (!isObjectValue(carried) || carried.kind !== "choudoufu-wave-resume") return undefined;
1657
- if (carried.setDigest !== setDigest || !isObjectValue(carried.resume)) return undefined;
1658
- return carried.resume.set_digest === setDigest ? carried.resume : undefined;
1659
- }
1660
-
1661
- export interface ChoudoufuWaveApplyArgs extends TerraformRootArgs {
1662
- /** {@link ChoudoufuPlanSetResult.planSetFile}: the approved document. */
1663
- planSetFile: string;
1664
- /** {@link ChoudoufuPlanSetResult.setDigest}: choudoufu's digest of that document. */
1665
- setDigest: string;
1666
- /** What the root carried from an earlier attempt (`DeployContext.carried[root]`). */
1667
- carried?: unknown;
1668
- }
1669
-
1670
- export interface ChoudoufuWaveApplyResult {
1671
- /** `live-wave-apply`'s exit status. See {@link CHOUDOUFU_WAVE_EXIT}. */
1672
- exitCode: number;
1673
- /** Exit 0: the root landed. */
1674
- landed: boolean;
1675
- /** `-json`'s result document, when it printed one. */
1676
- result?: unknown;
1677
- /** choudoufu's resume file after the run, to carry. Absent when choudoufu wrote none. */
1678
- carry?: ChoudoufuCarriedResume;
1679
- /** One line for a person: what happened, in choudoufu's words where it gave some. */
1680
- message: string;
1681
- }
1682
-
1683
- /** One line for each of `live-wave-apply`'s exit statuses, with choudoufu's own error when it gave one. */
1684
- export function describeChoudoufuWaveExit(exitCode: number, result: unknown, stderr: string): string {
1685
- const error = isObjectValue(result) && typeof result.error === "string" && result.error ? result.error : "";
1686
- const moved =
1687
- isObjectValue(result) && Array.isArray(result.moved)
1688
- ? result.moved
1689
- .filter(isObjectValue)
1690
- .map((m) => `${String(m.root)} moved: approved ${String(m.approved_digest)}, now ${String(m.fresh_digest)}`)
1691
- : [];
1692
- const detail = error || moved.join("; ") || stderr.trim().split("\n").find((l) => l.trim() !== "")?.trim() || "";
1693
- const suffix = detail ? ` (${detail})` : "";
1694
- switch (exitCode) {
1695
- case CHOUDOUFU_WAVE_EXIT.landed:
1696
- return "landed";
1697
- case CHOUDOUFU_WAVE_EXIT.setMoved:
1698
- return `choudoufu refused the approved set: the root's plan moved since it was approved, and nothing was applied${suffix}`;
1699
- case CHOUDOUFU_WAVE_EXIT.rootFailed:
1700
- return `choudoufu could not land the root; its resume file records why${suffix}`;
1701
- default:
1702
- return `choudoufu live-wave-apply could not run (exit ${exitCode})${suffix}`;
1703
- }
1704
- }
1705
-
1706
- /**
1707
- * Apply one live choudoufu root through `live-wave-apply` (#3459), with the
1708
- * set plan document and set digest {@link choudoufuPlanSet} produced. When
1709
- * the root carried a resume file for this same digest from an earlier
1710
- * attempt, it is written back first, so choudoufu sees what it already
1711
- * recorded. Its resume file after the run comes back as `carry`, landed or
1712
- * not.
1713
- *
1714
- * Never throws for a choudoufu answer: exit 3 (the set moved) and exit 4 (the
1715
- * root failed) come back with `landed: false`, and so does exit 1. An abort
1716
- * or a spawn failure propagates.
1717
- */
1718
- export async function choudoufuWaveApply(args: ChoudoufuWaveApplyArgs, signal?: AbortSignal): Promise<ChoudoufuWaveApplyResult> {
1719
- const resolved = await resolveRoot(args, signal);
1720
- const { binary, root, projectRoot } = resolved;
1721
- if (binary !== "choudoufu") throw new Error(`choudoufuWaveApply: root "${args.root}" runs ${binary}, not choudoufu`);
1722
- await ensureChoudoufuWavesVersion(binary, signal);
1723
- const wavesDir = choudoufuWavesDir(projectRoot, args.root);
1724
- mkdirSync(wavesDir, { recursive: true });
1725
- // One file per digest: choudoufu refuses a resume file written for
1726
- // another, and a file left by an earlier set must not block this one.
1727
- const resumeFile = join(wavesDir, `resume-${args.setDigest.replace(/^sha256:/, "").slice(0, 16)}.json`);
1728
- const carried = carriedChoudoufuResume(args.carried, args.setDigest);
1729
- if (carried !== undefined) writeFileSync(resumeFile, JSON.stringify(carried, null, 2) + "\n");
1730
-
1731
- const cmd = choudoufuWaveApplyCommand({
1732
- binary,
1733
- planSet: fromProject(projectRoot, args.planSetFile),
1734
- digest: args.setDigest,
1735
- resume: fromProject(projectRoot, resumeFile),
1736
- outDir: fromProject(projectRoot, join(wavesDir, "out")),
1737
- });
1738
-
1739
- let exitCode = 0;
1740
- let stdout = "";
1741
- let stderr = "";
1742
- try {
1743
- const out = await run(cmd, projectRoot, terraformEnvironment(root), signal);
1744
- stdout = out.stdout;
1745
- stderr = out.stderr;
1746
- } catch (err) {
1747
- const failure = err as ExecFailure;
1748
- if (typeof failure.code !== "number") throw err;
1749
- exitCode = failure.code;
1750
- stdout = failure.stdout ?? "";
1751
- stderr = failure.stderr ?? "";
1752
- }
1753
- report(stdout, stderr);
1754
-
1755
- let result: unknown;
1756
- try {
1757
- result = stdout.trim() ? JSON.parse(stdout) : undefined;
1758
- } catch {
1759
- result = undefined;
1760
- }
1761
- let carry: ChoudoufuCarriedResume | undefined;
1762
- if (existsSync(resumeFile)) {
1763
- try {
1764
- carry = { kind: "choudoufu-wave-resume", setDigest: args.setDigest, resume: JSON.parse(readFileSync(resumeFile, "utf8")) };
1765
- } catch {
1766
- carry = undefined;
1767
- }
1768
- }
1769
- return {
1770
- exitCode,
1771
- landed: exitCode === CHOUDOUFU_WAVE_EXIT.landed,
1772
- ...(result !== undefined ? { result } : {}),
1773
- ...(carry ? { carry } : {}),
1774
- message: describeChoudoufuWaveExit(exitCode, result, stderr),
1775
- };
1776
- }
1777
-
1778
- /**
1779
- * `terraform show` over current state, or over a saved plan when `planFile` is
1780
- * given. Returns the parsed `-json` output and the `-no-color` render, plus
1781
- * the add/change/destroy counts when the subject is a plan. State has no
1782
- * change set, so for state the three counts are zero.
1783
- *
1784
- * Uses the fastIdempotent profile: show reads an artifact and calls no
1785
- * provider.
1786
- */
1787
- export async function terraformShow(
1788
- args: TerraformShowArgs,
1789
- signal?: AbortSignal,
1790
- ): Promise<TerraformShowResult> {
1791
- const { binary, root, dir } = await resolveRoot(args, signal);
1792
- const env = terraformEnvironment(root);
1793
- const planFile = args.planFile;
1794
-
1795
- const jsonRun = await run(
1796
- terraformShowCommand({ binary, json: true, ...(planFile ? { planFile } : {}) }),
1797
- dir,
1798
- env,
1799
- signal,
1800
- );
1801
- const textRun = await run(
1802
- terraformShowCommand({ binary, json: false, ...(planFile ? { planFile } : {}) }),
1803
- dir,
1804
- env,
1805
- signal,
1806
- );
1807
- const json: unknown = JSON.parse(jsonRun.stdout);
1808
-
1809
- return {
1810
- source: planFile ? "plan" : "state",
1811
- json,
1812
- text: textRun.stdout,
1813
- dir,
1814
- ...(planFile ? { planFile } : {}),
1815
- ...(planFile ? countPlanChanges(json) : { adds: 0, changes: 0, destroys: 0 }),
1816
- };
1817
- }
1818
-
1819
- // ── The plan read (#4358) ───────────────────────────────────────────────────
1820
-
1821
- /** Prefix of the scratch directory a plan read writes its plan file into, under the OS temp directory. */
1822
- export const PLAN_READ_DIR_PREFIX = "chant-terraform-plan-";
1823
-
1824
- /** The plan file's name inside that scratch directory. */
1825
- export const PLAN_READ_FILE = "plan.tfplan";
1826
-
1827
- /**
1828
- * `terraform plan` for an observation read (#4358): `-input=false -lock=false
1829
- * -out=<file>`, plus the root's own `-var-file`s.
1830
- *
1831
- * `-lock=false` is the point. A read must never take the backend's state lock,
1832
- * or a teammate's apply that starts while chant is reading would fail on
1833
- * "Error acquiring the state lock". `-detailed-exitcode` is not passed: the
1834
- * read wants the document, not the boolean, so exit 0 is the only success.
1835
- * The `-out` path is always outside the root (see {@link terraformPlanRead}).
1836
- */
1837
- export function terraformPlanReadCommand(opts: { binary: string; planFile: string; varFiles?: string[] }): string {
1838
- const parts = [opts.binary, "plan", "-input=false", "-lock=false"];
1839
- for (const varFile of opts.varFiles ?? []) parts.push(`-var-file=${quoteArg(varFile)}`);
1840
- parts.push(`-out=${quoteArg(opts.planFile)}`);
1841
- return parts.join(" ");
1842
- }
1843
-
1844
- /**
1845
- * The one line a person runs to initialise a root chant refuses to plan,
1846
- * with the root's `backendConfig` carried, so it can be pasted as printed.
1847
- */
1848
- export function terraformInitLine(opts: { binary: string; dir: string; backendConfig?: Record<string, string>; backendConfigFiles?: readonly string[] }): string {
1849
- const init = terraformInitCommand({
1850
- binary: opts.binary,
1851
- ...(opts.backendConfig ? { backendConfig: opts.backendConfig } : {}),
1852
- ...(opts.backendConfigFiles ? { backendConfigFiles: opts.backendConfigFiles } : {}),
1853
- });
1854
- return init.replace(`${opts.binary} init`, `${opts.binary} -chdir=${quoteArg(opts.dir)} init`);
1855
- }
1856
-
1857
- /**
1858
- * Why a plan read refused or failed, in the three classes the plan depth
1859
- * falls back by (#4358):
1860
- *
1861
- * - `"not-initialised"`: the root was never initialised, or its providers,
1862
- * modules or backend changed since. chant never runs `init` on a read,
1863
- * because `init` writes into the root, so this is refused with the line
1864
- * to run.
1865
- * - `"backend"`: the state could not be read at all. A state read needs the
1866
- * same backend, so there is nothing to fall back to but declared only.
1867
- * - `"plan"`: anything else, missing provider credentials first among them.
1868
- * The backend answered, so the state read can still answer.
1869
- */
1870
- export type TerraformPlanReadFailureKind = "not-initialised" | "backend" | "plan";
1871
-
1872
- /** A plan read that did not produce a document. `kind` decides the fallback. */
1873
- export class TerraformPlanReadError extends Error {
1874
- readonly kind: TerraformPlanReadFailureKind;
1875
- readonly dir: string;
1876
- /** Present on `"not-initialised"`: the line to run. */
1877
- readonly initLine?: string;
1878
-
1879
- constructor(kind: TerraformPlanReadFailureKind, message: string, dir: string, initLine?: string) {
1880
- super(message);
1881
- this.name = "TerraformPlanReadError";
1882
- this.kind = kind;
1883
- this.dir = dir;
1884
- if (initLine !== undefined) this.initLine = initLine;
1885
- }
1886
- }
1887
-
1888
- /**
1889
- * Sort a failed plan's own output into a {@link TerraformPlanReadFailureKind}.
1890
- * Matched on terraform's and OpenTofu's own error summaries. Order matters:
1891
- * an S3 backend without credentials says both "backend" and "credentials",
1892
- * and it is the backend that failed, so the backend patterns are read first.
1893
- */
1894
- export function classifyPlanReadFailure(output: string): TerraformPlanReadFailureKind {
1895
- if (
1896
- /Backend initialization required|Inconsistent dependency lock file|Required plugins are not installed|Module not installed|Missing required provider|please run "(terraform|tofu|choudoufu) init"|Run "(terraform|tofu|choudoufu) init"|Backend configuration changed/i.test(
1897
- output,
1898
- )
1899
- ) {
1900
- return "not-initialised";
1901
- }
1902
- if (
1903
- /error loading state|Failed to load state|Error refreshing state|Failed to get existing workspaces|error configuring (the )?\S+ backend|Error: Failed to (read|retrieve) state|Error retrieving state|Error acquiring the state lock|state data in S3|NoSuchBucket|failed to (get|read) (remote )?state|Unable to access object|\bbackend\b.*(credential|denied|unauthori[sz]ed|forbidden)/i.test(
1904
- output,
1905
- )
1906
- ) {
1907
- return "backend";
1908
- }
1909
- return "plan";
1910
- }
1911
-
1912
- /** What {@link terraformPlanRead} resolved. */
1913
- export interface TerraformPlanReadResult {
1914
- /** `terraform show -json <planfile>`, parsed. */
1915
- json: unknown;
1916
- /** Absolute path of the root module directory the plan ran in. */
1917
- dir: string;
1918
- /**
1919
- * The scratch directory the plan file was written to, under the OS temp
1920
- * directory. Already removed when this result is returned; named so a test
1921
- * can prove both halves of that.
1922
- */
1923
- planDir: string;
1924
- /** The plan command exactly as run, for a test or a note to quote. */
1925
- command: string;
1926
- }
1927
-
1928
- /**
1929
- * Whether a root has been initialised: `.terraform` (or `TF_DATA_DIR`, when
1930
- * the environment points elsewhere) exists. A root whose providers or modules
1931
- * have since changed passes this check and is caught by
1932
- * {@link classifyPlanReadFailure} on the plan's own error instead.
1933
- */
1934
- export function rootIsInitialised(dir: string, env: Record<string, string | undefined> = process.env): boolean {
1935
- const dataDir = env.TF_DATA_DIR ? resolve(dir, env.TF_DATA_DIR) : join(dir, ".terraform");
1936
- return existsSync(dataDir);
1937
- }
1938
-
1939
- /**
1940
- * Read a saved plan for one root without writing anything in it (#4358):
1941
- * `plan -input=false -lock=false -out=<tmp>/plan.tfplan` in the root, then
1942
- * `show -json <tmp>/plan.tfplan`, then remove `<tmp>`.
1943
- *
1944
- * Three rules, each a lesson behold already learned reading choudoufu
1945
- * members (behold `src/choudoufu-plan.ts`):
1946
- *
1947
- * - No lock. `-lock=false` on the plan, always ({@link terraformPlanReadCommand}).
1948
- * - Nothing in the root. `<tmp>` is a fresh `mkdtemp` under the OS temp
1949
- * directory and is removed in a `finally`, failure or not. `init` is never
1950
- * run: an uninitialised root throws a {@link TerraformPlanReadError} of
1951
- * kind `"not-initialised"` carrying the line to run.
1952
- * - A failure says which kind it is, so the observation can fall back by
1953
- * depth ({@link classifyPlanReadFailure}).
1954
- *
1955
- * Uses the longInfra profile, like {@link terraformPlan}: a plan refreshes
1956
- * every resource against its provider.
1957
- */
1958
- export async function terraformPlanRead(
1959
- args: TerraformRootArgs,
1960
- signal?: AbortSignal,
1961
- ): Promise<TerraformPlanReadResult> {
1962
- const { binary, root, dir } = await resolveRoot(args, signal);
1963
- const env = terraformEnvironment(root);
1964
- const initLine = terraformInitLine({
1965
- binary,
1966
- dir,
1967
- ...(root.backendConfig ? { backendConfig: root.backendConfig } : {}),
1968
- ...(root.backendConfigFiles ? { backendConfigFiles: root.backendConfigFiles } : {}),
1969
- });
1970
- const notInitialised = (detail: string): TerraformPlanReadError =>
1971
- new TerraformPlanReadError(
1972
- "not-initialised",
1973
- `terraform.roots.${args.root} (${dir}) ${detail}: run \`${initLine}\` first. chant never runs init on a read, since init writes into the root.`,
1974
- dir,
1975
- initLine,
1976
- );
1977
-
1978
- if (!rootIsInitialised(dir, { ...process.env, ...env })) throw notInitialised("has never been initialised");
1979
-
1980
- const planDir = mkdtempSync(join(tmpdir(), PLAN_READ_DIR_PREFIX));
1981
- const planFile = join(planDir, PLAN_READ_FILE);
1982
- const command = terraformPlanReadCommand({ binary, planFile, ...(root.varFiles ? { varFiles: root.varFiles } : {}) });
1983
- try {
1984
- try {
1985
- const { stderr } = await run(command, dir, env, signal);
1986
- // The plan's own stdout is the human render, which this read never
1987
- // uses; stderr carries warnings worth a human's eye.
1988
- if (stderr) console.error(stderr);
1989
- } catch (err) {
1990
- const failure = err as ExecFailure;
1991
- if (typeof failure.code !== "number") throw err;
1992
- const output = `${failure.stderr ?? ""}\n${failure.stdout ?? ""}`.replace(/\x1b\[[0-9;]*m/g, "");
1993
- const kind = classifyPlanReadFailure(output);
1994
- const line =
1995
- output
1996
- .split("\n")
1997
- .map((l) => l.replace(/^[\s│╷╵]+/, "").trim())
1998
- .find((l) => /^Error:/.test(l)) ?? `exit ${failure.code}`;
1999
- if (kind === "not-initialised") throw notInitialised(`needs init (${line})`);
2000
- throw new TerraformPlanReadError(kind, `${binary} plan failed in ${dir}: ${line}`, dir);
2001
- }
2002
- const shown = await run(terraformShowCommand({ binary, json: true, planFile }), dir, env, signal);
2003
- return { json: JSON.parse(shown.stdout) as unknown, dir, planDir, command };
2004
- } finally {
2005
- rmSync(planDir, { recursive: true, force: true });
2006
- }
2007
- }
2008
-
2009
- /**
2010
- * The estate a choudoufu-only activity runs against, in precedence order:
2011
- * `args.estate` when the step names one, then the root's own `estate`
2012
- * (#2479), then the one {@link resolveRoot} auto-detected from the root's
2013
- * `live` block or `estate.chdf.hcl` sidecar. Throws when none of the three
2014
- * names one, since `live-plan`/`live-ls` need an estate to filter on, unlike
2015
- * a stock command.
2016
- *
2017
- * The order is step, then root, then declaration - narrowest first. A root's
2018
- * `estate` and a declared one cannot both be in play on a healthy project:
2019
- * TF028 refuses that pair at build time, for the same reason choudoufu
2020
- * refuses `-estate` beside a `live` block. The precedence here is what
2021
- * happens if that refusal is ever bypassed, and it deliberately lets the
2022
- * declaration win, because the declaration is the thing choudoufu itself
2023
- * will act on.
2024
- */
2025
- function resolveEstate(args: { estate?: string }, resolved: ResolvedRoot, activity: string): string {
2026
- const estate = args.estate ?? resolved.estate ?? resolved.root.estate;
2027
- if (!estate) {
2028
- throw new Error(
2029
- `${activity}: no estate to run against. Declare one in the root's \`live\` block or ` +
2030
- "`estate.chdf.hcl` sidecar, give the root an `estate` in chant.config, or pass `estate` explicitly.",
2031
- );
2032
- }
2033
- return estate;
2034
- }
2035
-
2036
- /**
2037
- * `choudoufu live-plan -detailed-exitcode -json -estate=<estate>`, plus a
2038
- * second `live-plan` without `-json` for the human-readable render. GitHub
2039
- * issue #788's JSON document carries no render of the plan itself
2040
- * (`views.LivePlanDocument` has no such field), so unlike `terraformPlan`'s
2041
- * single saved artifact this genuinely needs two live reads.
2042
- *
2043
- * The exit code is the answer, exactly as `terraformPlan`'s is: 0 is no
2044
- * drift, 2 is drift, and anything else is a failure thrown with choudoufu's
2045
- * own stderr attached. The JSON document is written to `documentPath` (under
2046
- * `dir`) for a later step or reviewer to open directly.
2047
- *
2048
- * Uses the longInfra profile: like `terraformPlan`, this reads the live
2049
- * system in full (the estate-wide sweep).
2050
- */
2051
- /**
2052
- * The JSON document within a `live-plan -json` stdout: everything from the
2053
- * first line that is a bare `{` to the end. Returns the input unchanged when
2054
- * no such line exists.
2055
- *
2056
- * Defensive, and kept deliberately. choudoufu v0.14.0 keeps `-json` stdout to
2057
- * the document on every form of live root, so on a supported binary this
2058
- * returns its input unchanged and the slice never fires: it was written for
2059
- * the `-estate` path's refresh progress lines
2060
- * ([choudoufu #894](https://github.com/INTENTIUS/choudoufu/issues/894), fixed
2061
- * in PR 915, which routes every human-prose renderer of a `-json` run through
2062
- * `views.View.StdoutOnStderr()`). What it buys is that a future writer put
2063
- * back on stdout ahead of the document costs a stale slice rather than a
2064
- * `JSON.parse` failure, and a stdout carrying no document at all still fails
2065
- * in `JSON.parse` with the real text in the error.
2066
- */
2067
- export function liveDocumentFrom(stdout: string): string {
2068
- const lines = stdout.split("\n");
2069
- const start = lines.findIndex((line) => line.trim() === "{");
2070
- return start === -1 ? stdout : lines.slice(start).join("\n");
2071
- }
2072
-
2073
- /**
2074
- * What {@link choudoufuLivePlanDocument} resolves: the document and the facts
2075
- * around it, and none of the human render. The subset of
2076
- * {@link ChoudoufuLivePlanResult} a reader of the document needs.
2077
- */
2078
- export interface ChoudoufuLivePlanDocumentResult extends LivePlanUnownedCounts {
2079
- /** `true` when `-detailed-exitcode` reported exit 2: the live plan proposes changes. */
2080
- drift: boolean;
2081
- /** GitHub issue #788's JSON document, captured whole. */
2082
- json: unknown;
2083
- /** Absolute path of the root module directory. */
2084
- dir: string;
2085
- /**
2086
- * Where the JSON document was written, relative to `dir`. Present only when
2087
- * the caller asked for a file with `documentPath`; a read writes nothing
2088
- * into the root (#4379).
2089
- */
2090
- documentPath?: string;
2091
- /** The estate this plan ran against. */
2092
- estate: string;
2093
- }
2094
-
2095
- /**
2096
- * `live-plan -detailed-exitcode -json` alone: the document, without the
2097
- * second run that renders the plan for a human (chant #2498).
2098
- *
2099
- * Two of {@link choudoufuLivePlan}'s three callers never read `text`:
2100
- * `describeResources()` indexes the document and `predictBehaviour()` prices
2101
- * it. Each was paying for the render anyway, and on a drifted estate whose
2102
- * provider retries a deleted resource the render costs as much as the
2103
- * document. This is the read they make instead.
2104
- *
2105
- * Inside a `withLiveReadSession` scope (core's `live-read-session.ts`) the
2106
- * run is shared with every identical read in the same command, keyed on
2107
- * the root, its resolved directory, the binary, the estate, the flags and
2108
- * the root's environment. The graph command runs in such a scope, so its
2109
- * observation and its prediction see one `live-plan` between them, and the
2110
- * graph's statuses and the prediction's figures are statements about the
2111
- * same read. The document is returned, not written: the root is left
2112
- * byte-for-byte as it was (#4379). A caller that wants the file passes
2113
- * `documentPath` (relative to the root) and it is written there on request.
2114
- */
2115
- export async function choudoufuLivePlanDocument(
2116
- args: ChoudoufuLivePlanArgs & { documentPath?: string },
2117
- signal?: AbortSignal,
2118
- ): Promise<ChoudoufuLivePlanDocumentResult> {
2119
- const resolved = await resolveRoot(args, signal);
2120
- const { binary, dir } = resolved;
2121
- const estate = resolveEstate(args, resolved, "choudoufuLivePlan");
2122
- const env = terraformEnvironment(resolved.root);
2123
- const documentPath = args.documentPath;
2124
- // A root that declares its own estate is run without `-estate`: choudoufu
2125
- // refuses the flag beside a declaration and, since v0.14.0, settles the name
2126
- // from the declaration itself. See {@link choudoufuLivePlanCommand}.
2127
- const estateFlag: { estate?: string } = resolved.estate === undefined ? { estate } : {};
2128
-
2129
- const planCmd = choudoufuLivePlanCommand({ binary, ...estateFlag, json: true });
2130
- // The document's `adoptable` and `swept` sections are populated only on a
2131
- // run that asked the estate-wide sweep the account-bounded question, which
2132
- // `-adoption-only` implies and a `-json` run does not
2133
- // (`internal/command/live_collect_unclaimed.go`). `-adoption-only` cannot
2134
- // ride the `-json` invocation, so the env var is how a document-producing
2135
- // run asks for the same thing. Set only under `adoptionOnly`: the sweep is
2136
- // an account-wide list per admitted type, and an observation read has no use
2137
- // for it.
2138
- const adoptionOnly = args.adoptionOnly === true;
2139
- const planEnv = adoptionOnly ? { ...env, TOFU_LIVE_COLLECT_UNCLAIMED: "1" } : env;
2140
- const key = liveReadKey("live-plan", { root: args.root, dir, binary, estate, adoptionOnly, env });
2141
-
2142
- const { drift, jsonStdout } = await memoLiveRead(key, async (): Promise<{ drift: boolean; jsonStdout: string }> => {
2143
- try {
2144
- const { stdout, stderr } = await run(planCmd, dir, planEnv, signal);
2145
- report(stdout, stderr);
2146
- return { drift: false, jsonStdout: stdout };
2147
- } catch (err) {
2148
- const failure = err as ExecFailure;
2149
- if (typeof failure.code !== "number") throw err;
2150
- if (failure.code !== 2) {
2151
- const detail = (failure.stderr ?? "").trim() || (failure.stdout ?? "").trim();
2152
- throw new Error(
2153
- `${binary} live-plan failed in ${dir} (exit ${failure.code})${detail ? `\n${detail}` : ""}`,
2154
- );
2155
- }
2156
- report(failure.stdout ?? "", failure.stderr ?? "");
2157
- return { drift: true, jsonStdout: failure.stdout ?? "" };
2158
- }
2159
- });
2160
-
2161
- // Belt and braces: v0.14.0 keeps `-json` stdout to the document, so this is
2162
- // the identity on a supported binary. See {@link liveDocumentFrom}.
2163
- const document = liveDocumentFrom(jsonStdout);
2164
- const json: unknown = JSON.parse(document);
2165
- if (documentPath !== undefined) writeFileSync(join(dir, documentPath), document);
2166
- return {
2167
- drift,
2168
- json,
2169
- dir,
2170
- ...(documentPath === undefined ? {} : { documentPath }),
2171
- estate,
2172
- ...countLivePlanUnowned(json),
2173
- };
2174
- }
2175
-
2176
- export async function choudoufuLivePlan(
2177
- args: ChoudoufuLivePlanArgs & { documentPath?: string },
2178
- signal?: AbortSignal,
2179
- ): Promise<ChoudoufuLivePlanResult> {
2180
- // The Op activity is the one caller that wants the file: `documentPath` is a
2181
- // declared `.out` ref a later step or reviewer opens (#2103), so it asks.
2182
- const documentPath = args.documentPath ?? DEFAULT_LIVE_PLAN_DOCUMENT_FILE;
2183
- const { drift, json, dir, estate, ...unowned } = await choudoufuLivePlanDocument(
2184
- { ...args, documentPath },
2185
- signal,
2186
- );
2187
- const resolved = await resolveRoot(args, signal);
2188
- const { binary } = resolved;
2189
- const env = terraformEnvironment(resolved.root);
2190
- const estateFlag: { estate?: string } = resolved.estate === undefined ? { estate } : {};
2191
-
2192
- // #788's document carries no render of the human plan itself
2193
- // (`views.LivePlanDocument` has no such field), so the human text needs a
2194
- // second live read rather than a field on the same response. `-adoption-only`
2195
- // (#2105) changes which report that second read prints, never whether there
2196
- // is one: choudoufu refuses the flag alongside `-json`, so the two reports
2197
- // were always going to be two runs.
2198
- const textCmd = choudoufuLivePlanCommand({
2199
- binary,
2200
- ...estateFlag,
2201
- json: false,
2202
- noColor: true,
2203
- ...(args.adoptionOnly ? { adoptionOnly: true } : {}),
2204
- });
2205
- // The human render carries `-detailed-exitcode` too, so a plan with changes
2206
- // comes back as exit 2 on this call exactly as it does on the `-json` one.
2207
- // Both are success, and the drift answer is already settled above, so exit 2
2208
- // here yields its stdout rather than throwing; anything else is a failure
2209
- // with choudoufu's own output attached.
2210
- let text: string;
2211
- try {
2212
- text = (await run(textCmd, dir, env, signal)).stdout;
2213
- } catch (err) {
2214
- const failure = err as ExecFailure;
2215
- if (failure.code !== 2) {
2216
- const detail = (failure.stderr ?? "").trim() || (failure.stdout ?? "").trim();
2217
- throw new Error(
2218
- `${binary} live-plan (human render) failed in ${dir} (exit ${String(failure.code)})` +
2219
- `${detail ? `\n${detail}` : ""}`,
2220
- );
2221
- }
2222
- text = failure.stdout ?? "";
2223
- }
2224
-
2225
- // An `adoptable[]` row carries its own tagging command in the document
2226
- // (choudoufu #962). An `unowned[]` row does not, and the render is the only
2227
- // place one is printed for it, so the parse still runs on an adoption run
2228
- // and the map still feeds that half. A candidate off an ordinary run carries
2229
- // the two marker values and no command, which is the whole ownership
2230
- // contract either way.
2231
- const ledger = readAdoptionLedger(json, args.adoptionOnly ? parseAdoptionCommands(text) : undefined);
2232
- const ledgerText = renderAdoptionLedger(ledger, estate);
2233
-
2234
- return {
2235
- drift,
2236
- json,
2237
- text,
2238
- ledger: ledgerText,
2239
- finding: `${text.trimEnd()}\n\n${ledgerText}\n`,
2240
- adoptions: ledger.adoptions,
2241
- contested: ledger.contested,
2242
- ambiguous: ledger.ambiguous,
2243
- swept: ledger.swept,
2244
- dir,
2245
- documentPath,
2246
- estate,
2247
- ...unowned,
2248
- ...parseChoudoufuPlanSummary(text),
2249
- };
2250
- }
2251
-
2252
- /** What {@link choudoufuLiveGraph} resolved. */
2253
- export type ChoudoufuLiveGraphResult =
2254
- | {
2255
- /** choudoufu printed the engine graph document. */
2256
- supported: true;
2257
- /** The document, parsed: a GraphIR v1 with `meta.engineGraph` (chant#4527's schema). */
2258
- json: unknown;
2259
- /** Absolute path of the root module directory. */
2260
- dir: string;
2261
- }
2262
- | {
2263
- /** This choudoufu has no `live-graph -from-plan` (older than {@link MIN_CHOUDOUFU_GRAPH_VERSION}). */
2264
- supported: false;
2265
- /** choudoufu's own first line, for the note. */
2266
- detail: string;
2267
- dir: string;
2268
- };
2269
-
2270
- export interface ChoudoufuLiveGraphArgs extends TerraformRootArgs {
2271
- /** Absolute path of the `live-plan -json` document this graph takes its facts from. */
2272
- fromPlan: string;
2273
- /** The estate (`-estate`), for a root that does not declare its own. */
2274
- estate?: string;
2275
- }
2276
-
2277
- /**
2278
- * `choudoufu live-graph -json -from-plan=<file>` (choudoufu#2285, read by
2279
- * chant#4528): the root's graph as one engine graph document, its facts taken
2280
- * from a `live-plan -json` document this process already read. No second live
2281
- * read: choudoufu builds the graph from the configuration and that file
2282
- * alone, starts no provider and calls no cloud, so facts and verdicts come
2283
- * from the same refresh (choudoufu #1014).
2284
- *
2285
- * A usage error ({@link classifyLiveGraphFailure}) resolves `supported:
2286
- * false` rather than throwing, since the caller degrades to no facts; any
2287
- * other failure throws with choudoufu's output. Warnings (an empty scope
2288
- * estate, a plan without `observed_at`) go to stderr and are echoed like
2289
- * every other activity's.
2290
- */
2291
- export async function choudoufuLiveGraph(args: ChoudoufuLiveGraphArgs, signal?: AbortSignal): Promise<ChoudoufuLiveGraphResult> {
2292
- const resolved = await resolveRoot(args, signal);
2293
- const { binary, dir } = resolved;
2294
- const env = terraformEnvironment(resolved.root);
2295
- const estateFlag: { estate?: string } = resolved.estate === undefined && args.estate !== undefined ? { estate: args.estate } : {};
2296
- const cmd = choudoufuLiveGraphCommand({ binary, fromPlan: args.fromPlan, ...estateFlag });
2297
- try {
2298
- const { stdout, stderr } = await run(cmd, dir, env, signal);
2299
- if (stderr) console.error(stderr);
2300
- return { supported: true, json: JSON.parse(liveDocumentFrom(stdout)), dir };
2301
- } catch (err) {
2302
- const failure = err as ExecFailure;
2303
- if (typeof failure.code !== "number") throw err;
2304
- const output = `${failure.stderr ?? ""}\n${failure.stdout ?? ""}`;
2305
- const detail = output.trim().split("\n").find((line) => line.trim() !== "")?.trim() ?? `exit ${failure.code}`;
2306
- if (classifyLiveGraphFailure(failure.code, output) === "unsupported") return { supported: false, detail, dir };
2307
- throw new Error(`${binary} live-graph failed in ${dir} (exit ${failure.code})${detail ? `\n${output.trim()}` : ""}`);
2308
- }
2309
- }
2310
-
2311
- /**
2312
- * `choudoufu live-ls -estate=<estate> -json [-consistent]`: every resource
2313
- * the account holds under the estate, read straight from the Resource Groups
2314
- * Tagging API. No configuration, state or record store is read.
2315
- *
2316
- * Uses the fastIdempotent profile: like `terraformShow`, this reads an
2317
- * artifact-shaped answer and does not plan.
2318
- */
2319
- export async function choudoufuLiveLs(
2320
- args: ChoudoufuLiveLsArgs,
2321
- signal?: AbortSignal,
2322
- ): Promise<ChoudoufuLiveLsResult> {
2323
- const resolved = await resolveRoot(args, signal);
2324
- const { binary, dir } = resolved;
2325
- const estate = resolveEstate(args, resolved, "choudoufuLiveLs");
2326
- const env = terraformEnvironment(resolved.root);
2327
-
2328
- const consistent = args.consistent === true;
2329
- const cmd = choudoufuLiveLsCommand({ binary, estate, ...(consistent ? { consistent: true } : {}) });
2330
- // Shared with every identical listing in the same read session, the way
2331
- // {@link choudoufuLivePlanDocument} shares the document (chant #2498).
2332
- const key = liveReadKey("live-ls", { root: args.root, dir, binary, estate, consistent, env });
2333
- const stdout = await memoLiveRead(key, async () => {
2334
- const result = await run(cmd, dir, env, signal);
2335
- report(result.stdout, result.stderr);
2336
- return result.stdout;
2337
- });
2338
-
2339
- return { json: JSON.parse(stdout), dir, estate };
2340
- }
2341
-
2342
- /**
2343
- * Claim the adoptable matches an adoption ledger found, by writing the two
2344
- * ownership markers onto each live resource (#2105).
2345
- *
2346
- * ## Why a tag write and not a policy verb
2347
- *
2348
- * choudoufu's `policy` block has an `adopt` verb for exactly this cell
2349
- * (`declared_untagged`), and `site/content/docs/use/migrate.md` names
2350
- * `policy { declared_untagged = "adopt" }` as the way to adopt a whole estate
2351
- * at once instead of one resource at a time. That would have been the smaller
2352
- * write: one apply, no tagging calls of chant's own. It is not reachable from
2353
- * outside the configuration, and #2105 checked both ways in:
2354
- *
2355
- * - a `live` block in a terraform override file is dropped in silence.
2356
- * `Module.mergeFile` (choudoufu's `internal/configs/module.go`) merges
2357
- * backends, cloud blocks, providers and resources from an override file
2358
- * and has no `Lives` case at all, so an `override.tf` carrying
2359
- * `terraform { live { policy { declared_untagged = "adopt" } } }` changes
2360
- * nothing. Measured, not inferred: a policy block with a deliberately
2361
- * invalid verb in an override file passes `live-check` clean, and the same
2362
- * block in a primary file is refused by name.
2363
- * - a second primary file carrying one is refused outright: "A module may
2364
- * have only one 'live' block." So is a sidecar beside an in-block form.
2365
- *
2366
- * Which leaves editing the root's own checked-in live configuration, running
2367
- * an apply, and putting it back — a mutation of a reviewed file, with a
2368
- * failure mode (a run that dies between the two edits) that leaves the estate
2369
- * declaring "adopt everything declared and unmarked" for every later apply.
2370
- * chant does not do that to a repository it does not own.
2371
- *
2372
- * So the mechanism is the tag write, which choudoufu's own migration guide
2373
- * calls the whole contract: "There is no `choudoufu adopt` command and no need
2374
- * for one. Two tags is the whole contract (`live/MARKERS.md`), so any tool
2375
- * that writes two tags can adopt a resource." The command each write runs is
2376
- * the paste-ready one choudoufu printed under `live-plan -adoption-only`,
2377
- * carried on the candidate — built from choudoufu's own provider
2378
- * configuration, so it lands on the region and endpoint the plan just read
2379
- * rather than wherever an operator's AWS CLI profile points, and shell-quoted
2380
- * by choudoufu for exactly this use.
2381
- *
2382
- * ## What it refuses
2383
- *
2384
- * A candidate with no printed command (a service whose tagging call this fork
2385
- * does not spell out: IAM, Route53, S3) is refused with its two marker values
2386
- * named, not guessed at. A contested address — more than one live resource at
2387
- * one declared identity — is refused because no single tag write claims it;
2388
- * `contested` is passed in so the Op's own result names what was refused
2389
- * beside what was written, and nothing in this function can adopt one, since
2390
- * `readAdoptionLedger` never puts a contested candidate in `adoptions`.
2391
- *
2392
- * Uses the longInfra profile: one tagging round trip per resource, against the
2393
- * cloud.
2394
- */
2395
- export async function choudoufuAdopt(
2396
- args: ChoudoufuAdoptArgs,
2397
- signal?: AbortSignal,
2398
- ): Promise<ChoudoufuAdoptResult> {
2399
- const resolved = await resolveRoot(args, signal);
2400
- const { dir } = resolved;
2401
- const env = terraformEnvironment(resolved.root);
2402
- const adoptions = args.adoptions ?? [];
2403
- const contested = args.contested ?? [];
2404
-
2405
- const adopted: string[] = [];
2406
- const refused: AdoptionRefusal[] = [];
2407
-
2408
- for (const candidate of contested) {
2409
- refused.push({
2410
- addr: candidate.addr,
2411
- identity: candidate.identity,
2412
- reason:
2413
- "more than one live resource sits at this declared identity, so no single tag write claims it. " +
2414
- `Delete the duplicate, or write tofu-estate=${candidate.markerEstate} ` +
2415
- `tofu-address=${candidate.markerAddress} onto the one you mean.`,
2416
- });
2417
- }
2418
-
2419
- for (const candidate of adoptions) {
2420
- if (!candidate.command) {
2421
- refused.push({
2422
- addr: candidate.addr,
2423
- identity: candidate.identity,
2424
- reason:
2425
- `${candidate.type} is tagged through its own service call, which choudoufu does not print a ` +
2426
- `command for. Write tofu-estate=${candidate.markerEstate} ` +
2427
- `tofu-address=${candidate.markerAddress} onto it with that call.`,
2428
- });
2429
- continue;
2430
- }
2431
- const { stdout, stderr } = await run(candidate.command, dir, env, signal);
2432
- report(stdout, stderr);
2433
- adopted.push(candidate.addr);
2434
- }
2435
-
2436
- return {
2437
- mechanism: "tag-write",
2438
- adopted,
2439
- adoptedCount: adopted.length,
2440
- refused,
2441
- ambiguous: new Set(contested.map((c) => c.addr)).size,
2442
- dir,
2443
- };
2444
- }
2445
-
2446
- /**
2447
- * `choudoufu live-check -json`: whether the configuration in this root can
2448
- * move under live resource markers, and what stops it if it cannot. Makes no
2449
- * cloud calls and needs no `live` block at all, since the check this activity
2450
- * runs works on any configuration, which is why it needs no `estate`.
2451
- *
2452
- * A non-zero exit is a refusal choudoufu reports, not a failure of this
2453
- * activity: `refused: true` carries it back rather than throwing. An abort
2454
- * or a spawn failure (no numeric exit code) still throws.
2455
- *
2456
- * Uses the fastIdempotent profile: no cloud calls, no state.
2457
- */
2458
- export async function choudoufuLiveCheck(
2459
- args: ChoudoufuLiveCheckArgs,
2460
- signal?: AbortSignal,
2461
- ): Promise<ChoudoufuLiveCheckResult> {
2462
- const { binary, root, dir } = await resolveRoot(args, signal);
2463
- const env = terraformEnvironment(root);
2464
- const cmd = choudoufuLiveCheckCommand({ binary });
2465
-
2466
- const parseOrUndefined = (text: string): unknown => {
2467
- try {
2468
- return JSON.parse(text);
2469
- } catch {
2470
- return undefined;
2471
- }
2472
- };
2473
- try {
2474
- const { stdout, stderr } = await run(cmd, dir, env, signal);
2475
- report(stdout, stderr);
2476
- return { refused: false, json: parseOrUndefined(stdout), text: stdout, dir };
2477
- } catch (err) {
2478
- const failure = err as ExecFailure;
2479
- if (typeof failure.code !== "number") throw err;
2480
- const stdout = failure.stdout ?? "";
2481
- report(stdout, failure.stderr ?? "");
2482
- return { refused: true, json: parseOrUndefined(stdout), text: stdout, dir };
2483
- }
2484
- }