@intentius/chant-lexicon-terraform 0.57.0 → 0.59.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 (408) hide show
  1. package/README.md +9 -0
  2. package/dist/composites/terraform-adopt-op.d.ts +131 -0
  3. package/dist/composites/terraform-adopt-op.d.ts.map +1 -0
  4. package/dist/composites/terraform-apply-op.d.ts +70 -17
  5. package/dist/composites/terraform-apply-op.d.ts.map +1 -1
  6. package/dist/composites/terraform-watch-op.d.ts +104 -37
  7. package/dist/composites/terraform-watch-op.d.ts.map +1 -1
  8. package/dist/config.d.ts +49 -2
  9. package/dist/config.d.ts.map +1 -1
  10. package/dist/describe-resources.d.ts +256 -16
  11. package/dist/describe-resources.d.ts.map +1 -1
  12. package/dist/hcl/descend.d.ts +98 -0
  13. package/dist/hcl/descend.d.ts.map +1 -0
  14. package/dist/hcl/marker.d.ts +130 -0
  15. package/dist/hcl/marker.d.ts.map +1 -0
  16. package/dist/hcl/parse.d.ts +156 -9
  17. package/dist/hcl/parse.d.ts.map +1 -1
  18. package/dist/hcl/references.d.ts +76 -0
  19. package/dist/hcl/references.d.ts.map +1 -0
  20. package/dist/hcl/roots.d.ts +22 -3
  21. package/dist/hcl/roots.d.ts.map +1 -1
  22. package/dist/hcl/suppressions.d.ts +54 -0
  23. package/dist/hcl/suppressions.d.ts.map +1 -0
  24. package/dist/hcl/value.d.ts +77 -0
  25. package/dist/hcl/value.d.ts.map +1 -0
  26. package/dist/index.d.ts +5 -2
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/integrity.json +34 -5
  29. package/dist/lint/audit-catalog.d.ts +3 -2
  30. package/dist/lint/audit-catalog.d.ts.map +1 -1
  31. package/dist/lint/audit-lineage.d.ts +95 -0
  32. package/dist/lint/audit-lineage.d.ts.map +1 -1
  33. package/dist/lint/post-synth/blocks.d.ts +53 -0
  34. package/dist/lint/post-synth/blocks.d.ts.map +1 -0
  35. package/dist/lint/post-synth/fixtures/load.d.ts +37 -0
  36. package/dist/lint/post-synth/fixtures/load.d.ts.map +1 -0
  37. package/dist/lint/post-synth/index.d.ts.map +1 -1
  38. package/dist/lint/post-synth/module-source.d.ts +38 -0
  39. package/dist/lint/post-synth/module-source.d.ts.map +1 -0
  40. package/dist/lint/post-synth/scope.d.ts +65 -0
  41. package/dist/lint/post-synth/scope.d.ts.map +1 -0
  42. package/dist/lint/post-synth/tf001.d.ts +58 -6
  43. package/dist/lint/post-synth/tf001.d.ts.map +1 -1
  44. package/dist/lint/post-synth/tf002.d.ts +32 -0
  45. package/dist/lint/post-synth/tf002.d.ts.map +1 -0
  46. package/dist/lint/post-synth/tf003.d.ts +22 -0
  47. package/dist/lint/post-synth/tf003.d.ts.map +1 -0
  48. package/dist/lint/post-synth/tf004.d.ts +22 -0
  49. package/dist/lint/post-synth/tf004.d.ts.map +1 -0
  50. package/dist/lint/post-synth/tf005.d.ts +28 -0
  51. package/dist/lint/post-synth/tf005.d.ts.map +1 -0
  52. package/dist/lint/post-synth/tf006.d.ts +21 -0
  53. package/dist/lint/post-synth/tf006.d.ts.map +1 -0
  54. package/dist/lint/post-synth/tf007.d.ts +21 -0
  55. package/dist/lint/post-synth/tf007.d.ts.map +1 -0
  56. package/dist/lint/post-synth/tf008.d.ts +22 -0
  57. package/dist/lint/post-synth/tf008.d.ts.map +1 -0
  58. package/dist/lint/post-synth/tf009.d.ts +24 -0
  59. package/dist/lint/post-synth/tf009.d.ts.map +1 -0
  60. package/dist/lint/post-synth/tf010.d.ts +19 -0
  61. package/dist/lint/post-synth/tf010.d.ts.map +1 -0
  62. package/dist/lint/post-synth/tf011.d.ts +18 -0
  63. package/dist/lint/post-synth/tf011.d.ts.map +1 -0
  64. package/dist/lint/post-synth/tf012.d.ts +17 -0
  65. package/dist/lint/post-synth/tf012.d.ts.map +1 -0
  66. package/dist/lint/post-synth/tf013.d.ts +21 -0
  67. package/dist/lint/post-synth/tf013.d.ts.map +1 -0
  68. package/dist/lint/post-synth/tf014.d.ts +25 -0
  69. package/dist/lint/post-synth/tf014.d.ts.map +1 -0
  70. package/dist/lint/post-synth/tf015.d.ts +30 -0
  71. package/dist/lint/post-synth/tf015.d.ts.map +1 -0
  72. package/dist/lint/post-synth/tf016.d.ts +30 -0
  73. package/dist/lint/post-synth/tf016.d.ts.map +1 -0
  74. package/dist/lint/post-synth/tf017.d.ts +19 -0
  75. package/dist/lint/post-synth/tf017.d.ts.map +1 -0
  76. package/dist/lint/post-synth/tf018.d.ts +20 -0
  77. package/dist/lint/post-synth/tf018.d.ts.map +1 -0
  78. package/dist/lint/post-synth/tf019.d.ts +25 -0
  79. package/dist/lint/post-synth/tf019.d.ts.map +1 -0
  80. package/dist/lint/post-synth/tf020.d.ts +38 -0
  81. package/dist/lint/post-synth/tf020.d.ts.map +1 -0
  82. package/dist/lint/post-synth/tf021.d.ts +41 -0
  83. package/dist/lint/post-synth/tf021.d.ts.map +1 -0
  84. package/dist/lint/post-synth/tf022.d.ts +24 -0
  85. package/dist/lint/post-synth/tf022.d.ts.map +1 -0
  86. package/dist/lint/post-synth/tf024.d.ts +24 -0
  87. package/dist/lint/post-synth/tf024.d.ts.map +1 -0
  88. package/dist/lint/post-synth/tf025.d.ts +29 -0
  89. package/dist/lint/post-synth/tf025.d.ts.map +1 -0
  90. package/dist/lint/post-synth/tf026.d.ts +28 -0
  91. package/dist/lint/post-synth/tf026.d.ts.map +1 -0
  92. package/dist/lint/post-synth/tf027.d.ts +30 -0
  93. package/dist/lint/post-synth/tf027.d.ts.map +1 -0
  94. package/dist/lint/post-synth/tf028.d.ts +33 -0
  95. package/dist/lint/post-synth/tf028.d.ts.map +1 -0
  96. package/dist/lint/rules/fixtures/load.d.ts +13 -0
  97. package/dist/lint/rules/fixtures/load.d.ts.map +1 -0
  98. package/dist/lint/rules/plan-before-apply.d.ts +11 -0
  99. package/dist/lint/rules/plan-before-apply.d.ts.map +1 -1
  100. package/dist/lint/secret-shape.d.ts +68 -0
  101. package/dist/lint/secret-shape.d.ts.map +1 -0
  102. package/dist/live-ownership.d.ts +55 -0
  103. package/dist/live-ownership.d.ts.map +1 -0
  104. package/dist/lsp/option-keys.d.ts.map +1 -1
  105. package/dist/manifest.json +1 -1
  106. package/dist/okf/index.md +26 -0
  107. package/dist/okf/rules/TF002.md +11 -0
  108. package/dist/okf/rules/TF003.md +11 -0
  109. package/dist/okf/rules/TF004.md +11 -0
  110. package/dist/okf/rules/TF005.md +11 -0
  111. package/dist/okf/rules/TF006.md +11 -0
  112. package/dist/okf/rules/TF007.md +11 -0
  113. package/dist/okf/rules/TF008.md +11 -0
  114. package/dist/okf/rules/TF009.md +11 -0
  115. package/dist/okf/rules/TF010.md +11 -0
  116. package/dist/okf/rules/TF011.md +11 -0
  117. package/dist/okf/rules/TF012.md +11 -0
  118. package/dist/okf/rules/TF013.md +11 -0
  119. package/dist/okf/rules/TF014.md +11 -0
  120. package/dist/okf/rules/TF015.md +11 -0
  121. package/dist/okf/rules/TF016.md +11 -0
  122. package/dist/okf/rules/TF017.md +11 -0
  123. package/dist/okf/rules/TF018.md +11 -0
  124. package/dist/okf/rules/TF019.md +11 -0
  125. package/dist/okf/rules/TF020.md +11 -0
  126. package/dist/okf/rules/TF021.md +11 -0
  127. package/dist/okf/rules/TF022.md +11 -0
  128. package/dist/okf/rules/TF024.md +11 -0
  129. package/dist/okf/rules/TF025.md +11 -0
  130. package/dist/okf/rules/TF026.md +11 -0
  131. package/dist/okf/rules/TF027.md +11 -0
  132. package/dist/okf/rules/TF028.md +11 -0
  133. package/dist/op/activities/index.d.ts +13 -6
  134. package/dist/op/activities/index.d.ts.map +1 -1
  135. package/dist/op/activities/live-detect.d.ts +51 -0
  136. package/dist/op/activities/live-detect.d.ts.map +1 -0
  137. package/dist/op/activities/terraform.d.ts +466 -17
  138. package/dist/op/activities/terraform.d.ts.map +1 -1
  139. package/dist/op/activity-contracts.d.ts +148 -0
  140. package/dist/op/activity-contracts.d.ts.map +1 -0
  141. package/dist/op/adoption.d.ts +118 -0
  142. package/dist/op/adoption.d.ts.map +1 -0
  143. package/dist/op/builders.d.ts +48 -6
  144. package/dist/op/builders.d.ts.map +1 -1
  145. package/dist/op/resolve-root-mode.d.ts +59 -0
  146. package/dist/op/resolve-root-mode.d.ts.map +1 -0
  147. package/dist/plugin.d.ts.map +1 -1
  148. package/dist/rules/blocks.ts +109 -0
  149. package/dist/rules/module-source.ts +121 -0
  150. package/dist/rules/plan-before-apply.ts +11 -0
  151. package/dist/rules/scope.ts +107 -0
  152. package/dist/rules/tf001.ts +98 -18
  153. package/dist/rules/tf002.ts +151 -0
  154. package/dist/rules/tf003.ts +71 -0
  155. package/dist/rules/tf004.ts +63 -0
  156. package/dist/rules/tf005.ts +76 -0
  157. package/dist/rules/tf006.ts +53 -0
  158. package/dist/rules/tf007.ts +78 -0
  159. package/dist/rules/tf008.ts +75 -0
  160. package/dist/rules/tf009.ts +59 -0
  161. package/dist/rules/tf010.ts +51 -0
  162. package/dist/rules/tf011.ts +49 -0
  163. package/dist/rules/tf012.ts +47 -0
  164. package/dist/rules/tf013.ts +63 -0
  165. package/dist/rules/tf014.ts +72 -0
  166. package/dist/rules/tf015.ts +72 -0
  167. package/dist/rules/tf016.ts +75 -0
  168. package/dist/rules/tf017.ts +50 -0
  169. package/dist/rules/tf018.ts +72 -0
  170. package/dist/rules/tf019.ts +72 -0
  171. package/dist/rules/tf020.ts +123 -0
  172. package/dist/rules/tf021.ts +126 -0
  173. package/dist/rules/tf022.ts +61 -0
  174. package/dist/rules/tf024.ts +70 -0
  175. package/dist/rules/tf025.ts +101 -0
  176. package/dist/rules/tf026.ts +84 -0
  177. package/dist/rules/tf027.ts +74 -0
  178. package/dist/rules/tf028.ts +96 -0
  179. package/dist/skills/chant-terraform.md +1 -1
  180. package/dist/validate.d.ts.map +1 -1
  181. package/package.json +7 -2
  182. package/src/__fixtures__/ACCEPTANCE.md +181 -0
  183. package/src/__fixtures__/live/main.tf +28 -0
  184. package/src/__fixtures__/live-adopt/estate.chdf.hcl +6 -0
  185. package/src/__fixtures__/live-adopt/main.tf +21 -0
  186. package/src/__fixtures__/live-estate/README.md +58 -0
  187. package/src/__fixtures__/live-estate/compute.tf +10 -0
  188. package/src/__fixtures__/live-estate/estate.chdf.hcl +1 -0
  189. package/src/__fixtures__/live-estate/logs.tf +8 -0
  190. package/src/__fixtures__/live-estate/network.tf +24 -0
  191. package/src/__fixtures__/live-estate/rule.tf +11 -0
  192. package/src/__fixtures__/live-estate/unowned.tf +21 -0
  193. package/src/__fixtures__/live-estate/versions.tf +31 -0
  194. package/src/__fixtures__/live-ls.json +98 -0
  195. package/src/__fixtures__/live-plan.json +285 -0
  196. package/src/__fixtures__/live-sidecar/estate.chdf.hcl +3 -0
  197. package/src/__fixtures__/live-sidecar/main.tf +24 -0
  198. package/src/__fixtures__/module-tree/README.md +16 -0
  199. package/src/__fixtures__/module-tree/cycle/main.tf +3 -0
  200. package/src/__fixtures__/module-tree/cycle/modules/a/main.tf +9 -0
  201. package/src/__fixtures__/module-tree/cycle/modules/b/main.tf +9 -0
  202. package/src/__fixtures__/module-tree/missing/main.tf +9 -0
  203. package/src/__fixtures__/module-tree/outside/root/main.tf +9 -0
  204. package/src/__fixtures__/module-tree/root/main.tf +28 -0
  205. package/src/__fixtures__/module-tree/root/modules/cdn/main.tf +15 -0
  206. package/src/__fixtures__/module-tree/root/modules/cdn/modules/bucket/main.tf +11 -0
  207. package/src/__fixtures__/module-tree/shared/main.tf +5 -0
  208. package/src/__fixtures__/references/main.tf +56 -0
  209. package/src/__fixtures__/remote-backend/main.tf +34 -0
  210. package/src/__fixtures__/with-backend/main.tf +7 -0
  211. package/src/codegen/lint-rules-page.test.ts +45 -0
  212. package/src/composites/terraform-adopt-op.acceptance.test.ts +193 -0
  213. package/src/composites/terraform-adopt-op.test.ts +175 -0
  214. package/src/composites/terraform-adopt-op.ts +202 -0
  215. package/src/composites/terraform-apply-op.acceptance.test.ts +188 -5
  216. package/src/composites/terraform-apply-op.test.ts +179 -19
  217. package/src/composites/terraform-apply-op.ts +123 -30
  218. package/src/composites/terraform-watch-op.test.ts +169 -29
  219. package/src/composites/terraform-watch-op.ts +183 -75
  220. package/src/config.ts +32 -3
  221. package/src/describe-resources.live.test.ts +598 -0
  222. package/src/describe-resources.test.ts +53 -0
  223. package/src/describe-resources.ts +811 -28
  224. package/src/hcl/descend.test.ts +162 -0
  225. package/src/hcl/descend.ts +273 -0
  226. package/src/hcl/marker.test.ts +147 -0
  227. package/src/hcl/marker.ts +235 -0
  228. package/src/hcl/parse.test.ts +69 -0
  229. package/src/hcl/parse.ts +269 -27
  230. package/src/hcl/references.test.ts +116 -0
  231. package/src/hcl/references.ts +172 -0
  232. package/src/hcl/roots.ts +59 -5
  233. package/src/hcl/suppressions.test.ts +147 -0
  234. package/src/hcl/suppressions.ts +204 -0
  235. package/src/hcl/value.test.ts +73 -0
  236. package/src/hcl/value.ts +106 -0
  237. package/src/index.ts +31 -1
  238. package/src/lint/audit-catalog.ts +288 -3
  239. package/src/lint/audit-lineage.ts +384 -1
  240. package/src/lint/audit.test.ts +210 -3
  241. package/src/lint/post-synth/blocks.ts +109 -0
  242. package/src/lint/post-synth/fixtures/TF001/negative-cloud.tf +28 -0
  243. package/src/lint/post-synth/fixtures/TF001/negative.tf +30 -0
  244. package/src/lint/post-synth/fixtures/TF001/positive-local.tf +31 -0
  245. package/src/lint/post-synth/fixtures/TF001/positive.tf +24 -0
  246. package/src/lint/post-synth/fixtures/TF002/negative.tf +17 -0
  247. package/src/lint/post-synth/fixtures/TF002/positive-legacy.tf +10 -0
  248. package/src/lint/post-synth/fixtures/TF002/positive-no-version.tf +12 -0
  249. package/src/lint/post-synth/fixtures/TF002/positive.tf +7 -0
  250. package/src/lint/post-synth/fixtures/TF003/negative.tf +10 -0
  251. package/src/lint/post-synth/fixtures/TF003/positive.tf +8 -0
  252. package/src/lint/post-synth/fixtures/TF004/negative-git.tf +3 -0
  253. package/src/lint/post-synth/fixtures/TF004/negative-local.tf +3 -0
  254. package/src/lint/post-synth/fixtures/TF004/negative.tf +4 -0
  255. package/src/lint/post-synth/fixtures/TF004/positive.tf +3 -0
  256. package/src/lint/post-synth/fixtures/TF005/negative-local.tf +3 -0
  257. package/src/lint/post-synth/fixtures/TF005/negative-registry.tf +3 -0
  258. package/src/lint/post-synth/fixtures/TF005/negative-sha.tf +3 -0
  259. package/src/lint/post-synth/fixtures/TF005/negative.tf +3 -0
  260. package/src/lint/post-synth/fixtures/TF005/positive-branch.tf +3 -0
  261. package/src/lint/post-synth/fixtures/TF005/positive-non-semver.tf +3 -0
  262. package/src/lint/post-synth/fixtures/TF005/positive.tf +3 -0
  263. package/src/lint/post-synth/fixtures/TF006/negative.tf +5 -0
  264. package/src/lint/post-synth/fixtures/TF006/positive-empty-default.tf +11 -0
  265. package/src/lint/post-synth/fixtures/TF006/positive.tf +6 -0
  266. package/src/lint/post-synth/fixtures/TF007/negative.tf +10 -0
  267. package/src/lint/post-synth/fixtures/TF007/positive.tf +9 -0
  268. package/src/lint/post-synth/fixtures/TF008/negative-variable.tf +10 -0
  269. package/src/lint/post-synth/fixtures/TF008/negative.tf +8 -0
  270. package/src/lint/post-synth/fixtures/TF008/positive-other-provider.tf +10 -0
  271. package/src/lint/post-synth/fixtures/TF008/positive.tf +5 -0
  272. package/src/lint/post-synth/fixtures/TF009/negative.tf +10 -0
  273. package/src/lint/post-synth/fixtures/TF009/positive.tf +4 -0
  274. package/src/lint/post-synth/fixtures/TF010/negative.tf +5 -0
  275. package/src/lint/post-synth/fixtures/TF010/positive.tf +4 -0
  276. package/src/lint/post-synth/fixtures/TF011/negative.tf +5 -0
  277. package/src/lint/post-synth/fixtures/TF011/positive-blank.tf +5 -0
  278. package/src/lint/post-synth/fixtures/TF011/positive.tf +4 -0
  279. package/src/lint/post-synth/fixtures/TF012/negative.tf +4 -0
  280. package/src/lint/post-synth/fixtures/TF012/positive.tf +3 -0
  281. package/src/lint/post-synth/fixtures/TF013/negative.tf +8 -0
  282. package/src/lint/post-synth/fixtures/TF013/positive-data.tf +8 -0
  283. package/src/lint/post-synth/fixtures/TF013/positive.tf +8 -0
  284. package/src/lint/post-synth/fixtures/TF014/negative/main.tf +26 -0
  285. package/src/lint/post-synth/fixtures/TF014/negative/modules/cdn/main.tf +19 -0
  286. package/src/lint/post-synth/fixtures/TF014/positive/main.tf +16 -0
  287. package/src/lint/post-synth/fixtures/TF014/positive/modules/cdn/main.tf +15 -0
  288. package/src/lint/post-synth/fixtures/TF015/negative/main.tf +13 -0
  289. package/src/lint/post-synth/fixtures/TF015/negative/modules/cdn/main.tf +16 -0
  290. package/src/lint/post-synth/fixtures/TF015/positive/main.tf +13 -0
  291. package/src/lint/post-synth/fixtures/TF015/positive/modules/cdn/main.tf +14 -0
  292. package/src/lint/post-synth/fixtures/TF016/negative-template.tf +7 -0
  293. package/src/lint/post-synth/fixtures/TF016/negative.tf +16 -0
  294. package/src/lint/post-synth/fixtures/TF016/positive-shared-file.tf +12 -0
  295. package/src/lint/post-synth/fixtures/TF016/positive.tf +13 -0
  296. package/src/lint/post-synth/fixtures/TF017/negative.tf +4 -0
  297. package/src/lint/post-synth/fixtures/TF017/positive.tf +5 -0
  298. package/src/lint/post-synth/fixtures/TF018/negative.tf +9 -0
  299. package/src/lint/post-synth/fixtures/TF018/positive-data.tf +9 -0
  300. package/src/lint/post-synth/fixtures/TF018/positive.tf +4 -0
  301. package/src/lint/post-synth/fixtures/TF019/negative.tf +14 -0
  302. package/src/lint/post-synth/fixtures/TF019/positive-output.tf +5 -0
  303. package/src/lint/post-synth/fixtures/TF019/positive.tf +16 -0
  304. package/src/lint/post-synth/fixtures/TF020/negative.tf +43 -0
  305. package/src/lint/post-synth/fixtures/TF020/positive.tf +32 -0
  306. package/src/lint/post-synth/fixtures/TF020/scoped/main.tf +21 -0
  307. package/src/lint/post-synth/fixtures/TF020/scoped/modules/cdn/main.tf +13 -0
  308. package/src/lint/post-synth/fixtures/TF021/negative.tf +31 -0
  309. package/src/lint/post-synth/fixtures/TF021/positive-length.tf +8 -0
  310. package/src/lint/post-synth/fixtures/TF021/positive.tf +8 -0
  311. package/src/lint/post-synth/fixtures/TF022/negative-locator.tf +7 -0
  312. package/src/lint/post-synth/fixtures/TF022/negative.tf +10 -0
  313. package/src/lint/post-synth/fixtures/TF022/positive-nested.tf +10 -0
  314. package/src/lint/post-synth/fixtures/TF022/positive.tf +6 -0
  315. package/src/lint/post-synth/fixtures/TF023/negative/main.tf +15 -0
  316. package/src/lint/post-synth/fixtures/TF023/positive/main.tf +9 -0
  317. package/src/lint/post-synth/fixtures/TF023/positive/state.json +24 -0
  318. package/src/lint/post-synth/fixtures/TF024/live-clean/main.tf +9 -0
  319. package/src/lint/post-synth/fixtures/TF024/live-with-backend/main.tf +14 -0
  320. package/src/lint/post-synth/fixtures/TF024/live-with-cloud/main.tf +16 -0
  321. package/src/lint/post-synth/fixtures/TF025/live-clean/main.tf +13 -0
  322. package/src/lint/post-synth/fixtures/TF025/live-with-workspace-ref/main.tf +13 -0
  323. package/src/lint/post-synth/fixtures/TF026/live-default/main.tf +9 -0
  324. package/src/lint/post-synth/fixtures/TF026/live-explicit-delete/main.tf +13 -0
  325. package/src/lint/post-synth/fixtures/TF026/live-keep/main.tf +13 -0
  326. package/src/lint/post-synth/fixtures/TF027/live-default/main.tf +9 -0
  327. package/src/lint/post-synth/fixtures/TF027/live-untagged-delete/main.tf +13 -0
  328. package/src/lint/post-synth/fixtures/TF027/live-untagged-delete-scoped/main.tf +17 -0
  329. package/src/lint/post-synth/fixtures/TF027/live-untagged-report/main.tf +13 -0
  330. package/src/lint/post-synth/fixtures/TF028/live/main.tf +9 -0
  331. package/src/lint/post-synth/fixtures/TF028/stock/main.tf +10 -0
  332. package/src/lint/post-synth/fixtures/load.ts +108 -0
  333. package/src/lint/post-synth/index.ts +52 -0
  334. package/src/lint/post-synth/live-refusals-config-format.test.ts +143 -0
  335. package/src/lint/post-synth/module-rules.test.ts +153 -0
  336. package/src/lint/post-synth/module-source.test.ts +75 -0
  337. package/src/lint/post-synth/module-source.ts +121 -0
  338. package/src/lint/post-synth/post-synth.test.ts +73 -16
  339. package/src/lint/post-synth/scope.ts +107 -0
  340. package/src/lint/post-synth/single-block.test.ts +263 -0
  341. package/src/lint/post-synth/suppression.test.ts +110 -0
  342. package/src/lint/post-synth/tf001.ts +98 -18
  343. package/src/lint/post-synth/tf002.test.ts +93 -0
  344. package/src/lint/post-synth/tf002.ts +151 -0
  345. package/src/lint/post-synth/tf003.test.ts +75 -0
  346. package/src/lint/post-synth/tf003.ts +71 -0
  347. package/src/lint/post-synth/tf004.test.ts +47 -0
  348. package/src/lint/post-synth/tf004.ts +63 -0
  349. package/src/lint/post-synth/tf005.test.ts +57 -0
  350. package/src/lint/post-synth/tf005.ts +76 -0
  351. package/src/lint/post-synth/tf006.ts +53 -0
  352. package/src/lint/post-synth/tf007.ts +78 -0
  353. package/src/lint/post-synth/tf008.ts +75 -0
  354. package/src/lint/post-synth/tf009.ts +59 -0
  355. package/src/lint/post-synth/tf010.ts +51 -0
  356. package/src/lint/post-synth/tf011.ts +49 -0
  357. package/src/lint/post-synth/tf012.ts +47 -0
  358. package/src/lint/post-synth/tf013.ts +63 -0
  359. package/src/lint/post-synth/tf014.ts +72 -0
  360. package/src/lint/post-synth/tf015.ts +72 -0
  361. package/src/lint/post-synth/tf016.ts +75 -0
  362. package/src/lint/post-synth/tf017.ts +50 -0
  363. package/src/lint/post-synth/tf018.ts +72 -0
  364. package/src/lint/post-synth/tf019.ts +72 -0
  365. package/src/lint/post-synth/tf020.ts +123 -0
  366. package/src/lint/post-synth/tf021.ts +126 -0
  367. package/src/lint/post-synth/tf022.ts +61 -0
  368. package/src/lint/post-synth/tf024.test.ts +42 -0
  369. package/src/lint/post-synth/tf024.ts +70 -0
  370. package/src/lint/post-synth/tf025.test.ts +46 -0
  371. package/src/lint/post-synth/tf025.ts +101 -0
  372. package/src/lint/post-synth/tf026.test.ts +56 -0
  373. package/src/lint/post-synth/tf026.ts +84 -0
  374. package/src/lint/post-synth/tf027.test.ts +62 -0
  375. package/src/lint/post-synth/tf027.ts +74 -0
  376. package/src/lint/post-synth/tf028.test.ts +92 -0
  377. package/src/lint/post-synth/tf028.ts +96 -0
  378. package/src/lint/presets.test.ts +72 -0
  379. package/src/lint/rules/fixtures/TF101/negative-op.ts +2 -0
  380. package/src/lint/rules/fixtures/TF101/positive-op.ts +2 -0
  381. package/src/lint/rules/fixtures/load.ts +53 -0
  382. package/src/lint/rules/plan-before-apply.test.ts +112 -7
  383. package/src/lint/rules/plan-before-apply.ts +11 -0
  384. package/src/lint/secret-shape.test.ts +150 -0
  385. package/src/lint/secret-shape.ts +159 -0
  386. package/src/live-ownership.ts +60 -0
  387. package/src/lsp/completions.test.ts +3 -2
  388. package/src/lsp/option-keys.ts +12 -6
  389. package/src/op/activities/choudoufu.acceptance.test.ts +127 -0
  390. package/src/op/activities/choudoufu.test.ts +725 -0
  391. package/src/op/activities/index.ts +40 -4
  392. package/src/op/activities/live-detect.test.ts +143 -0
  393. package/src/op/activities/live-detect.ts +162 -0
  394. package/src/op/activities/registry.test.ts +11 -3
  395. package/src/op/activities/terraform.test.ts +7 -3
  396. package/src/op/activities/terraform.ts +861 -69
  397. package/src/op/activity-contracts.test.ts +147 -0
  398. package/src/op/activity-contracts.ts +178 -0
  399. package/src/op/adoption.test.ts +170 -0
  400. package/src/op/adoption.ts +241 -0
  401. package/src/op/builders.test.ts +60 -5
  402. package/src/op/builders.ts +95 -5
  403. package/src/op/resolve-root-mode.test.ts +85 -0
  404. package/src/op/resolve-root-mode.ts +86 -0
  405. package/src/plugin.test.ts +106 -0
  406. package/src/plugin.ts +186 -29
  407. package/src/skills/chant-terraform.md +1 -1
  408. package/src/validate.ts +10 -1
