@intentius/chant-lexicon-terraform 0.57.0 → 0.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. package/dist/composites/terraform-adopt-op.d.ts +126 -0
  2. package/dist/composites/terraform-adopt-op.d.ts.map +1 -0
  3. package/dist/composites/terraform-apply-op.d.ts +63 -16
  4. package/dist/composites/terraform-apply-op.d.ts.map +1 -1
  5. package/dist/composites/terraform-watch-op.d.ts +80 -36
  6. package/dist/composites/terraform-watch-op.d.ts.map +1 -1
  7. package/dist/config.d.ts +49 -2
  8. package/dist/config.d.ts.map +1 -1
  9. package/dist/describe-resources.d.ts +256 -16
  10. package/dist/describe-resources.d.ts.map +1 -1
  11. package/dist/hcl/descend.d.ts +98 -0
  12. package/dist/hcl/descend.d.ts.map +1 -0
  13. package/dist/hcl/marker.d.ts +130 -0
  14. package/dist/hcl/marker.d.ts.map +1 -0
  15. package/dist/hcl/parse.d.ts +142 -9
  16. package/dist/hcl/parse.d.ts.map +1 -1
  17. package/dist/hcl/references.d.ts +76 -0
  18. package/dist/hcl/references.d.ts.map +1 -0
  19. package/dist/hcl/roots.d.ts +22 -3
  20. package/dist/hcl/roots.d.ts.map +1 -1
  21. package/dist/hcl/suppressions.d.ts +54 -0
  22. package/dist/hcl/suppressions.d.ts.map +1 -0
  23. package/dist/hcl/value.d.ts +77 -0
  24. package/dist/hcl/value.d.ts.map +1 -0
  25. package/dist/index.d.ts +5 -2
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/integrity.json +32 -5
  28. package/dist/lint/audit-catalog.d.ts +3 -2
  29. package/dist/lint/audit-catalog.d.ts.map +1 -1
  30. package/dist/lint/audit-lineage.d.ts +68 -0
  31. package/dist/lint/audit-lineage.d.ts.map +1 -1
  32. package/dist/lint/post-synth/blocks.d.ts +53 -0
  33. package/dist/lint/post-synth/blocks.d.ts.map +1 -0
  34. package/dist/lint/post-synth/fixtures/load.d.ts +37 -0
  35. package/dist/lint/post-synth/fixtures/load.d.ts.map +1 -0
  36. package/dist/lint/post-synth/index.d.ts.map +1 -1
  37. package/dist/lint/post-synth/module-source.d.ts +38 -0
  38. package/dist/lint/post-synth/module-source.d.ts.map +1 -0
  39. package/dist/lint/post-synth/scope.d.ts +65 -0
  40. package/dist/lint/post-synth/scope.d.ts.map +1 -0
  41. package/dist/lint/post-synth/tf001.d.ts +18 -0
  42. package/dist/lint/post-synth/tf001.d.ts.map +1 -1
  43. package/dist/lint/post-synth/tf002.d.ts +32 -0
  44. package/dist/lint/post-synth/tf002.d.ts.map +1 -0
  45. package/dist/lint/post-synth/tf003.d.ts +22 -0
  46. package/dist/lint/post-synth/tf003.d.ts.map +1 -0
  47. package/dist/lint/post-synth/tf004.d.ts +22 -0
  48. package/dist/lint/post-synth/tf004.d.ts.map +1 -0
  49. package/dist/lint/post-synth/tf005.d.ts +28 -0
  50. package/dist/lint/post-synth/tf005.d.ts.map +1 -0
  51. package/dist/lint/post-synth/tf006.d.ts +21 -0
  52. package/dist/lint/post-synth/tf006.d.ts.map +1 -0
  53. package/dist/lint/post-synth/tf007.d.ts +21 -0
  54. package/dist/lint/post-synth/tf007.d.ts.map +1 -0
  55. package/dist/lint/post-synth/tf008.d.ts +22 -0
  56. package/dist/lint/post-synth/tf008.d.ts.map +1 -0
  57. package/dist/lint/post-synth/tf009.d.ts +24 -0
  58. package/dist/lint/post-synth/tf009.d.ts.map +1 -0
  59. package/dist/lint/post-synth/tf010.d.ts +19 -0
  60. package/dist/lint/post-synth/tf010.d.ts.map +1 -0
  61. package/dist/lint/post-synth/tf011.d.ts +18 -0
  62. package/dist/lint/post-synth/tf011.d.ts.map +1 -0
  63. package/dist/lint/post-synth/tf012.d.ts +17 -0
  64. package/dist/lint/post-synth/tf012.d.ts.map +1 -0
  65. package/dist/lint/post-synth/tf013.d.ts +21 -0
  66. package/dist/lint/post-synth/tf013.d.ts.map +1 -0
  67. package/dist/lint/post-synth/tf014.d.ts +25 -0
  68. package/dist/lint/post-synth/tf014.d.ts.map +1 -0
  69. package/dist/lint/post-synth/tf015.d.ts +21 -0
  70. package/dist/lint/post-synth/tf015.d.ts.map +1 -0
  71. package/dist/lint/post-synth/tf016.d.ts +30 -0
  72. package/dist/lint/post-synth/tf016.d.ts.map +1 -0
  73. package/dist/lint/post-synth/tf017.d.ts +19 -0
  74. package/dist/lint/post-synth/tf017.d.ts.map +1 -0
  75. package/dist/lint/post-synth/tf018.d.ts +20 -0
  76. package/dist/lint/post-synth/tf018.d.ts.map +1 -0
  77. package/dist/lint/post-synth/tf019.d.ts +25 -0
  78. package/dist/lint/post-synth/tf019.d.ts.map +1 -0
  79. package/dist/lint/post-synth/tf020.d.ts +38 -0
  80. package/dist/lint/post-synth/tf020.d.ts.map +1 -0
  81. package/dist/lint/post-synth/tf021.d.ts +41 -0
  82. package/dist/lint/post-synth/tf021.d.ts.map +1 -0
  83. package/dist/lint/post-synth/tf022.d.ts +24 -0
  84. package/dist/lint/post-synth/tf022.d.ts.map +1 -0
  85. package/dist/lint/post-synth/tf024.d.ts +24 -0
  86. package/dist/lint/post-synth/tf024.d.ts.map +1 -0
  87. package/dist/lint/post-synth/tf025.d.ts +29 -0
  88. package/dist/lint/post-synth/tf025.d.ts.map +1 -0
  89. package/dist/lint/post-synth/tf026.d.ts +21 -0
  90. package/dist/lint/post-synth/tf026.d.ts.map +1 -0
  91. package/dist/lint/rules/fixtures/load.d.ts +13 -0
  92. package/dist/lint/rules/fixtures/load.d.ts.map +1 -0
  93. package/dist/lint/rules/plan-before-apply.d.ts +11 -0
  94. package/dist/lint/rules/plan-before-apply.d.ts.map +1 -1
  95. package/dist/lint/secret-shape.d.ts +68 -0
  96. package/dist/lint/secret-shape.d.ts.map +1 -0
  97. package/dist/live-ownership.d.ts +55 -0
  98. package/dist/live-ownership.d.ts.map +1 -0
  99. package/dist/lsp/option-keys.d.ts.map +1 -1
  100. package/dist/manifest.json +1 -1
  101. package/dist/okf/index.md +24 -0
  102. package/dist/okf/rules/TF002.md +11 -0
  103. package/dist/okf/rules/TF003.md +11 -0
  104. package/dist/okf/rules/TF004.md +11 -0
  105. package/dist/okf/rules/TF005.md +11 -0
  106. package/dist/okf/rules/TF006.md +11 -0
  107. package/dist/okf/rules/TF007.md +11 -0
  108. package/dist/okf/rules/TF008.md +11 -0
  109. package/dist/okf/rules/TF009.md +11 -0
  110. package/dist/okf/rules/TF010.md +11 -0
  111. package/dist/okf/rules/TF011.md +11 -0
  112. package/dist/okf/rules/TF012.md +11 -0
  113. package/dist/okf/rules/TF013.md +11 -0
  114. package/dist/okf/rules/TF014.md +11 -0
  115. package/dist/okf/rules/TF015.md +11 -0
  116. package/dist/okf/rules/TF016.md +11 -0
  117. package/dist/okf/rules/TF017.md +11 -0
  118. package/dist/okf/rules/TF018.md +11 -0
  119. package/dist/okf/rules/TF019.md +11 -0
  120. package/dist/okf/rules/TF020.md +11 -0
  121. package/dist/okf/rules/TF021.md +11 -0
  122. package/dist/okf/rules/TF022.md +11 -0
  123. package/dist/okf/rules/TF024.md +11 -0
  124. package/dist/okf/rules/TF025.md +11 -0
  125. package/dist/okf/rules/TF026.md +11 -0
  126. package/dist/op/activities/index.d.ts +13 -6
  127. package/dist/op/activities/index.d.ts.map +1 -1
  128. package/dist/op/activities/live-detect.d.ts +51 -0
  129. package/dist/op/activities/live-detect.d.ts.map +1 -0
  130. package/dist/op/activities/terraform.d.ts +445 -17
  131. package/dist/op/activities/terraform.d.ts.map +1 -1
  132. package/dist/op/activity-contracts.d.ts +148 -0
  133. package/dist/op/activity-contracts.d.ts.map +1 -0
  134. package/dist/op/adoption.d.ts +118 -0
  135. package/dist/op/adoption.d.ts.map +1 -0
  136. package/dist/op/builders.d.ts +46 -6
  137. package/dist/op/builders.d.ts.map +1 -1
  138. package/dist/op/resolve-root-mode.d.ts +45 -0
  139. package/dist/op/resolve-root-mode.d.ts.map +1 -0
  140. package/dist/plugin.d.ts.map +1 -1
  141. package/dist/rules/blocks.ts +109 -0
  142. package/dist/rules/module-source.ts +121 -0
  143. package/dist/rules/plan-before-apply.ts +11 -0
  144. package/dist/rules/scope.ts +107 -0
  145. package/dist/rules/tf001.ts +32 -8
  146. package/dist/rules/tf002.ts +151 -0
  147. package/dist/rules/tf003.ts +71 -0
  148. package/dist/rules/tf004.ts +63 -0
  149. package/dist/rules/tf005.ts +76 -0
  150. package/dist/rules/tf006.ts +53 -0
  151. package/dist/rules/tf007.ts +78 -0
  152. package/dist/rules/tf008.ts +75 -0
  153. package/dist/rules/tf009.ts +59 -0
  154. package/dist/rules/tf010.ts +51 -0
  155. package/dist/rules/tf011.ts +49 -0
  156. package/dist/rules/tf012.ts +47 -0
  157. package/dist/rules/tf013.ts +63 -0
  158. package/dist/rules/tf014.ts +72 -0
  159. package/dist/rules/tf015.ts +63 -0
  160. package/dist/rules/tf016.ts +75 -0
  161. package/dist/rules/tf017.ts +50 -0
  162. package/dist/rules/tf018.ts +72 -0
  163. package/dist/rules/tf019.ts +72 -0
  164. package/dist/rules/tf020.ts +123 -0
  165. package/dist/rules/tf021.ts +126 -0
  166. package/dist/rules/tf022.ts +61 -0
  167. package/dist/rules/tf024.ts +70 -0
  168. package/dist/rules/tf025.ts +101 -0
  169. package/dist/rules/tf026.ts +80 -0
  170. package/dist/skills/chant-terraform.md +1 -1
  171. package/package.json +7 -2
  172. package/src/__fixtures__/live/main.tf +28 -0
  173. package/src/__fixtures__/live-adopt/estate.chdf.hcl +6 -0
  174. package/src/__fixtures__/live-adopt/main.tf +21 -0
  175. package/src/__fixtures__/live-estate/README.md +58 -0
  176. package/src/__fixtures__/live-estate/compute.tf +10 -0
  177. package/src/__fixtures__/live-estate/estate.chdf.hcl +1 -0
  178. package/src/__fixtures__/live-estate/logs.tf +8 -0
  179. package/src/__fixtures__/live-estate/network.tf +24 -0
  180. package/src/__fixtures__/live-estate/rule.tf +11 -0
  181. package/src/__fixtures__/live-estate/unowned.tf +21 -0
  182. package/src/__fixtures__/live-estate/versions.tf +31 -0
  183. package/src/__fixtures__/live-ls.json +98 -0
  184. package/src/__fixtures__/live-plan.json +285 -0
  185. package/src/__fixtures__/live-sidecar/estate.chdf.hcl +3 -0
  186. package/src/__fixtures__/live-sidecar/main.tf +24 -0
  187. package/src/__fixtures__/module-tree/README.md +16 -0
  188. package/src/__fixtures__/module-tree/cycle/main.tf +3 -0
  189. package/src/__fixtures__/module-tree/cycle/modules/a/main.tf +9 -0
  190. package/src/__fixtures__/module-tree/cycle/modules/b/main.tf +9 -0
  191. package/src/__fixtures__/module-tree/missing/main.tf +9 -0
  192. package/src/__fixtures__/module-tree/outside/root/main.tf +9 -0
  193. package/src/__fixtures__/module-tree/root/main.tf +28 -0
  194. package/src/__fixtures__/module-tree/root/modules/cdn/main.tf +15 -0
  195. package/src/__fixtures__/module-tree/root/modules/cdn/modules/bucket/main.tf +11 -0
  196. package/src/__fixtures__/module-tree/shared/main.tf +5 -0
  197. package/src/__fixtures__/references/main.tf +56 -0
  198. package/src/codegen/lint-rules-page.test.ts +28 -0
  199. package/src/composites/terraform-adopt-op.acceptance.test.ts +166 -0
  200. package/src/composites/terraform-adopt-op.test.ts +170 -0
  201. package/src/composites/terraform-adopt-op.ts +197 -0
  202. package/src/composites/terraform-apply-op.acceptance.test.ts +183 -5
  203. package/src/composites/terraform-apply-op.test.ts +167 -15
  204. package/src/composites/terraform-apply-op.ts +105 -28
  205. package/src/composites/terraform-watch-op.test.ts +85 -26
  206. package/src/composites/terraform-watch-op.ts +130 -73
  207. package/src/config.ts +32 -3
  208. package/src/describe-resources.live.test.ts +598 -0
  209. package/src/describe-resources.test.ts +53 -0
  210. package/src/describe-resources.ts +811 -28
  211. package/src/hcl/descend.test.ts +162 -0
  212. package/src/hcl/descend.ts +273 -0
  213. package/src/hcl/marker.test.ts +147 -0
  214. package/src/hcl/marker.ts +235 -0
  215. package/src/hcl/parse.test.ts +69 -0
  216. package/src/hcl/parse.ts +249 -27
  217. package/src/hcl/references.test.ts +116 -0
  218. package/src/hcl/references.ts +172 -0
  219. package/src/hcl/roots.ts +59 -5
  220. package/src/hcl/suppressions.test.ts +147 -0
  221. package/src/hcl/suppressions.ts +204 -0
  222. package/src/hcl/value.test.ts +73 -0
  223. package/src/hcl/value.ts +106 -0
  224. package/src/index.ts +31 -1
  225. package/src/lint/audit-catalog.ts +264 -3
  226. package/src/lint/audit-lineage.ts +319 -1
  227. package/src/lint/audit.test.ts +40 -1
  228. package/src/lint/post-synth/blocks.ts +109 -0
  229. package/src/lint/post-synth/fixtures/TF001/negative.tf +28 -0
  230. package/src/lint/post-synth/fixtures/TF001/positive.tf +24 -0
  231. package/src/lint/post-synth/fixtures/TF002/negative.tf +17 -0
  232. package/src/lint/post-synth/fixtures/TF002/positive-legacy.tf +10 -0
  233. package/src/lint/post-synth/fixtures/TF002/positive-no-version.tf +12 -0
  234. package/src/lint/post-synth/fixtures/TF002/positive.tf +7 -0
  235. package/src/lint/post-synth/fixtures/TF003/negative.tf +10 -0
  236. package/src/lint/post-synth/fixtures/TF003/positive.tf +8 -0
  237. package/src/lint/post-synth/fixtures/TF004/negative-git.tf +3 -0
  238. package/src/lint/post-synth/fixtures/TF004/negative-local.tf +3 -0
  239. package/src/lint/post-synth/fixtures/TF004/negative.tf +4 -0
  240. package/src/lint/post-synth/fixtures/TF004/positive.tf +3 -0
  241. package/src/lint/post-synth/fixtures/TF005/negative-local.tf +3 -0
  242. package/src/lint/post-synth/fixtures/TF005/negative-registry.tf +3 -0
  243. package/src/lint/post-synth/fixtures/TF005/negative-sha.tf +3 -0
  244. package/src/lint/post-synth/fixtures/TF005/negative.tf +3 -0
  245. package/src/lint/post-synth/fixtures/TF005/positive-branch.tf +3 -0
  246. package/src/lint/post-synth/fixtures/TF005/positive-non-semver.tf +3 -0
  247. package/src/lint/post-synth/fixtures/TF005/positive.tf +3 -0
  248. package/src/lint/post-synth/fixtures/TF006/negative.tf +5 -0
  249. package/src/lint/post-synth/fixtures/TF006/positive-empty-default.tf +11 -0
  250. package/src/lint/post-synth/fixtures/TF006/positive.tf +6 -0
  251. package/src/lint/post-synth/fixtures/TF007/negative.tf +10 -0
  252. package/src/lint/post-synth/fixtures/TF007/positive.tf +9 -0
  253. package/src/lint/post-synth/fixtures/TF008/negative-variable.tf +10 -0
  254. package/src/lint/post-synth/fixtures/TF008/negative.tf +8 -0
  255. package/src/lint/post-synth/fixtures/TF008/positive-other-provider.tf +10 -0
  256. package/src/lint/post-synth/fixtures/TF008/positive.tf +5 -0
  257. package/src/lint/post-synth/fixtures/TF009/negative.tf +10 -0
  258. package/src/lint/post-synth/fixtures/TF009/positive.tf +4 -0
  259. package/src/lint/post-synth/fixtures/TF010/negative.tf +5 -0
  260. package/src/lint/post-synth/fixtures/TF010/positive.tf +4 -0
  261. package/src/lint/post-synth/fixtures/TF011/negative.tf +5 -0
  262. package/src/lint/post-synth/fixtures/TF011/positive-blank.tf +5 -0
  263. package/src/lint/post-synth/fixtures/TF011/positive.tf +4 -0
  264. package/src/lint/post-synth/fixtures/TF012/negative.tf +4 -0
  265. package/src/lint/post-synth/fixtures/TF012/positive.tf +3 -0
  266. package/src/lint/post-synth/fixtures/TF013/negative.tf +8 -0
  267. package/src/lint/post-synth/fixtures/TF013/positive-data.tf +8 -0
  268. package/src/lint/post-synth/fixtures/TF013/positive.tf +8 -0
  269. package/src/lint/post-synth/fixtures/TF014/negative/main.tf +26 -0
  270. package/src/lint/post-synth/fixtures/TF014/negative/modules/cdn/main.tf +19 -0
  271. package/src/lint/post-synth/fixtures/TF014/positive/main.tf +16 -0
  272. package/src/lint/post-synth/fixtures/TF014/positive/modules/cdn/main.tf +15 -0
  273. package/src/lint/post-synth/fixtures/TF015/negative/main.tf +13 -0
  274. package/src/lint/post-synth/fixtures/TF015/negative/modules/cdn/main.tf +16 -0
  275. package/src/lint/post-synth/fixtures/TF015/positive/main.tf +13 -0
  276. package/src/lint/post-synth/fixtures/TF015/positive/modules/cdn/main.tf +14 -0
  277. package/src/lint/post-synth/fixtures/TF016/negative-template.tf +7 -0
  278. package/src/lint/post-synth/fixtures/TF016/negative.tf +16 -0
  279. package/src/lint/post-synth/fixtures/TF016/positive-shared-file.tf +12 -0
  280. package/src/lint/post-synth/fixtures/TF016/positive.tf +13 -0
  281. package/src/lint/post-synth/fixtures/TF017/negative.tf +4 -0
  282. package/src/lint/post-synth/fixtures/TF017/positive.tf +5 -0
  283. package/src/lint/post-synth/fixtures/TF018/negative.tf +9 -0
  284. package/src/lint/post-synth/fixtures/TF018/positive-data.tf +9 -0
  285. package/src/lint/post-synth/fixtures/TF018/positive.tf +4 -0
  286. package/src/lint/post-synth/fixtures/TF019/negative.tf +14 -0
  287. package/src/lint/post-synth/fixtures/TF019/positive-output.tf +5 -0
  288. package/src/lint/post-synth/fixtures/TF019/positive.tf +16 -0
  289. package/src/lint/post-synth/fixtures/TF020/negative.tf +43 -0
  290. package/src/lint/post-synth/fixtures/TF020/positive.tf +32 -0
  291. package/src/lint/post-synth/fixtures/TF020/scoped/main.tf +21 -0
  292. package/src/lint/post-synth/fixtures/TF020/scoped/modules/cdn/main.tf +13 -0
  293. package/src/lint/post-synth/fixtures/TF021/negative.tf +31 -0
  294. package/src/lint/post-synth/fixtures/TF021/positive-length.tf +8 -0
  295. package/src/lint/post-synth/fixtures/TF021/positive.tf +8 -0
  296. package/src/lint/post-synth/fixtures/TF022/negative-locator.tf +7 -0
  297. package/src/lint/post-synth/fixtures/TF022/negative.tf +10 -0
  298. package/src/lint/post-synth/fixtures/TF022/positive-nested.tf +10 -0
  299. package/src/lint/post-synth/fixtures/TF022/positive.tf +6 -0
  300. package/src/lint/post-synth/fixtures/TF023/negative/main.tf +15 -0
  301. package/src/lint/post-synth/fixtures/TF023/positive/main.tf +9 -0
  302. package/src/lint/post-synth/fixtures/TF023/positive/state.json +24 -0
  303. package/src/lint/post-synth/fixtures/TF024/live-clean/main.tf +9 -0
  304. package/src/lint/post-synth/fixtures/TF024/live-with-backend/main.tf +14 -0
  305. package/src/lint/post-synth/fixtures/TF024/live-with-cloud/main.tf +16 -0
  306. package/src/lint/post-synth/fixtures/TF025/live-clean/main.tf +13 -0
  307. package/src/lint/post-synth/fixtures/TF025/live-with-workspace-ref/main.tf +13 -0
  308. package/src/lint/post-synth/fixtures/TF026/live-default/main.tf +9 -0
  309. package/src/lint/post-synth/fixtures/TF026/live-explicit-delete/main.tf +13 -0
  310. package/src/lint/post-synth/fixtures/TF026/live-keep/main.tf +13 -0
  311. package/src/lint/post-synth/fixtures/load.ts +108 -0
  312. package/src/lint/post-synth/index.ts +48 -0
  313. package/src/lint/post-synth/module-rules.test.ts +153 -0
  314. package/src/lint/post-synth/module-source.test.ts +75 -0
  315. package/src/lint/post-synth/module-source.ts +121 -0
  316. package/src/lint/post-synth/post-synth.test.ts +14 -15
  317. package/src/lint/post-synth/scope.ts +107 -0
  318. package/src/lint/post-synth/single-block.test.ts +263 -0
  319. package/src/lint/post-synth/suppression.test.ts +110 -0
  320. package/src/lint/post-synth/tf001.ts +32 -8
  321. package/src/lint/post-synth/tf002.test.ts +93 -0
  322. package/src/lint/post-synth/tf002.ts +151 -0
  323. package/src/lint/post-synth/tf003.test.ts +75 -0
  324. package/src/lint/post-synth/tf003.ts +71 -0
  325. package/src/lint/post-synth/tf004.test.ts +47 -0
  326. package/src/lint/post-synth/tf004.ts +63 -0
  327. package/src/lint/post-synth/tf005.test.ts +57 -0
  328. package/src/lint/post-synth/tf005.ts +76 -0
  329. package/src/lint/post-synth/tf006.ts +53 -0
  330. package/src/lint/post-synth/tf007.ts +78 -0
  331. package/src/lint/post-synth/tf008.ts +75 -0
  332. package/src/lint/post-synth/tf009.ts +59 -0
  333. package/src/lint/post-synth/tf010.ts +51 -0
  334. package/src/lint/post-synth/tf011.ts +49 -0
  335. package/src/lint/post-synth/tf012.ts +47 -0
  336. package/src/lint/post-synth/tf013.ts +63 -0
  337. package/src/lint/post-synth/tf014.ts +72 -0
  338. package/src/lint/post-synth/tf015.ts +63 -0
  339. package/src/lint/post-synth/tf016.ts +75 -0
  340. package/src/lint/post-synth/tf017.ts +50 -0
  341. package/src/lint/post-synth/tf018.ts +72 -0
  342. package/src/lint/post-synth/tf019.ts +72 -0
  343. package/src/lint/post-synth/tf020.ts +123 -0
  344. package/src/lint/post-synth/tf021.ts +126 -0
  345. package/src/lint/post-synth/tf022.ts +61 -0
  346. package/src/lint/post-synth/tf024.test.ts +42 -0
  347. package/src/lint/post-synth/tf024.ts +70 -0
  348. package/src/lint/post-synth/tf025.test.ts +46 -0
  349. package/src/lint/post-synth/tf025.ts +101 -0
  350. package/src/lint/post-synth/tf026.test.ts +56 -0
  351. package/src/lint/post-synth/tf026.ts +80 -0
  352. package/src/lint/presets.test.ts +72 -0
  353. package/src/lint/rules/fixtures/TF101/negative-op.ts +2 -0
  354. package/src/lint/rules/fixtures/TF101/positive-op.ts +2 -0
  355. package/src/lint/rules/fixtures/load.ts +53 -0
  356. package/src/lint/rules/plan-before-apply.test.ts +112 -7
  357. package/src/lint/rules/plan-before-apply.ts +11 -0
  358. package/src/lint/secret-shape.test.ts +150 -0
  359. package/src/lint/secret-shape.ts +159 -0
  360. package/src/live-ownership.ts +60 -0
  361. package/src/lsp/completions.test.ts +3 -2
  362. package/src/lsp/option-keys.ts +10 -5
  363. package/src/op/activities/choudoufu.acceptance.test.ts +143 -0
  364. package/src/op/activities/choudoufu.test.ts +693 -0
  365. package/src/op/activities/index.ts +40 -4
  366. package/src/op/activities/live-detect.test.ts +143 -0
  367. package/src/op/activities/live-detect.ts +162 -0
  368. package/src/op/activities/registry.test.ts +11 -3
  369. package/src/op/activities/terraform.test.ts +7 -3
  370. package/src/op/activities/terraform.ts +823 -69
  371. package/src/op/activity-contracts.test.ts +147 -0
  372. package/src/op/activity-contracts.ts +178 -0
  373. package/src/op/adoption.test.ts +170 -0
  374. package/src/op/adoption.ts +241 -0
  375. package/src/op/builders.test.ts +60 -5
  376. package/src/op/builders.ts +93 -5
  377. package/src/op/resolve-root-mode.test.ts +85 -0
  378. package/src/op/resolve-root-mode.ts +72 -0
  379. package/src/plugin.test.ts +68 -0
  380. package/src/plugin.ts +75 -9
  381. package/src/skills/chant-terraform.md +1 -1