@@ -0,0 +1,24 @@
1
+ /**
2
+ * TF009: a credential-named variable is not marked `sensitive`.
3
+ *
4
+ * No tool in #2107's survey checks this. The authority is HashiCorp's own style
5
+ * guide, whose variables section says plainly: "For sensitive variables, such
6
+ * as passwords and private keys, set the sensitive parameter to true."
7
+ *
8
+ * Without the flag the value is echoed in `terraform plan` and
9
+ * `terraform apply` output, which means it lands in CI logs, in the pull
10
+ * request comment a plan bot posts, and in every terminal scrollback. The flag
11
+ * does not keep the value out of state (nothing does), which is why the
12
+ * remediation says both things.
13
+ *
14
+ * Only the name is read. A variable with no default and no value in the
15
+ * repository is still flagged, because the finding is about where the value
16
+ * goes at run time, not about what is committed. That is TF007's question.
17
+ *
18
+ * Scope: root and child modules alike (#2112). The condition is a property
19
+ * of the block itself, so a descended module's block is read exactly as a
20
+ * root's is.
21
+ */
22
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
23
+ export declare const tf009: PostSynthCheck;
24
+ //# sourceMappingURL=tf009.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf009.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf009.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAK1C,eAAO,MAAM,KAAK,EAAE,cA2BnB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * TF010: a `variable` declares no `type`.
3
+ *
4
+ * Without a type constraint Terraform accepts whatever it is given and infers
5
+ * the type from the value, so a variable meant to be a list arrives as a
6
+ * string from a `TF_VAR_` environment variable, or a number arrives as `"3"`
7
+ * from a tfvars file, and the failure surfaces deep inside a resource
8
+ * argument rather than at the module boundary where it was introduced.
9
+ *
10
+ * A blank `type` counts as absent, matching KICS, which fails a `type` that
11
+ * trims to empty.
12
+ *
13
+ * Scope: root and child modules alike (#2112). The condition is a property
14
+ * of the block itself, so a descended module's block is read exactly as a
15
+ * root's is.
16
+ */
17
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
18
+ export declare const tf010: PostSynthCheck;
19
+ //# sourceMappingURL=tf010.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf010.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf010.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAI1C,eAAO,MAAM,KAAK,EAAE,cAyBnB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * TF011: a `variable` declares no `description`.
3
+ *
4
+ * A module's variables are its API. The description is what `terraform-docs`
5
+ * renders into the README, what the HCP Terraform and Terraform Cloud variable
6
+ * UI shows next to the input box, and what a caller reads before deciding what
7
+ * to pass. Without it the only documentation is the variable's name.
8
+ *
9
+ * Report-only: this is documentation hygiene, filed the way KICS files it (as
10
+ * INFO) and the way tflint files it (in the `all` preset, not `recommended`).
11
+ *
12
+ * Scope: root and child modules alike (#2112). The condition is a property
13
+ * of the block itself, so a descended module's block is read exactly as a
14
+ * root's is.
15
+ */
16
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
17
+ export declare const tf011: PostSynthCheck;
18
+ //# sourceMappingURL=tf011.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf011.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf011.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAI1C,eAAO,MAAM,KAAK,EAAE,cAwBnB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * TF012: an `output` declares no `description`.
3
+ *
4
+ * The other half of a module's API. An output is what a caller wires into the
5
+ * next module, and the description is the only place to say what the value
6
+ * actually is (an id or an ARN, a full URL or a bare hostname) and whether it
7
+ * is stable enough to depend on.
8
+ *
9
+ * Report-only, for the same reason TF011 is.
10
+ *
11
+ * Scope: root and child modules alike (#2112). The condition is a property
12
+ * of the block itself, so a descended module's block is read exactly as a
13
+ * root's is.
14
+ */
15
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
16
+ export declare const tf012: PostSynthCheck;
17
+ //# sourceMappingURL=tf012.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf012.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf012.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAI1C,eAAO,MAAM,KAAK,EAAE,cAuBnB,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * TF013: `lifecycle { ignore_changes = all }`.
3
+ *
4
+ * `all` tells Terraform to ignore drift on every attribute of the resource
5
+ * after it is created. Nothing about that resource is ever reconciled again:
6
+ * a manual console edit, a deleted security-group rule, a downgraded instance
7
+ * class, all of it plans clean forever. It is also silent, because a plan that
8
+ * finds nothing looks exactly like a plan that was told to look at nothing.
9
+ *
10
+ * That is the observe half of chant's lifecycle switched off, so this is
11
+ * merge-worthy rather than hygiene. A list of specific attributes is fine and
12
+ * is not reported: ignoring `tags` an external tool writes is a real need, and
13
+ * naming them is what makes the intent auditable.
14
+ *
15
+ * Scope: root and child modules alike (#2112). The condition is a property
16
+ * of the block itself, so a descended module's block is read exactly as a
17
+ * root's is.
18
+ */
19
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
20
+ export declare const tf013: PostSynthCheck;
21
+ //# sourceMappingURL=tf013.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf013.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf013.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAc1C,eAAO,MAAM,KAAK,EAAE,cAyBnB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * TF014: a `provider` block inside a child module that configures anything.
3
+ *
4
+ * Scope: child modules only. A `provider` block in the ROOT module is where
5
+ * providers are supposed to be configured, and TF008 is what checks its
6
+ * contents.
7
+ *
8
+ * A child module that configures its own provider takes the decision away
9
+ * from its caller: the caller can no longer point the module at a different
10
+ * region, account or endpoint, and two calls of the module in one root cannot
11
+ * differ. Worse, Terraform cannot remove a module whose provider is declared
12
+ * inside it, because destroying the resources needs a provider configuration
13
+ * that the removal itself deletes. That is the "Provider configuration not
14
+ * present" failure that leaves a root unable to plan.
15
+ *
16
+ * The one legal form is a provider block that declares only `alias`, which
17
+ * names a slot the caller fills through `providers = { aws.replica =
18
+ * aws.west }`. That is a declaration, not a configuration, so a block whose
19
+ * body has nothing but `alias` is not reported. Everything else is: a
20
+ * `region`, a `profile`, an `assume_role` block, and `version` too, which has
21
+ * been deprecated in favour of `required_providers` since Terraform 0.13.
22
+ */
23
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
24
+ export declare const tf014: PostSynthCheck;
25
+ //# sourceMappingURL=tf014.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf014.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf014.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAU1C,eAAO,MAAM,KAAK,EAAE,cAkCnB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * TF015: a `backend` or `cloud` block inside a child module.
3
+ *
4
+ * Scope: child modules only. This is TF001's mirror image. TF001 wants a root
5
+ * module to declare a REMOTE backend, because a root without one keeps its
6
+ * state on local disk. A child module must declare neither: state belongs to
7
+ * the root,
8
+ * one state per root however many modules it calls, and Terraform says so
9
+ * directly, "A backend block can only appear in the root module" and the
10
+ * same for `cloud`. Depending on the version, the block is ignored with a
11
+ * warning or the root refuses to initialize, and either way the block is a
12
+ * claim about where state lives that the module does not get to make.
13
+ *
14
+ * The usual cause is a directory that used to be a root module and became a
15
+ * child when someone factored it out, with its `terraform` block carried
16
+ * along. The rest of that block is fine to keep: `required_version` and
17
+ * `required_providers` are meaningful in a child module and are not reported
18
+ * here.
19
+ *
20
+ * Label-blind on purpose (#2218). TF001 had to start reading the backend
21
+ * block's type label, since `local` is the state placement it warns about
22
+ * rather than a cure for it. Nothing of the sort applies here: what a child
23
+ * module may not do is name a backend at all, `local` included, and
24
+ * Terraform's own refusal ("A backend block can only appear in the root
25
+ * module") does not read the label either. `hasBlock` is the right test, and
26
+ * the `positive` fixture's child declares `backend "local"` for that reason.
27
+ */
28
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
29
+ export declare const tf015: PostSynthCheck;
30
+ //# sourceMappingURL=tf015.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf015.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf015.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAM1C,eAAO,MAAM,KAAK,EAAE,cAiCnB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * TF016: an attribute whose whole value is one quoted interpolation,
3
+ * `x = "${var.y}"`, the pre-0.12 style Terraform deprecated in 2019.
4
+ *
5
+ * The quotes buy nothing and cost readability: the expression is already an
6
+ * expression, and wrapping it in a template makes every value in the file look
7
+ * like a string whether it is one or not, which hides the actual type of an
8
+ * argument that takes a list or a bool.
9
+ *
10
+ * This is the one rule in the family that reads the block's SOURCE rather than
11
+ * its parsed body, and it has to. `@cdktf/hcl2json` renders both `x = var.y`
12
+ * and `x = "${var.y}"` as the string `"${var.y}"`, so a check over the parse
13
+ * cannot tell the deprecated form from the idiomatic one and would report every
14
+ * reference in the root. The quotes only survive in the text, so the text is
15
+ * what is scanned, one pass per file, through the same
16
+ * `interpolationOnlyLine` the deterministic fix uses, so the finding and the
17
+ * patch can never disagree.
18
+ *
19
+ * Out of reach, and deliberately not guessed at: tflint also reports the
20
+ * deprecated interpolation inside an object KEY (`"${var.k}" = "value"`).
21
+ * That is a different line shape and its fix is not a simple unquote, so this
22
+ * rule leaves it alone rather than emit a diff it cannot justify.
23
+ *
24
+ * Scope: root and child modules alike (#2112). The condition is a property
25
+ * of the block itself, so a descended module's block is read exactly as a
26
+ * root's is.
27
+ */
28
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
29
+ export declare const tf016: PostSynthCheck;
30
+ //# sourceMappingURL=tf016.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf016.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf016.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAK1C,eAAO,MAAM,KAAK,EAAE,cAqCnB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * TF017: a `module` block carries `depends_on`.
3
+ *
4
+ * `depends_on` on a module applies to every resource inside it, including the
5
+ * ones that had no reason to wait, so the whole module serializes behind the
6
+ * named dependency and a plan that could have run in parallel does not. It
7
+ * also makes the dependency invisible from inside the module, where the
8
+ * resource that actually needed the ordering lives.
9
+ *
10
+ * Passing an attribute of the dependency into a module input creates the same
11
+ * edge implicitly, only narrower and self-documenting.
12
+ *
13
+ * Scope: root and child modules alike (#2112). The condition is a property
14
+ * of the block itself, so a descended module's block is read exactly as a
15
+ * root's is.
16
+ */
17
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
18
+ export declare const tf017: PostSynthCheck;
19
+ //# sourceMappingURL=tf017.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf017.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf017.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAI1C,eAAO,MAAM,KAAK,EAAE,cAwBnB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * TF018: an `output` returns a whole resource or data source.
3
+ *
4
+ * `value = aws_instance.web` exports every attribute the provider schema
5
+ * happens to have, which is a much larger promise than the module meant to
6
+ * make. Consumers reach into whatever they find, the module can no longer
7
+ * change any of it, and a provider upgrade that adds or renames an attribute
8
+ * moves the module's public interface without anyone editing it. Sensitive
9
+ * attributes ride along too.
10
+ *
11
+ * A bare `module.x` reference is not reported: a module's outputs are already
12
+ * a curated surface, which is the property this rule is asking for.
13
+ *
14
+ * Scope: root and child modules alike (#2112). The condition is a property
15
+ * of the block itself, so a descended module's block is read exactly as a
16
+ * root's is.
17
+ */
18
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
19
+ export declare const tf018: PostSynthCheck;
20
+ //# sourceMappingURL=tf018.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf018.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf018.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAuB1C,eAAO,MAAM,KAAK,EAAE,cA0BnB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * TF019: a meta-argument is explicitly set to its own default, `false`.
3
+ *
4
+ * `sensitive` and `ephemeral` on a `variable` or an `output`, `prevent_destroy`
5
+ * and `create_before_destroy` inside a `lifecycle` block. All four default to
6
+ * false, so writing it changes nothing and reads as though someone considered
7
+ * the setting and turned it off, which is exactly the impression a reviewer
8
+ * should not get from a variable called `password`.
9
+ *
10
+ * The first TF rule with a mechanical fix: the remediation is the deletion of
11
+ * the line, so this ships `fixKind: "deterministic"` and `chant audit` renders
12
+ * the diff in its quick-wins section. `packages/core/src/audit/proof.ts` owns
13
+ * the patch, as it does for every other deterministic rule.
14
+ *
15
+ * Only a literal `false` counts. `prevent_destroy = var.protect` is a real
16
+ * decision expressed as a variable, and hcl2json leaves it a `"${var.protect}"`
17
+ * string rather than a boolean, so it never reaches the comparison.
18
+ *
19
+ * Scope: root and child modules alike (#2112). The condition is a property
20
+ * of the block itself, so a descended module's block is read exactly as a
21
+ * root's is.
22
+ */
23
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
24
+ export declare const tf019: PostSynthCheck;
25
+ //# sourceMappingURL=tf019.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf019.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf019.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAqB1C,eAAO,MAAM,KAAK,EAAE,cAuBnB,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * TF020: a `variable`, a `locals` entry, a `data` source or an aliased
3
+ * `provider` that nothing in its module scope references.
4
+ *
5
+ * Scope: root and child modules, each judged on its own. Terraform's
6
+ * namespaces are per module, so `var.region` inside `module.cdn` is the child
7
+ * module's variable and a reference to it in the root proves nothing about
8
+ * the child's. The reference index (`hcl/references.ts`) is keyed the same
9
+ * way, one scope per module, and this check never looks outside the scope the
10
+ * declaration is in.
11
+ *
12
+ * An unused declaration is dead weight rather than a defect, which is why
13
+ * this is report-only. It still earns a finding: a variable nobody reads is
14
+ * usually the leftover of a refactor, and the next reader has to prove that
15
+ * before deleting it. A data source is worse than dead weight, since it is
16
+ * read from the provider's API on every plan whether or not anything uses the
17
+ * result.
18
+ *
19
+ * Two deliberate gaps, both from the index being a string scan rather than an
20
+ * expression tree (see its module doc), and both the reason the credit to
21
+ * tflint's `terraform_unused_declarations` is `overlaps`:
22
+ *
23
+ * - A name mentioned in a string that is not an expression (a `description`
24
+ * that says "overrides var.region") reads as a reference, so the
25
+ * declaration is not reported. Quiet, and wrong in the safe direction.
26
+ * - A value reached only dynamically (`lookup(local.by_env, ...)` where the
27
+ * map is built elsewhere) is a real reference the scan does see, since the
28
+ * local is still named; but a variable consumed only through
29
+ * `TF_VAR_`-style external input is not, and a root's variables are
30
+ * frequently exactly that. Report-only keeps that from failing a build.
31
+ *
32
+ * A `provider` block with no `alias` is never reported: it is the default
33
+ * configuration for its type, used by every resource of that type without
34
+ * naming it. Only an aliased one has to be asked for by name.
35
+ */
36
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
37
+ export declare const tf020: PostSynthCheck;
38
+ //# sourceMappingURL=tf020.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf020.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf020.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAuB1C,eAAO,MAAM,KAAK,EAAE,cA2DnB,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * TF021: `count` used where `for_each` is safer, judged narrowly.
3
+ *
4
+ * Scope: root and child modules. A resource is a resource wherever it is
5
+ * declared, and the failure mode below does not depend on the scope.
6
+ *
7
+ * `count` addresses its instances by position: `aws_instance.web[0]`,
8
+ * `[1]`, `[2]`. Delete the middle element of the list the count was derived
9
+ * from and every instance after it shifts down one, so Terraform plans to
10
+ * destroy and recreate them all, in order, to move each one's identity onto
11
+ * the next index. `for_each` addresses by key instead, and removing one
12
+ * element removes exactly one instance.
13
+ *
14
+ * The narrow part is which counts get reported. Two conditions must both
15
+ * hold:
16
+ *
17
+ * 1. The count is plural and derived, not a switch. A numeric literal of two
18
+ * or more, or `length(var.x)` / `length(local.x)`. `count = 0`, `count =
19
+ * 1` and `count = var.enabled ? 1 : 0` are the conditional-resource idiom,
20
+ * which `for_each` does not replace, and they are never reported.
21
+ * 2. The resource uses `count.index` to build something that carries the
22
+ * instance's identity: a name, a bucket, a key, a `tags.Name`. That is what
23
+ * makes a shift destructive; a `count.index` used only to pick a subnet out
24
+ * of a list is reindexed silently and harmlessly.
25
+ *
26
+ * Redeploy's `terraform_prefer_for_each` reports every `count` over a
27
+ * collection, which is a broader rule and a noisier one, so the credit is
28
+ * `overlaps` rather than `equivalent`. choudoufu's `RuleCountIndex`
29
+ * (`internal/live/lint/count_index.go`) is the survey's deepest treatment of
30
+ * the identity-bearing question, and it is credited the same way. Report-only
31
+ * either way: a `count` with a stable list behind it is fine forever, and
32
+ * only the person who knows whether that list is stable can say.
33
+ */
34
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
35
+ import { type BlockBody } from "../../hcl/parse.js";
36
+ /** The `count` value, when it is one this rule reports on. */
37
+ export declare function pluralCount(body: BlockBody): string | undefined;
38
+ /** Identity-bearing attributes of this body whose value is built from `count.index`. */
39
+ export declare function identityUsesOfCountIndex(body: BlockBody): string[];
40
+ export declare const tf021: PostSynthCheck;
41
+ //# sourceMappingURL=tf021.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf021.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf021.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAiB,KAAK,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AA+BtF,8DAA8D;AAC9D,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAO/D;AAED,wFAAwF;AACxF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,CAQlE;AAED,eAAO,MAAM,KAAK,EAAE,cAiCnB,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * TF022: a credential-named attribute of a resource or data source holds a
3
+ * literal.
4
+ *
5
+ * tfsec's `general-secrets-sensitive-in-attribute`, consolidated in its v1
6
+ * line as `no-plaintext-exposure`, and KICS's `Passwords And Secrets` query.
7
+ * Broader and noisier than TF007, because a resource body has far more
8
+ * attributes than a variable has defaults, so the name heuristic does the
9
+ * gating: an attribute has to read like a credential AND hold a committed
10
+ * literal before it is reported.
11
+ *
12
+ * The value is in git history, in state, and in every plan output, and the
13
+ * blast radius is whatever the resource is: an RDS master password, a
14
+ * provider API token, a Kubernetes secret's data. The fix is always the same
15
+ * shape, a reference rather than a constant, which is what the message says
16
+ * rather than "remove this".
17
+ *
18
+ * Scope: root and child modules alike (#2112). The condition is a property
19
+ * of the block itself, so a descended module's block is read exactly as a
20
+ * root's is.
21
+ */
22
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
23
+ export declare const tf022: PostSynthCheck;
24
+ //# sourceMappingURL=tf022.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf022.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf022.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAK1C,eAAO,MAAM,KAAK,EAAE,cA6BnB,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * TF024: a live root declares a `backend` or `cloud` block.
3
+ *
4
+ * choudoufu refuses this combination at `init`, before any command runs,
5
+ * naming both blocks that collide: "Both a backend and a live configuration
6
+ * are present" (a `backend` block) or "Both a cloud and a live configuration
7
+ * are present" (a `cloud` block). A live root keeps no state to store, since
8
+ * prior state is a projection rebuilt from the live system every run, so
9
+ * either block is a contradiction about where the truth lives, not a
10
+ * redundant setting.
11
+ *
12
+ * TF001 is the equivalent check for a stock root (no remote backend is
13
+ * configured); it explicitly does not fire on a live root, and this check is
14
+ * why: the two are mutually exclusive by construction; a root is flagged by
15
+ * at most one of them.
16
+ *
17
+ * Scope: root modules only (#2112). A child module's backend or cloud block
18
+ * is TF015's finding, whatever binary the root runs.
19
+ *
20
+ * One diagnostic per root, fired from the root's `terraform` block.
21
+ */
22
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
23
+ export declare const tf024: PostSynthCheck;
24
+ //# sourceMappingURL=tf024.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf024.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf024.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAM1C,eAAO,MAAM,KAAK,EAAE,cAqCnB,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * TF025: a live root reads a non-default `terraform.workspace`, or configures
3
+ * one through `terraform.roots`.
4
+ *
5
+ * choudoufu refuses any workspace but `default` on a live root, and refuses
6
+ * `workspace new`/`workspace select` outright: only the default workspace
7
+ * exists there ("How you run it" in choudoufu's compatibility reference).
8
+ * Two independent ways a configuration ends up asking for one:
9
+ *
10
+ * - `terraform.roots.<name>.workspace` in `chant.config.*` selects a
11
+ * workspace via `TF_WORKSPACE` before any HCL is even read, chant's own
12
+ * equivalent of `workspace select`, so it is flagged the same way.
13
+ * - A `"${terraform.workspace}"` interpolation anywhere in a block's body
14
+ * reads the (necessarily `"default"`) workspace name in configuration,
15
+ * which is not itself refused by choudoufu but is dead code on a live
16
+ * root and a sign the configuration was written for a workspace-per-
17
+ * environment layout that live mode does not support.
18
+ *
19
+ * The first fires once per root (it names a root-level config field, not a
20
+ * particular block); the second fires once per block that contains the
21
+ * reference, since each is its own thing to fix.
22
+ *
23
+ * Scope: the config half is root-only, since it reads a root-level config
24
+ * field; the reference half reads any block of a live root, a descended child
25
+ * module's included, and names the call chain that reached it (#2112).
26
+ */
27
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
28
+ export declare const tf025: PostSynthCheck;
29
+ //# sourceMappingURL=tf025.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf025.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf025.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAY1C,eAAO,MAAM,KAAK,EAAE,cAyDnB,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * TF026: a live root declares `delete: "never"` but its `policy` block still
3
+ * deletes an orphaned marked resource.
4
+ *
5
+ * chant's cross-lexicon delete-mode vocabulary (`terraform.roots.<name>.delete`,
6
+ * `../../config.ts`'s `TerraformDeleteMode`) maps onto choudoufu's `policy`
7
+ * block: `undeclared_tagged` governs what happens to a resource this estate
8
+ * marked that the configuration no longer declares, and defaults to
9
+ * `"delete"` when the `policy` block omits it, or the root declares no
10
+ * `policy` block at all. `delete: "never"` promises that `TerraformApplyOp`
11
+ * never proposes deleting a resource it owns, so a root making that promise
12
+ * has to have actually turned the quadrant's default off — `"keep"`,
13
+ * `"untag"` or `"report"` all satisfy it; anything else (the unset default,
14
+ * or an explicit `"delete"`) does not.
15
+ *
16
+ * One diagnostic per root, fired from the root's `Terraform::Live` entity —
17
+ * the same entity TF024 and TF025 fire from.
18
+ */
19
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
20
+ import { type BlockBody } from "../../hcl/parse.js";
21
+ /**
22
+ * The `policy { }` block nested in a `live { }` block's body, hcl2json's own
23
+ * "one block, wrapped in an array" shape. Exported for TF027 (`./tf027.ts`),
24
+ * which reads the other quadrant of the same block.
25
+ */
26
+ export declare function policyBlockOf(liveBody: BlockBody): BlockBody | undefined;
27
+ export declare const tf026: PostSynthCheck;
28
+ //# sourceMappingURL=tf026.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf026.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf026.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAKxE;AAED,eAAO,MAAM,KAAK,EAAE,cAyCnB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * TF027: a live root's `policy` block sets `undeclared_untagged = "delete"`.
3
+ *
4
+ * The `undeclared_untagged` quadrant covers a live resource this estate never
5
+ * marked and the configuration does not declare, a resource chant does not
6
+ * own. `"delete"` there is account-scoped reconciliation: choudoufu compares
7
+ * the configuration against everything a `scope` block reaches and removes
8
+ * what is not in it. chant never proposes deleting a resource it does not
9
+ * own, and neither does an Op it generates, so the setting is refused on any
10
+ * live root the project builds, scoped or not. Narrowing the estate's own
11
+ * ownership answer (`undeclared_tagged`, which TF026 checks against
12
+ * `delete: "never"`) is the setting to reach for instead.
13
+ *
14
+ * `TerraformApplyOp` (`../../composites/terraform-apply-op.ts`) makes the
15
+ * same refusal when it builds, but only for a project on a `chant.config.json`
16
+ * whose root it can resolve synchronously (#2216): a `chant.config.ts` is
17
+ * project-authored code that `resolveRootModeSync` will not evaluate, so the
18
+ * composite reads the root as stock and never asks the policy question. This
19
+ * check reads `props.mode` off the parsed HCL instead, which the build stamps
20
+ * on every entity whatever the config file is written in, so it is the
21
+ * refusal that actually fires. It also fires for a live root with no apply Op
22
+ * at all, since the setting is a statement about the estate rather than about
23
+ * one Op.
24
+ *
25
+ * One diagnostic per root, fired from the root's `Terraform::Live` entity,
26
+ * the same entity TF024, TF025 and TF026 fire from.
27
+ */
28
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
29
+ export declare const tf027: PostSynthCheck;
30
+ //# sourceMappingURL=tf027.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf027.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf027.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAK1C,eAAO,MAAM,KAAK,EAAE,cAoCnB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * TF028: a live root is watched by a `TerraformWatchOp` built in stock mode.
3
+ *
4
+ * `TerraformWatchOp`'s `live` flag is declared, not detected: a composite is
5
+ * built by `chant build` without reading a root module's `.tf` files, so the
6
+ * Op author says which shape the Plan phase takes and, until #2216, nothing
7
+ * checked the answer against the root. Leaving it off a live root is silent
8
+ * and lossy. `live: true` swaps the Plan step for `choudoufuLivePlan`, whose
9
+ * single read of the live system answers three questions (drift, how many
10
+ * live resources sit at a declared identity carrying no marker, and how many
11
+ * of those an exact content match makes claimable); a stock `terraformPlan`
12
+ * step answers the first alone, so the watch reports drift and stays quiet
13
+ * about every unowned and adoptable resource in the estate.
14
+ *
15
+ * The check runs over the whole built graph because that is where both halves
16
+ * of the question are: the root's mode is stamped on every parsed entity by
17
+ * the build (`props.mode`, #2103), and the Op is a `Chant::Op` entity carrying
18
+ * the composite's own labels. `TerraformWatchOp` itself cross-checks the flag
19
+ * where it can (`../../op/resolve-root-mode.ts`), but that read is a
20
+ * `chant.config.json`-only one, so on a `chant.config.ts` project, which is
21
+ * every project in this repository, this check is what actually fires.
22
+ *
23
+ * Read off the labels the composite stamps rather than off the emitted step,
24
+ * since a stock `terraformPlan -out` step against a live root is correct in
25
+ * `TerraformApplyOp`: choudoufu v0.13.0 accepts `plan -out` and re-plans
26
+ * against the file at apply (#2157), so the apply Op builds one shape for
27
+ * both kinds of root and the step alone says nothing about a mistake.
28
+ *
29
+ * One diagnostic per Op, fired from the Op's entity.
30
+ */
31
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
32
+ export declare const tf028: PostSynthCheck;
33
+ //# sourceMappingURL=tf028.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tf028.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf028.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAuB1C,eAAO,MAAM,KAAK,EAAE,cAqCnB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { LintContext } from "@intentius/chant/lint/rule";
2
+ /**
3
+ * Parse `fixtures/<ruleId>/<name>-op.ts` into a {@link LintContext} whose
4
+ * `filePath` is the logical `<name>.op.ts` a real Op file would carry.
5
+ *
6
+ * Three lines per fixture in a test:
7
+ * ```ts
8
+ * const diags = planBeforeApplyRule.check(loadRuleFixture("TF101", "positive"));
9
+ * expect(diags).toHaveLength(1);
10
+ * ```
11
+ */
12
+ export declare function loadRuleFixture(ruleId: string, name: string): LintContext;
13
+ //# sourceMappingURL=load.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../src/lint/rules/fixtures/load.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAI9D;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAMzE"}