@@ -0,0 +1,126 @@
1
+ /**
2
+ * TerraformAdoptOp composite (#2105): claim the live resources a choudoufu
3
+ * estate's configuration already describes.
4
+ *
5
+ * The reconcile position on the lifecycle dial, for the one backend that has
6
+ * a typed path from live back to the configuration. chant #2089 deferred
7
+ * reconcile for the terraform lexicon because stock Terraform has none: a live
8
+ * resource nobody has imported is knowable only as HCL somebody writes, and
9
+ * generating that is a different problem. choudoufu changes the question
10
+ * rather than answering the old one. Ownership there is two tags on the
11
+ * resource (`live/MARKERS.md`), `live-plan` already names every live resource
12
+ * that exactly matches a declared block and carries no marker, and it prints
13
+ * the two values that would claim it. Cloud-to-code here is "claim what the
14
+ * configuration already describes" — a tag write, not a regeneration.
15
+ *
16
+ * Phases: Check, Ledger, Gate, Adopt.
17
+ *
18
+ * - **Check** runs `live-check`, which makes no cloud calls and says whether
19
+ * this configuration can move under markers at all. It runs first because
20
+ * a root that `live-check` refuses will produce an adoption ledger that
21
+ * reads as authoritative and is not, and the cheapest place to find that
22
+ * out is before the estate-wide sweep.
23
+ * - **Ledger** runs `live-plan` with `adoptionOnly`, so the run's human half
24
+ * is choudoufu's own adoption ledger (GitHub issue #587) and its machine
25
+ * half is the bound/omissions/unowned document (#788). The ledger is the
26
+ * approval subject; the document is what the Adopt step acts on.
27
+ * - **Gate** always. Adoption writes tags onto resources this estate does
28
+ * not yet own, which is the moment the estate's boundary moves, and no
29
+ * reading of that is routine enough to skip. There is no `gate: "never"`
30
+ * here, unlike `TerraformApplyOp`, so every run stops at the gate until
31
+ * someone has approved it. A gate is a fact on the gate ledger (#2119):
32
+ * `chant run` records that the run is waiting, ends with status `gated`
33
+ * and exits 3, `chant approve <op> <gate>` writes the resolution, and the
34
+ * next run reads it and walks through to the Adopt phase.
35
+ * - **Adopt** writes the markers. See `choudoufuAdopt`'s own doc for the
36
+ * mechanism and why it is the tag write rather than choudoufu's `adopt`
37
+ * policy verb.
38
+ *
39
+ * ## The adopt mechanism, and why it is not the policy verb
40
+ *
41
+ * choudoufu's `policy` block has an `adopt` verb for the declared-but-unmarked
42
+ * quadrant, and its migration guide names `policy { declared_untagged =
43
+ * "adopt" }` as the way to claim a whole estate at once. That is the smaller
44
+ * write, and #2105 tried to reach it from outside the configuration. It is not
45
+ * reachable: a `live` block in a terraform override file is dropped in silence
46
+ * (choudoufu's `Module.mergeFile` has no `Lives` case), a second primary file
47
+ * carrying one is refused as a duplicate, and a sidecar beside an in-block
48
+ * form is refused as two sources of truth. What is left is editing the root's
49
+ * own checked-in live configuration around an apply, which leaves an estate
50
+ * declaring "adopt everything declared and unmarked" if the run dies between
51
+ * the two edits.
52
+ *
53
+ * So the mechanism is the tag write, which choudoufu's migration guide calls
54
+ * the whole contract: "There is no `choudoufu adopt` command and no need for
55
+ * one. Two tags is the whole contract, so any tool that writes two tags can
56
+ * adopt a resource." Each write runs the paste-ready command choudoufu itself
57
+ * printed in the ledger, carrying its own provider configuration's region and
58
+ * endpoint. `choudoufuAdopt` has the measurements behind that ruling.
59
+ *
60
+ * ## Ambiguity is reported, never resolved
61
+ *
62
+ * Two live resources at one declared identity are two `unowned` entries with
63
+ * the same address, and no single tag write claims that address. Those
64
+ * candidates never enter the adoptable set; the Adopt step is handed them
65
+ * separately so the Op's own result names what it declined and why, beside
66
+ * what it wrote.
67
+ *
68
+ * ## Compensation
69
+ *
70
+ * Refused without a command, the same stance `TerraformApplyOp` takes.
71
+ * Un-adopting is `untag`: dropping this estate's marker from a live resource,
72
+ * which is a decision about the estate rather than something chant can
73
+ * synthesize. It is also not always the right undo — a resource that was
74
+ * already carrying the markers before this run is not one this run adopted.
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * import { TerraformAdoptOp } from "@intentius/chant-lexicon-terraform";
79
+ *
80
+ * export const { op } = TerraformAdoptOp({ name: "estate-adopt", root: "estate" });
81
+ * ```
82
+ */
83
+ import { OpResource } from "@intentius/chant/op";
84
+ export interface TerraformAdoptOpConfig {
85
+ /** Op name (kebab-case). `signalName` defaults to `approve-<name>`. */
86
+ name: string;
87
+ /** Key into the project's `terraform.roots`. Must be a live root: choudoufu, with a declared estate. */
88
+ root: string;
89
+ /**
90
+ * The estate whose markers this run looks for. Omitted, `choudoufuLivePlan`
91
+ * auto-detects it from the root's own `live` block or `estate.chdf.hcl`
92
+ * sidecar, which is the usual case.
93
+ */
94
+ estate?: string;
95
+ /** Gate signal name. Default: `approve-<name>`, as `TerraformApplyOp` does. */
96
+ signalName?: string;
97
+ /** How long a recorded pending gate stays valid, as a duration string. Default: core's own (48h). */
98
+ gateTimeout?: string;
99
+ /** Override the gate description shown to the approver. */
100
+ gateDescription?: string;
101
+ /**
102
+ * Directory each step starts the `chant.config.*` search from, which is what
103
+ * `terraform.roots` and the root's relative `dir` resolve against. Default:
104
+ * the running process's cwd.
105
+ */
106
+ cwd?: string;
107
+ /**
108
+ * Saga-style rollback on a failed adoption, run as an `onFailure` phase.
109
+ *
110
+ * Refused without a command. Undoing an adoption is `untag` — removing this
111
+ * estate's marker from a live resource — which is a decision about the
112
+ * estate, and one this Op cannot even scope correctly: a resource that
113
+ * already carried the markers is not one this run claimed. So `true`, or an
114
+ * object with no `command`, throws when the Op is built, naming the Op,
115
+ * rather than warning at the moment a rollback is already wanted.
116
+ */
117
+ compensate?: boolean | {
118
+ command?: string;
119
+ };
120
+ }
121
+ export interface TerraformAdoptOpResources {
122
+ /** Op resource. Generates the Check/Ledger/Gate/Adopt workflow. */
123
+ op: InstanceType<typeof OpResource>;
124
+ }
125
+ export declare function TerraformAdoptOp(config: TerraformAdoptOpConfig): TerraformAdoptOpResources;
126
+ //# sourceMappingURL=terraform-adopt-op.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terraform-adopt-op.d.ts","sourceRoot":"","sources":["../../src/composites/terraform-adopt-op.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AAEH,OAAO,EAA6B,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAO5E,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,wGAAwG;IACxG,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qGAAqG;IACrG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C;AAED,MAAM,WAAW,yBAAyB;IACxC,mEAAmE;IACnE,EAAE,EAAE,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;CACrC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,yBAAyB,CAiE1F"}
@@ -1,17 +1,66 @@
1
1
  /**
2
- * TerraformApplyOp composite (#2086) — init, plan, approve, apply for one root
2
+ * TerraformApplyOp composite (#2086), init, plan, approve, apply for one root
3
3
  * module named in `terraform.roots`.
4
4
  *
5
5
  * Authority stays with terraform: chant runs the binary, reads its plan, and
6
- * hands the same saved plan to apply. The Apply step never re-plans, because
7
- * it takes the Plan step's own `planFile` as a `StepOutputRef` — whatever was
8
- * approved is what runs.
6
+ * hands the same saved plan to apply. The Apply step never applies something
7
+ * no gate saw, because it takes the Plan step's own `planFile` as a
8
+ * `StepOutputRef`.
9
9
  *
10
- * Phases: Init, Plan, Gate, Apply.
10
+ * Phases: Init, Plan, Gate, Apply. One shape, both kinds of root. A live root
11
+ * (#2103, `terraform.binary: "choudoufu"` plus a declared estate) ran a
12
+ * different shape for one release, because choudoufu refused `-out` and
13
+ * `apply <planfile>`; choudoufu v0.13.0 admits both under a `live` block
14
+ * ([choudoufu #878](https://github.com/INTENTIUS/choudoufu/issues/878),
15
+ * PR 889), so the plan-file discipline is back and the two shapes are one
16
+ * again.
11
17
  *
12
- * The gate is durable-runtime work, so an Op that emits one needs Temporal;
13
- * `packages/core/src/op/local-executor.ts` refuses any Op containing a gate.
14
- * `gate: "never"` is what makes the Op runnable with `chant run` locally.
18
+ * **What the approval covers on a live root.** `plan -out=<planFile>` writes
19
+ * stock's own plan file, and that file is what the approver reads and what
20
+ * the Apply step names. `apply <planFile>` does not replay it: prior state on
21
+ * a live root is a projection rebuilt from the live system every run, so the
22
+ * apply re-plans against the live system the way every live-markers run does,
23
+ * then compares its fresh plan with the file's. Same addresses, same actions,
24
+ * same live objects, and the same planned values, or it refuses before
25
+ * anything changes:
26
+ *
27
+ * - `The approved plan no longer matches the live system`, and
28
+ * - `The approved plan belongs to a different estate`,
29
+ *
30
+ * both with exit status **3**, which is neither 1 (any ordinary failure) nor
31
+ * `-detailed-exitcode`'s 2. `terraformApply` maps that status to a named
32
+ * result rather than a thrown error (`refused: "approval-mismatch" |
33
+ * "wrong-estate"`, with choudoufu's message in `refusal`), so a workflow
34
+ * reading the Apply step's output can route the run back to review instead of
35
+ * treating it as a broken step. The seam #2106 left named and unused on the
36
+ * apply args is now the plan file itself.
37
+ *
38
+ * TF101 therefore fires on a live root's `terraformApply` call again: there
39
+ * is a plan file to pair once more, and pairing it is what the refusal above
40
+ * has to compare against.
41
+ *
42
+ * **Delete modes.** chant's `delete: "never" | "owned-only" | "gated"`
43
+ * (`terraform.roots.<name>.delete`, `../config.ts`) maps onto choudoufu's
44
+ * `policy` block. `"owned-only"` is choudoufu's own default verb for the
45
+ * `undeclared_tagged` quadrant (an orphaned marked resource) and needs
46
+ * nothing; `"gated"` needs nothing beyond this composite's own approval gate;
47
+ * `"never"` requires the root's `policy` block to set `undeclared_tagged` to
48
+ * `"keep"`, `"untag"` or `"report"`, and TF026 (`../lint/post-synth/tf026.ts`)
49
+ * enforces that at build time, naming the setting to add. Separately, and
50
+ * regardless of `delete`, this composite refuses outright to build against a
51
+ * root whose `policy` sets `undeclared_untagged = "delete"` (account-scoped
52
+ * reconciliation, which needs a `scope` block): that quadrant deletes
53
+ * resources the estate never claimed, anywhere the scope reaches, and chant
54
+ * never proposes deleting a resource it does not own, not for a root, and not
55
+ * for an Op it generated.
56
+ *
57
+ * A gate is a fact on the gate ledger, not a wait (#2119). Reaching one,
58
+ * `chant run` consults the ledger (`packages/core/src/op/gate.ts`): a
59
+ * resolution newer than the gate's newest pending fact lets the run walk
60
+ * through, and anything else records the pending fact and ends the run with
61
+ * status `gated` and exit 3. `chant approve <op> <gate>` writes the
62
+ * resolution, and the next run reads it. `gate: "never"` drops the Gate phase
63
+ * entirely, so a run never stops.
15
64
  *
16
65
  * @example
17
66
  * ```typescript
@@ -29,13 +78,13 @@ import { OpResource } from "@intentius/chant/op";
29
78
  * cannot branch at build time on a count the plan only produces at run time.
30
79
  * The workable v1 is that `"on-destroy"` and `"always"` emit the same Gate
31
80
  * phase, and the approver is told what is at stake instead: the phase reports
32
- * the plan's `destroys` count as the `Destroys` search attribute before it
33
- * waits, and the gate description says so. A gate that skips itself when the
34
- * plan turns out additive is a new step kind, out of scope here.
81
+ * the plan's `destroys` count as the `Destroys` run outcome before the
82
+ * gate is reached, and the gate description says so. A gate that skips itself
83
+ * when the plan turns out additive is a new step kind, out of scope here.
35
84
  */
36
85
  export type TerraformGateMode = "on-destroy" | "always" | "never";
37
86
  export interface TerraformApplyOpConfig {
38
- /** Op name (kebab-case). Also the default task queue and gate signal suffix. */
87
+ /** Op name (kebab-case). `signalName` defaults to `approve-<name>`. */
39
88
  name: string;
40
89
  /** Key into the project's `terraform.roots`. The root carries dir, workspace, var files and backend config. */
41
90
  root: string;
@@ -49,7 +98,7 @@ export interface TerraformApplyOpConfig {
49
98
  gate?: TerraformGateMode;
50
99
  /** Gate signal name. Default: `approve-<name>`, as `ApplyOp` does. */
51
100
  signalName?: string;
52
- /** Temporal duration the gate waits before timing out. Default: core's own (48h). */
101
+ /** How long a recorded pending gate stays valid, as a duration string. Default: core's own (48h). */
53
102
  gateTimeout?: string;
54
103
  /** Override the gate description shown to the approver. */
55
104
  gateDescription?: string;
@@ -68,7 +117,7 @@ export interface TerraformApplyOpConfig {
68
117
  * Terraform has no automatic rollback: a half-applied plan is undone by
69
118
  * planning and applying the inverse, which is a decision about the estate
70
119
  * rather than something chant can synthesize. So compensation here is
71
- * total or refused, the same stance `ApplyOp` takes (`lexicons/temporal/src/
120
+ * total or refused, the same stance `ApplyOp` takes (`packages/core/src/op/
72
121
  * composites/apply-op.ts`) — `true`, or an object with no `command`, throws
73
122
  * when the Op is built, naming the Op, rather than warning at the moment a
74
123
  * rollback is already needed. Supply `compensate: { command: "..." }` with a
@@ -77,8 +126,6 @@ export interface TerraformApplyOpConfig {
77
126
  compensate?: boolean | {
78
127
  command?: string;
79
128
  };
80
- /** Override the task queue. Defaults to `name`. */
81
- taskQueue?: string;
82
129
  }
83
130
  export interface TerraformApplyOpResources {
84
131
  /** Op resource — generates the Init/Plan/[Gate]/Apply workflow. */
@@ -1 +1 @@
1
- {"version":3,"file":"terraform-apply-op.d.ts","sourceRoot":"","sources":["../../src/composites/terraform-apply-op.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAA6B,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAS5E;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,sBAAsB;IACrC,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,+GAA+G;IAC/G,IAAI,EAAE,MAAM,CAAC;IACb,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,mEAAmE;IACnE,EAAE,EAAE,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;CACrC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,yBAAyB,CAqE1F"}
1
+ {"version":3,"file":"terraform-apply-op.d.ts","sourceRoot":"","sources":["../../src/composites/terraform-apply-op.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AAEH,OAAO,EAA6B,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAW5E;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,+GAA+G;IAC/G,IAAI,EAAE,MAAM,CAAC;IACb,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qGAAqG;IACrG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C;AAED,MAAM,WAAW,yBAAyB;IACxC,mEAAmE;IACnE,EAAE,EAAE,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;CACrC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,yBAAyB,CAiG1F"}
@@ -7,7 +7,7 @@
7
7
  * the plan found. `terraform plan -detailed-exitcode` is the whole mechanism.
8
8
  * Exit 0 is "the world matches the configuration", exit 2 is drift, and
9
9
  * `terraformPlan` turns that into the boolean `changed`, which rides out of
10
- * the Op as the `Drift` search attribute.
10
+ * the Op as the run's `Drift` outcome.
11
11
  *
12
12
  * Phases: Init, Plan, and (for a finding mode that opens something) Report.
13
13
  *
@@ -23,37 +23,55 @@
23
23
  * post the JSON, and `terraform-watch-op.test.ts` asserts no reference to it
24
24
  * reaches the finding step.
25
25
  *
26
+ * The same rule holds on a live root, where the JSON is choudoufu's own
27
+ * bound/omissions/unowned document rather than a plan representation, and
28
+ * carries live identities and tag values for every resource the estate
29
+ * touched. `choudoufuLivePlan` composes the plan text and the adoption ledger
30
+ * into one `finding` string for exactly this reason: the body is one
31
+ * reference to one text field, so there is no arrangement of the args in
32
+ * which the document reaches a body.
33
+ *
34
+ * ## A live root reports three things, not one (#2105)
35
+ *
36
+ * `live: true` swaps the Plan step for `choudoufuLivePlan`. On a choudoufu
37
+ * root ownership is a pair of tags on the resource rather than an entry in a
38
+ * state file, so a plan against the live system can answer three questions
39
+ * where a stock plan answers one: whether the estate drifted (the
40
+ * `-detailed-exitcode` exit, `Drift` as before), how many live resources sit
41
+ * at a declared identity carrying no marker (`Unowned`), and how many of those
42
+ * an exact content match makes claimable (`Adoptable`). All three come off a
43
+ * single live read, published as three run outcomes from the one step.
44
+ *
45
+ * The finding modes then carry the adoption ledger under the plan text: one
46
+ * line per adoptable match with its address, its live identity and the
47
+ * `tofu-estate`/`tofu-address` values that claim it, in the row form
48
+ * `live-plan -adoption-only` prints, followed by any contested address. That
49
+ * is a report, not an action. `TerraformAdoptOp` next door is what writes the
50
+ * markers, and it gates first.
51
+ *
26
52
  * ## Findings reuse `reconcilePr`
27
53
  *
28
- * `issue` and `pull-request` call the temporal lexicon's `reconcilePr`
29
- * activity, the one place in chant that shells to `gh issue create` /
30
- * `gh pr create`, rather than growing a second copy of those calls here.
54
+ * `issue` and `pull-request` call core's `reconcilePr` activity, the one place
55
+ * in chant that shells to `gh issue create` / `gh pr create`, rather than
56
+ * growing a second copy of those calls here.
31
57
  * That activity built its own change-set summary and had no way to be handed
32
58
  * one, so #2087 added a single field to it (`ReconcilePrArgs.body`), which is
33
59
  * what carries the `-no-color` plan through. Note that the pull-request mode
34
60
  * of `reconcilePr` regenerates chant TypeScript via `chant import`; a
35
- * terraform-native regeneration of HCL from live state is #2089, so until
36
- * then `findingMode: "issue"` is the mode with an end-to-end answer and
37
- * `"pull-request"` opens a PR whose body is the plan.
61
+ * terraform-native regeneration of HCL from live state is #2089, so
62
+ * `findingMode: "issue"` is the mode with an end-to-end answer and
63
+ * `"pull-request"` opens a PR whose body is the plan. On a live root #2089's
64
+ * question has a different answer rather than a pending one, and it is not
65
+ * regeneration: see `TerraformAdoptOp`.
38
66
  *
39
67
  * ## The schedule
40
68
  *
41
- * A cron makes this a `{ op, schedule }` pair, the shape
42
- * `lexicons/temporal/src/composites/workflow-audit-op.ts` and
43
- * `reconcile-op.ts` return. The schedule resource is `Temporal::Schedule`,
44
- * built here through core's own `createResource` rather than imported from
45
- * `@intentius/chant-lexicon-temporal`: no lexicon in this repo imports
46
- * another lexicon's package at runtime, and a static import would mean a
47
- * project that installs terraform and runs `chant run` on the local executor
48
- * could not load `@intentius/chant-lexicon-terraform` at all without also
49
- * installing temporal. The declarable is the same one temporal's
50
- * `TemporalSchedule` produces (`createResource("Temporal::Schedule",
51
- * "temporal", {})`, `lexicons/temporal/src/resources.ts`), so temporal's
52
- * serializer renders it unchanged when a project has both.
53
- *
54
- * A project with no Temporal at all runs the same Op on a CI cron instead:
55
- * `generateOpsPipeline` against the github lexicon turns the Op plus its cron
56
- * into a workflow. `examples/scheduled-watch/` is that recipe.
69
+ * A cron lands on the Op itself as `schedule` (#2120), the same field
70
+ * `WatchOp` and `ConvergeOp` set. It is runtime-neutral data: `chant
71
+ * operator` reads it as this Op's tick cadence, `generateOpsPipeline` against
72
+ * the github lexicon renders it as a CI cron, and a hosting lexicon hands it
73
+ * to its own scheduler. The one-shot `chant run app-watch` path ignores it.
74
+ * `examples/scheduled-watch/` is the CI recipe.
57
75
  *
58
76
  * @example
59
77
  * ```typescript
@@ -63,16 +81,23 @@
63
81
  * export const { op } = TerraformWatchOp({ name: "app-watch", root: "app" });
64
82
  *
65
83
  * // nightly, opening an issue when the plan is non-empty
66
- * export const { op, schedule } = TerraformWatchOp({
84
+ * export const { op } = TerraformWatchOp({
67
85
  * name: "app-watch",
68
86
  * root: "app",
69
87
  * schedule: "0 6 * * *",
70
88
  * findingMode: "issue",
71
89
  * });
90
+ *
91
+ * // a choudoufu estate: drift, unowned and adoptable, with the ledger in the issue
92
+ * export const { op } = TerraformWatchOp({
93
+ * name: "estate-watch",
94
+ * root: "estate",
95
+ * live: true,
96
+ * findingMode: "issue",
97
+ * });
72
98
  * ```
73
99
  */
74
100
  import { OpResource } from "@intentius/chant/op";
75
- import type { Declarable } from "@intentius/chant/declarable";
76
101
  /**
77
102
  * What to do with a non-empty plan. A subset of core's `OpFindingMode`
78
103
  * (`packages/core/src/lexicon.ts`): `merge-request` is GitLab's spelling of
@@ -80,23 +105,46 @@ import type { Declarable } from "@intentius/chant/declarable";
80
105
  */
81
106
  export type TerraformFindingMode = "report" | "issue" | "pull-request";
82
107
  export interface TerraformWatchOpConfig {
83
- /** Op name (kebab-case). Also the default task queue and schedule id base. */
108
+ /** Op name (kebab-case). */
84
109
  name: string;
85
110
  /** Key into the project's `terraform.roots`. The root carries dir, workspace, var files and backend config. */
86
111
  root: string;
87
112
  /**
88
- * Cron expression. When set, a `Temporal::Schedule` is returned alongside
89
- * the Op; omit for one-shot `chant run` on the local executor, or for a CI
90
- * cron built by `generateOpsPipeline`.
113
+ * Cron expression. When set, it lands on the Op as `schedule` — the cadence
114
+ * `chant operator` ticks on and `generateOpsPipeline` renders as a CI cron.
115
+ * Omit for one-shot `chant run` on the local executor.
91
116
  */
92
117
  schedule?: string;
93
118
  /**
94
119
  * What to do when the plan proposes changes. Default: `"report"`, which
95
- * opens nothing. The `Drift` search attribute and the run's own log are
120
+ * opens nothing. The `Drift` run outcome and the run's own log are
96
121
  * the report.
97
122
  */
98
123
  findingMode?: TerraformFindingMode;
99
- /** Plan file the Plan step writes, relative to the root dir. Default: `chant.tfplan`. */
124
+ /**
125
+ * Watch a live root (#2105): the root runs `terraform.binary: "choudoufu"`
126
+ * and declares an estate, so the Plan phase is `choudoufuLivePlan` rather
127
+ * than `terraformPlan`. See the module doc for what changes.
128
+ *
129
+ * Declared here rather than detected, because a composite is built by
130
+ * `chant build` without reading a root module's `.tf` files. The activities
131
+ * detect the estate at run time (`op/activities/live-detect.ts`), but by then
132
+ * the phases are already serialized. Setting this on a stock root fails at
133
+ * the first step, with choudoufu's own reason.
134
+ */
135
+ live?: boolean;
136
+ /**
137
+ * The estate to plan against, for a live root whose estate this Op should
138
+ * name explicitly. Omitted, `choudoufuLivePlan` auto-detects it from the
139
+ * root's own `live` block or `estate.chdf.hcl` sidecar, which is the usual
140
+ * case. Refused on a stock root.
141
+ */
142
+ estate?: string;
143
+ /**
144
+ * Plan file the Plan step writes, relative to the root dir. Default:
145
+ * `chant.tfplan`. Refused on a live root, where choudoufu takes no plan file
146
+ * at all.
147
+ */
100
148
  planFile?: string;
101
149
  /** `-upgrade` on the Init step: re-resolve provider and module versions. */
102
150
  upgrade?: boolean;
@@ -111,14 +159,10 @@ export interface TerraformWatchOpConfig {
111
159
  title?: string;
112
160
  /** Branch the pull-request mode opens from. Default: `reconcilePr`'s own. */
113
161
  branch?: string;
114
- /** Override the task queue. Defaults to `name`. */
115
- taskQueue?: string;
116
162
  }
117
163
  export interface TerraformWatchOpResources {
118
- /** Op resource. Generates the Init/Plan/[Report] workflow. */
164
+ /** Op resource. Generates the Init/Plan/[Report] phases. */
119
165
  op: InstanceType<typeof OpResource>;
120
- /** `Temporal::Schedule`, present only when `schedule` was given. */
121
- schedule?: Declarable;
122
166
  }
123
167
  export declare function TerraformWatchOp(config: TerraformWatchOpConfig): TerraformWatchOpResources;
124
168
  //# sourceMappingURL=terraform-watch-op.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"terraform-watch-op.d.ts","sourceRoot":"","sources":["../../src/composites/terraform-watch-op.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAEH,OAAO,EAAa,UAAU,EAAqB,MAAM,qBAAqB,CAAC;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAI9D;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,OAAO,GAAG,cAAc,CAAC;AAcvE,MAAM,WAAW,sBAAsB;IACrC,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,+GAA+G;IAC/G,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,8DAA8D;IAC9D,EAAE,EAAE,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;IACpC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,yBAAyB,CA6D1F"}
1
+ {"version":3,"file":"terraform-watch-op.d.ts","sourceRoot":"","sources":["../../src/composites/terraform-watch-op.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;AAEH,OAAO,EAAa,UAAU,EAAqB,MAAM,qBAAqB,CAAC;AAQ/E;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,OAAO,GAAG,cAAc,CAAC;AAEvE,MAAM,WAAW,sBAAsB;IACrC,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,+GAA+G;IAC/G,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,yBAAyB;IACxC,4DAA4D;IAC5D,EAAE,EAAE,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;CACrC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,yBAAyB,CAmF1F"}
package/dist/config.d.ts CHANGED
@@ -23,6 +23,23 @@
23
23
  */
24
24
  import { z } from "zod";
25
25
  import type { ChantConfig } from "@intentius/chant/config";
26
+ /**
27
+ * chant's cross-lexicon delete-mode vocabulary (`lexicons/k8s/src/op/
28
+ * activities/kubectl.ts`'s `ApplyDeleteMode`, `packages/core/src/op/
29
+ * activities/apply.ts`'s `DeleteMode`), read here for a live root and mapped
30
+ * onto choudoufu's `policy` block (#2106): `"never"` requires the root's
31
+ * `policy` to set `undeclared_tagged` to `"keep"`, `"untag"` or `"report"`
32
+ * (TF026 enforces this at build time); `"owned-only"` is choudoufu's own
33
+ * default verb for that quadrant (`delete`) and needs nothing; `"gated"`
34
+ * needs nothing beyond `TerraformApplyOp`'s own approval gate. Inert on a
35
+ * stock root: choudoufu's `policy` block does not exist there.
36
+ */
37
+ export declare const terraformDeleteModeSchema: z.ZodEnum<{
38
+ gated: "gated";
39
+ never: "never";
40
+ "owned-only": "owned-only";
41
+ }>;
42
+ export type TerraformDeleteMode = z.infer<typeof terraformDeleteModeSchema>;
26
43
  /**
27
44
  * One Terraform root module chant reads. `dir` is the only required field:
28
45
  * everything else names how the root is invoked rather than what it declares.
@@ -41,16 +58,40 @@ export declare const terraformRootSchema: z.ZodObject<{
41
58
  varFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
59
  /** `-backend-config` key/value pairs handed to `init`. */
43
60
  backendConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
61
+ /** This root's declared delete mode. See {@link terraformDeleteModeSchema}. */
62
+ delete: z.ZodOptional<z.ZodEnum<{
63
+ gated: "gated";
64
+ never: "never";
65
+ "owned-only": "owned-only";
66
+ }>>;
44
67
  }, z.core.$strict>;
45
68
  export declare const terraformConfigSchema: z.ZodObject<{
46
69
  /**
47
- * Which CLI drives the roots. The two are wire-compatible for everything
48
- * this lexicon does, so the choice is recorded rather than inferred.
70
+ * Which CLI drives the roots. `terraform` and `tofu` are wire-compatible
71
+ * for everything this lexicon does, so the choice is recorded rather than
72
+ * inferred. `choudoufu` (#2103) is an OpenTofu fork: a root running it also
73
+ * needs a declared estate (a `live` block or an `estate.chdf.hcl` sidecar,
74
+ * seen by the shared HCL parse) before it counts as live. Declaring the
75
+ * binary alone runs the root stock, exactly as `terraform`/`tofu` do.
49
76
  */
50
77
  binary: z.ZodOptional<z.ZodEnum<{
78
+ choudoufu: "choudoufu";
51
79
  terraform: "terraform";
52
80
  tofu: "tofu";
53
81
  }>>;
82
+ /**
83
+ * How far a root's parse follows its `module` calls (#2112), spelled the
84
+ * way tflint spells it. `local` (the default) reads modules sourced from a
85
+ * relative path, so TF014, TF015 and TF020 see inside them; `none` reads
86
+ * only each root's own directory; `all` is reserved for fetching registry
87
+ * and git modules and is refused with a message, since chant fetches
88
+ * nothing. See `hcl/descend.ts`.
89
+ */
90
+ callModuleType: z.ZodOptional<z.ZodEnum<{
91
+ local: "local";
92
+ none: "none";
93
+ all: "all";
94
+ }>>;
54
95
  /** Named root modules. The name is the entity-key prefix, so keep it stable. */
55
96
  roots: z.ZodRecord<z.ZodString, z.ZodObject<{
56
97
  /** Root module directory, relative to the project root (where `chant.config.*` lives). */
@@ -61,6 +102,12 @@ export declare const terraformConfigSchema: z.ZodObject<{
61
102
  varFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
62
103
  /** `-backend-config` key/value pairs handed to `init`. */
63
104
  backendConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
105
+ /** This root's declared delete mode. See {@link terraformDeleteModeSchema}. */
106
+ delete: z.ZodOptional<z.ZodEnum<{
107
+ gated: "gated";
108
+ never: "never";
109
+ "owned-only": "owned-only";
110
+ }>>;
64
111
  }, z.core.$strict>>;
65
112
  }, z.core.$strict>;
66
113
  export type TerraformRootConfig = z.infer<typeof terraformRootSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB;IAC9B,0FAA0F;;IAE1F,4EAA4E;;IAE5E,0DAA0D;;IAE1D,0DAA0D;;kBAE1D,CAAC;AAEH,eAAO,MAAM,qBAAqB;IAChC;;;OAGG;;;;;IAEH,gFAAgF;;QAhBhF,0FAA0F;;QAE1F,4EAA4E;;QAE5E,0DAA0D;;QAE1D,0DAA0D;;;kBAY1D,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,OAAO,QAAQ,yBAAyB,CAAC;IACvC,UAAU,WAAW;QACnB,SAAS,CAAC,EAAE,eAAe,CAAC;KAC7B;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,wBAAwB,GAAG,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB;;;;EAA2C,CAAC;AAClF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB;IAC9B,0FAA0F;;IAE1F,4EAA4E;;IAE5E,0DAA0D;;IAE1D,0DAA0D;;IAE1D,+EAA+E;;;;;;kBAE/E,CAAC;AAEH,eAAO,MAAM,qBAAqB;IAChC;;;;;;;OAOG;;;;;;IAEH;;;;;;;OAOG;;;;;;IAEH,gFAAgF;;QA/BhF,0FAA0F;;QAE1F,4EAA4E;;QAE5E,0DAA0D;;QAE1D,0DAA0D;;QAE1D,+EAA+E;;;;;;;kBAyB/E,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,OAAO,QAAQ,yBAAyB,CAAC;IACvC,UAAU,WAAW;QACnB,SAAS,CAAC,EAAE,eAAe,CAAC;KAC7B;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,wBAAwB,GAAG,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC"}