@intentius/chant-lexicon-terraform 0.124.54 → 0.124.56

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 (351) hide show
  1. package/README.md +7 -4
  2. package/dist/ci-setup.d.ts +11 -0
  3. package/dist/ci-setup.d.ts.map +1 -0
  4. package/dist/ci-setup.js +41 -0
  5. package/dist/components/capability-plugin.d.ts +40 -6
  6. package/dist/components/capability-plugin.d.ts.map +1 -1
  7. package/dist/components/capability-plugin.js +174 -30
  8. package/dist/components/compose-group.d.ts +1 -1
  9. package/dist/components/compose-group.d.ts.map +1 -1
  10. package/dist/components/compose-group.js +1 -1
  11. package/dist/components/release-inputs.d.ts +29 -0
  12. package/dist/components/release-inputs.d.ts.map +1 -0
  13. package/dist/components/release-inputs.js +57 -0
  14. package/dist/components/trace-facts.d.ts +16 -0
  15. package/dist/components/trace-facts.d.ts.map +1 -0
  16. package/dist/components/trace-facts.js +19 -0
  17. package/dist/cone.d.ts +53 -0
  18. package/dist/cone.d.ts.map +1 -0
  19. package/dist/cone.js +119 -0
  20. package/dist/cost-hold.d.ts +27 -0
  21. package/dist/cost-hold.d.ts.map +1 -0
  22. package/dist/cost-hold.js +21 -0
  23. package/dist/drift-rows.d.ts +61 -0
  24. package/dist/drift-rows.d.ts.map +1 -0
  25. package/dist/drift-rows.js +108 -0
  26. package/dist/exit-codes.d.ts +55 -0
  27. package/dist/exit-codes.d.ts.map +1 -0
  28. package/dist/exit-codes.js +48 -0
  29. package/dist/index.d.ts +2 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +3 -0
  32. package/dist/integrity.json +7 -4
  33. package/dist/lint/audit-catalog.d.ts.map +1 -1
  34. package/dist/lint/audit-catalog.js +27 -3
  35. package/dist/lint/audit-lineage.d.ts +14 -2
  36. package/dist/lint/audit-lineage.d.ts.map +1 -1
  37. package/dist/lint/post-synth/index.d.ts.map +1 -1
  38. package/dist/lint/post-synth/index.js +4 -0
  39. package/dist/lint/post-synth/record-store.d.ts +54 -0
  40. package/dist/lint/post-synth/record-store.d.ts.map +1 -0
  41. package/dist/lint/post-synth/record-store.js +104 -0
  42. package/dist/lint/post-synth/tf001.d.ts +2 -2
  43. package/dist/lint/post-synth/tf001.js +2 -2
  44. package/dist/lint/post-synth/tf024.d.ts +35 -11
  45. package/dist/lint/post-synth/tf024.d.ts.map +1 -1
  46. package/dist/lint/post-synth/tf024.js +92 -20
  47. package/dist/lint/post-synth/tf046.d.ts +64 -0
  48. package/dist/lint/post-synth/tf046.d.ts.map +1 -0
  49. package/dist/lint/post-synth/tf046.js +175 -0
  50. package/dist/lint/post-synth/tf047.d.ts +36 -0
  51. package/dist/lint/post-synth/tf047.d.ts.map +1 -0
  52. package/dist/lint/post-synth/tf047.js +94 -0
  53. package/dist/lock-rows.d.ts +36 -0
  54. package/dist/lock-rows.d.ts.map +1 -0
  55. package/dist/lock-rows.js +60 -0
  56. package/dist/lock-timeout.d.ts +22 -0
  57. package/dist/lock-timeout.d.ts.map +1 -0
  58. package/dist/lock-timeout.js +32 -0
  59. package/dist/manifest.json +1 -1
  60. package/dist/module-catalog/index.d.ts +69 -0
  61. package/dist/module-catalog/index.d.ts.map +1 -0
  62. package/dist/module-catalog/index.js +110 -0
  63. package/dist/module-catalog/refresh-cli.d.ts +4 -0
  64. package/dist/module-catalog/refresh-cli.d.ts.map +1 -0
  65. package/dist/module-catalog/refresh-cli.js +64 -0
  66. package/dist/module-catalog/static-tier.d.ts +6 -0
  67. package/dist/module-catalog/static-tier.d.ts.map +1 -0
  68. package/dist/module-catalog/static-tier.js +1650 -0
  69. package/dist/module-catalog/types.d.ts +65 -0
  70. package/dist/module-catalog/types.d.ts.map +1 -0
  71. package/dist/module-catalog/types.js +33 -0
  72. package/dist/okf/index.md +3 -1
  73. package/dist/okf/rules/TF024.md +2 -2
  74. package/dist/okf/rules/TF046.md +11 -0
  75. package/dist/okf/rules/TF047.md +11 -0
  76. package/dist/op/activities/terraform.d.ts +29 -0
  77. package/dist/op/activities/terraform.d.ts.map +1 -1
  78. package/dist/op/activities/terraform.js +19 -4
  79. package/dist/pin/consumers.d.ts +35 -0
  80. package/dist/pin/consumers.d.ts.map +1 -0
  81. package/dist/pin/consumers.js +70 -0
  82. package/dist/plugin.d.ts.map +1 -1
  83. package/dist/plugin.js +5 -0
  84. package/dist/registry/address.d.ts +63 -0
  85. package/dist/registry/address.d.ts.map +1 -0
  86. package/dist/registry/address.js +65 -0
  87. package/dist/registry/catalog-read.d.ts +14 -0
  88. package/dist/registry/catalog-read.d.ts.map +1 -0
  89. package/dist/registry/catalog-read.js +58 -0
  90. package/dist/registry/deprecated.d.ts +37 -0
  91. package/dist/registry/deprecated.d.ts.map +1 -0
  92. package/dist/registry/deprecated.js +43 -0
  93. package/dist/registry/docs.d.ts +96 -0
  94. package/dist/registry/docs.d.ts.map +1 -0
  95. package/dist/registry/docs.js +210 -0
  96. package/dist/registry/edge/edge.d.ts +46 -0
  97. package/dist/registry/edge/edge.d.ts.map +1 -0
  98. package/dist/registry/edge/edge.js +194 -0
  99. package/dist/registry/edge/index.d.ts +11 -0
  100. package/dist/registry/edge/index.d.ts.map +1 -0
  101. package/dist/registry/edge/index.js +10 -0
  102. package/dist/registry/edge/lambda-edge.d.ts +76 -0
  103. package/dist/registry/edge/lambda-edge.d.ts.map +1 -0
  104. package/dist/registry/edge/lambda-edge.js +95 -0
  105. package/dist/registry/edge/sigv4-web.d.ts +33 -0
  106. package/dist/registry/edge/sigv4-web.d.ts.map +1 -0
  107. package/dist/registry/edge/sigv4-web.js +56 -0
  108. package/dist/registry/edge/token-source.d.ts +73 -0
  109. package/dist/registry/edge/token-source.d.ts.map +1 -0
  110. package/dist/registry/edge/token-source.js +115 -0
  111. package/dist/registry/edge/worker.d.ts +45 -0
  112. package/dist/registry/edge/worker.d.ts.map +1 -0
  113. package/dist/registry/edge/worker.js +26 -0
  114. package/dist/registry/handler.d.ts +25 -0
  115. package/dist/registry/handler.d.ts.map +1 -0
  116. package/dist/registry/handler.js +75 -0
  117. package/dist/registry/headers-file.d.ts +21 -0
  118. package/dist/registry/headers-file.d.ts.map +1 -0
  119. package/dist/registry/headers-file.js +57 -0
  120. package/dist/registry/index.d.ts +31 -0
  121. package/dist/registry/index.d.ts.map +1 -0
  122. package/dist/registry/index.js +30 -0
  123. package/dist/registry/mirror-paths.d.ts +9 -0
  124. package/dist/registry/mirror-paths.d.ts.map +1 -0
  125. package/dist/registry/mirror-paths.js +8 -0
  126. package/dist/registry/mirror.d.ts +130 -0
  127. package/dist/registry/mirror.d.ts.map +1 -0
  128. package/dist/registry/mirror.js +319 -0
  129. package/dist/registry/proxies.d.ts +73 -0
  130. package/dist/registry/proxies.d.ts.map +1 -0
  131. package/dist/registry/proxies.js +111 -0
  132. package/dist/registry/reader.d.ts +57 -0
  133. package/dist/registry/reader.d.ts.map +1 -0
  134. package/dist/registry/reader.js +198 -0
  135. package/dist/registry/semver.d.ts +16 -0
  136. package/dist/registry/semver.d.ts.map +1 -0
  137. package/dist/registry/semver.js +24 -0
  138. package/dist/registry/serve.d.ts +24 -0
  139. package/dist/registry/serve.d.ts.map +1 -0
  140. package/dist/registry/serve.js +64 -0
  141. package/dist/registry/source-forms.d.ts +79 -0
  142. package/dist/registry/source-forms.d.ts.map +1 -0
  143. package/dist/registry/source-forms.js +202 -0
  144. package/dist/registry/targets/artifactory.d.ts +28 -0
  145. package/dist/registry/targets/artifactory.d.ts.map +1 -0
  146. package/dist/registry/targets/artifactory.js +206 -0
  147. package/dist/registry/targets/fake-artifactory.d.ts +30 -0
  148. package/dist/registry/targets/fake-artifactory.d.ts.map +1 -0
  149. package/dist/registry/targets/fake-artifactory.js +142 -0
  150. package/dist/registry/targets/fake-gitlab.d.ts +39 -0
  151. package/dist/registry/targets/fake-gitlab.d.ts.map +1 -0
  152. package/dist/registry/targets/fake-gitlab.js +136 -0
  153. package/dist/registry/targets/fake-hcp.d.ts +50 -0
  154. package/dist/registry/targets/fake-hcp.d.ts.map +1 -0
  155. package/dist/registry/targets/fake-hcp.js +202 -0
  156. package/dist/registry/targets/fake-http.d.ts +31 -0
  157. package/dist/registry/targets/fake-http.d.ts.map +1 -0
  158. package/dist/registry/targets/fake-http.js +87 -0
  159. package/dist/registry/targets/fake-nexus.d.ts +27 -0
  160. package/dist/registry/targets/fake-nexus.d.ts.map +1 -0
  161. package/dist/registry/targets/fake-nexus.js +137 -0
  162. package/dist/registry/targets/gitlab.d.ts +53 -0
  163. package/dist/registry/targets/gitlab.d.ts.map +1 -0
  164. package/dist/registry/targets/gitlab.js +187 -0
  165. package/dist/registry/targets/hcp.d.ts +29 -0
  166. package/dist/registry/targets/hcp.d.ts.map +1 -0
  167. package/dist/registry/targets/hcp.js +310 -0
  168. package/dist/registry/targets/hosted.d.ts +62 -0
  169. package/dist/registry/targets/hosted.d.ts.map +1 -0
  170. package/dist/registry/targets/hosted.js +74 -0
  171. package/dist/registry/targets/index.d.ts +18 -0
  172. package/dist/registry/targets/index.d.ts.map +1 -0
  173. package/dist/registry/targets/index.js +17 -0
  174. package/dist/registry/targets/module-target.d.ts +68 -0
  175. package/dist/registry/targets/module-target.d.ts.map +1 -0
  176. package/dist/registry/targets/module-target.js +63 -0
  177. package/dist/registry/targets/nexus.d.ts +43 -0
  178. package/dist/registry/targets/nexus.d.ts.map +1 -0
  179. package/dist/registry/targets/nexus.js +250 -0
  180. package/dist/registry/targets/zip.d.ts +55 -0
  181. package/dist/registry/targets/zip.d.ts.map +1 -0
  182. package/dist/registry/targets/zip.js +278 -0
  183. package/dist/registry/writer.d.ts +101 -0
  184. package/dist/registry/writer.d.ts.map +1 -0
  185. package/dist/registry/writer.js +109 -0
  186. package/dist/rules/record-store.ts +122 -0
  187. package/dist/rules/tf001.ts +2 -2
  188. package/dist/rules/tf024.ts +105 -22
  189. package/dist/rules/tf046.ts +204 -0
  190. package/dist/rules/tf047.ts +114 -0
  191. package/dist/state/azure-blob.d.ts +8 -67
  192. package/dist/state/azure-blob.d.ts.map +1 -1
  193. package/dist/state/azure-blob.js +6 -199
  194. package/dist/state/gcs.d.ts +7 -61
  195. package/dist/state/gcs.d.ts.map +1 -1
  196. package/dist/state/gcs.js +5 -222
  197. package/dist/state/object-store.d.ts +4 -33
  198. package/dist/state/object-store.d.ts.map +1 -1
  199. package/dist/state/object-store.js +4 -17
  200. package/dist/state/s3.d.ts +11 -58
  201. package/dist/state/s3.d.ts.map +1 -1
  202. package/dist/state/s3.js +10 -161
  203. package/dist/state/store.js +2 -2
  204. package/dist/state-ops.d.ts +255 -0
  205. package/dist/state-ops.d.ts.map +1 -0
  206. package/dist/state-ops.js +305 -0
  207. package/dist/state-reads.d.ts +57 -0
  208. package/dist/state-reads.d.ts.map +1 -0
  209. package/dist/state-reads.js +104 -0
  210. package/dist/used-sources.d.ts +54 -0
  211. package/dist/used-sources.d.ts.map +1 -0
  212. package/dist/used-sources.js +157 -0
  213. package/package.json +19 -3
  214. package/src/__fixtures__/drift-record/README.md +5 -0
  215. package/src/__fixtures__/drift-rows/live-root-plan.json +70 -0
  216. package/src/__fixtures__/drift-rows/refresh-plan.json +61 -0
  217. package/src/__fixtures__/used-sources/root/extra.tofu +1 -0
  218. package/src/__fixtures__/used-sources/root/main.tf +31 -0
  219. package/src/__fixtures__/used-sources/root/modules/net/main.tf +14 -0
  220. package/src/__fixtures__/used-sources/root/modules/net/versions.tf.json +7 -0
  221. package/src/__fixtures__/used-sources/unit/terragrunt.hcl +3 -0
  222. package/src/ci-setup.ts +42 -0
  223. package/src/components/capability-plugin.test.ts +26 -14
  224. package/src/components/capability-plugin.ts +185 -31
  225. package/src/components/compose-group.ts +1 -1
  226. package/src/components/pr-loop-compose.tofu.e2e.test.ts +1 -1
  227. package/src/components/pr-loop.tofu.test.ts +1 -1
  228. package/src/components/release-inputs.ts +69 -0
  229. package/src/components/trace-facts.test.ts +21 -0
  230. package/src/components/trace-facts.ts +27 -0
  231. package/src/cone.ts +138 -0
  232. package/src/cost-hold.ts +29 -0
  233. package/src/describe-resources.engine-facts.test.ts +2 -3
  234. package/src/drift-rows.test.ts +135 -0
  235. package/src/drift-rows.ts +137 -0
  236. package/src/exit-codes.test.ts +23 -0
  237. package/src/exit-codes.ts +59 -0
  238. package/src/index.ts +3 -0
  239. package/src/lint/audit-catalog.ts +29 -3
  240. package/src/lint/audit-lineage.ts +14 -2
  241. package/src/lint/post-synth/fixtures/TF024/live-with-record-store/main.tf +18 -0
  242. package/src/lint/post-synth/fixtures/TF024/sidecar-with-backend/estate.chdf.hcl +1 -0
  243. package/src/lint/post-synth/fixtures/TF024/sidecar-with-backend/main.tf +10 -0
  244. package/src/lint/post-synth/fixtures/TF046/azurerm-no-resource-group/main.tf +15 -0
  245. package/src/lint/post-synth/fixtures/TF046/backend-config-only/main.tf +14 -0
  246. package/src/lint/post-synth/fixtures/TF046/derived-s3/backend.tf +7 -0
  247. package/src/lint/post-synth/fixtures/TF046/derived-s3/main.tf +9 -0
  248. package/src/lint/post-synth/fixtures/TF046/explicit-local/main.tf +16 -0
  249. package/src/lint/post-synth/fixtures/TF046/explicit-s3-beside-local-backend/main.tf +15 -0
  250. package/src/lint/post-synth/fixtures/TF046/implied-local/main.tf +9 -0
  251. package/src/lint/post-synth/fixtures/TF046/sidecar-implied/estate.chdf.hcl +1 -0
  252. package/src/lint/post-synth/fixtures/TF046/sidecar-implied/main.tf +5 -0
  253. package/src/lint/post-synth/fixtures/TF047/clear/main.tf +12 -0
  254. package/src/lint/post-synth/fixtures/TF047/refused/main.tf +12 -0
  255. package/src/lint/post-synth/fixtures/TF047/unknown-module/main.tf +12 -0
  256. package/src/lint/post-synth/fixtures/TF047/unknown-version/main.tf +12 -0
  257. package/src/lint/post-synth/index.ts +4 -0
  258. package/src/lint/post-synth/record-store.ts +122 -0
  259. package/src/lint/post-synth/tf001.ts +2 -2
  260. package/src/lint/post-synth/tf024.test.ts +26 -5
  261. package/src/lint/post-synth/tf024.ts +105 -22
  262. package/src/lint/post-synth/tf046.test.ts +137 -0
  263. package/src/lint/post-synth/tf046.ts +204 -0
  264. package/src/lint/post-synth/tf047.test.ts +56 -0
  265. package/src/lint/post-synth/tf047.ts +114 -0
  266. package/src/lock-rows.test.ts +70 -0
  267. package/src/lock-rows.ts +82 -0
  268. package/src/lock-timeout.ts +34 -0
  269. package/src/module-catalog/index.test.ts +93 -0
  270. package/src/module-catalog/index.ts +159 -0
  271. package/src/module-catalog/refresh-cli.ts +68 -0
  272. package/src/module-catalog/static-tier.ts +1659 -0
  273. package/src/module-catalog/types.ts +88 -0
  274. package/src/op/activities/terraform.ts +46 -5
  275. package/src/op-wave-step.test.ts +109 -0
  276. package/src/pin/__fixtures__/consumers/live/dev/main.tf +4 -0
  277. package/src/pin/__fixtures__/consumers/live/prod/main.tf +21 -0
  278. package/src/pin/__fixtures__/consumers/units/vpc/terragrunt.hcl +7 -0
  279. package/src/pin/consumers.test.ts +57 -0
  280. package/src/pin/consumers.ts +95 -0
  281. package/src/plugin.ts +6 -0
  282. package/src/registry/__fixtures__/docs/documented/.terraform-docs.yml +3 -0
  283. package/src/registry/__fixtures__/docs/documented/README.md +1 -0
  284. package/src/registry/__fixtures__/docs/documented/main.tf +8 -0
  285. package/src/registry/__fixtures__/docs/json/main.tf.json +14 -0
  286. package/src/registry/__fixtures__/docs/vpc/README.md +3 -0
  287. package/src/registry/__fixtures__/docs/vpc/examples/complete/main.tf +5 -0
  288. package/src/registry/__fixtures__/docs/vpc/examples/simple/README.md +1 -0
  289. package/src/registry/__fixtures__/docs/vpc/examples/simple/main.tf +4 -0
  290. package/src/registry/__fixtures__/docs/vpc/main.tf +14 -0
  291. package/src/registry/__fixtures__/docs/vpc/outputs.tf +9 -0
  292. package/src/registry/__fixtures__/docs/vpc/variables.tf +16 -0
  293. package/src/registry/__fixtures__/proxied-root/main.tf +12 -0
  294. package/src/registry/address.ts +100 -0
  295. package/src/registry/catalog-read.ts +56 -0
  296. package/src/registry/deprecated.test.ts +139 -0
  297. package/src/registry/deprecated.ts +76 -0
  298. package/src/registry/docs.test.ts +140 -0
  299. package/src/registry/docs.ts +299 -0
  300. package/src/registry/edge/bundle.test.ts +50 -0
  301. package/src/registry/edge/edge.test.ts +176 -0
  302. package/src/registry/edge/edge.ts +211 -0
  303. package/src/registry/edge/index.ts +10 -0
  304. package/src/registry/edge/lambda-edge.ts +127 -0
  305. package/src/registry/edge/sigv4-web.ts +79 -0
  306. package/src/registry/edge/token-source.test.ts +258 -0
  307. package/src/registry/edge/token-source.ts +169 -0
  308. package/src/registry/edge/worker.ts +61 -0
  309. package/src/registry/handler.ts +89 -0
  310. package/src/registry/headers-file.ts +61 -0
  311. package/src/registry/index.ts +31 -0
  312. package/src/registry/mirror-paths.ts +10 -0
  313. package/src/registry/mirror.test.ts +198 -0
  314. package/src/registry/mirror.ts +395 -0
  315. package/src/registry/proxies.test.ts +153 -0
  316. package/src/registry/proxies.ts +132 -0
  317. package/src/registry/reader.ts +225 -0
  318. package/src/registry/registry.test.ts +262 -0
  319. package/src/registry/semver.ts +34 -0
  320. package/src/registry/serve.ts +82 -0
  321. package/src/registry/source-forms.test.ts +87 -0
  322. package/src/registry/source-forms.ts +216 -0
  323. package/src/registry/targets/artifactory.test.ts +248 -0
  324. package/src/registry/targets/artifactory.ts +257 -0
  325. package/src/registry/targets/fake-artifactory.ts +158 -0
  326. package/src/registry/targets/fake-gitlab.ts +161 -0
  327. package/src/registry/targets/fake-hcp.ts +233 -0
  328. package/src/registry/targets/fake-http.ts +97 -0
  329. package/src/registry/targets/fake-nexus.ts +152 -0
  330. package/src/registry/targets/gitlab.test.ts +208 -0
  331. package/src/registry/targets/gitlab.ts +223 -0
  332. package/src/registry/targets/hcp.test.ts +230 -0
  333. package/src/registry/targets/hcp.ts +360 -0
  334. package/src/registry/targets/hosted.ts +117 -0
  335. package/src/registry/targets/index.ts +17 -0
  336. package/src/registry/targets/module-target.ts +131 -0
  337. package/src/registry/targets/nexus.test.ts +220 -0
  338. package/src/registry/targets/nexus.ts +314 -0
  339. package/src/registry/targets/zip.test.ts +65 -0
  340. package/src/registry/targets/zip.ts +287 -0
  341. package/src/registry/writer.ts +155 -0
  342. package/src/state/azure-blob.ts +6 -221
  343. package/src/state/gcs.ts +5 -252
  344. package/src/state/object-store.ts +4 -32
  345. package/src/state/s3.ts +10 -182
  346. package/src/state/store.ts +2 -2
  347. package/src/state-ops.test.ts +182 -0
  348. package/src/state-ops.ts +462 -0
  349. package/src/state-reads.ts +116 -0
  350. package/src/used-sources.test.ts +75 -0
  351. package/src/used-sources.ts +204 -0
@@ -0,0 +1,10 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+
4
+ backend "gcs" {
5
+ bucket = "tfstate"
6
+ prefix = "fixture"
7
+ }
8
+ }
9
+
10
+ resource "null_resource" "first" {}
@@ -0,0 +1,15 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+
4
+ live {
5
+ estate = "fixture-estate"
6
+ }
7
+
8
+ backend "azurerm" {
9
+ storage_account_name = "fixturestate"
10
+ container_name = "tfstate"
11
+ key = "fixture.terraform.tfstate"
12
+ }
13
+ }
14
+
15
+ resource "null_resource" "first" {}
@@ -0,0 +1,14 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+
4
+ live {
5
+ estate = "fixture-estate"
6
+ }
7
+
8
+ # bucket and region come from -backend-config, which choudoufu does not read.
9
+ backend "s3" {
10
+ key = "fixture/terraform.tfstate"
11
+ }
12
+ }
13
+
14
+ resource "null_resource" "first" {}
@@ -0,0 +1,7 @@
1
+ terraform {
2
+ backend "s3" {
3
+ bucket = "tfstate"
4
+ key = "fixture/terraform.tfstate"
5
+ region = "us-east-1"
6
+ }
7
+ }
@@ -0,0 +1,9 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+
4
+ live {
5
+ estate = "fixture-estate"
6
+ }
7
+ }
8
+
9
+ resource "null_resource" "first" {}
@@ -0,0 +1,16 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+
4
+ live {
5
+ estate = "fixture-estate"
6
+
7
+ record_store "local" {}
8
+ }
9
+
10
+ backend "s3" {
11
+ bucket = "tfstate"
12
+ key = "fixture/terraform.tfstate"
13
+ }
14
+ }
15
+
16
+ resource "null_resource" "first" {}
@@ -0,0 +1,15 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+
4
+ live {
5
+ estate = "fixture-estate"
6
+
7
+ record_store "s3" {
8
+ bucket = "fixture-records"
9
+ }
10
+ }
11
+
12
+ backend "local" {}
13
+ }
14
+
15
+ resource "null_resource" "first" {}
@@ -0,0 +1,9 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+
4
+ live {
5
+ estate = "fixture-estate"
6
+ }
7
+ }
8
+
9
+ resource "null_resource" "first" {}
@@ -0,0 +1 @@
1
+ estate = "fixture-estate"
@@ -0,0 +1,5 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+ }
4
+
5
+ resource "null_resource" "first" {}
@@ -0,0 +1,12 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+
4
+ live {
5
+ estate = "fixture-estate"
6
+ }
7
+ }
8
+
9
+ module "sqs" {
10
+ source = "terraform-aws-modules/sqs/aws"
11
+ version = "5.2.2"
12
+ }
@@ -0,0 +1,12 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+
4
+ live {
5
+ estate = "fixture-estate"
6
+ }
7
+ }
8
+
9
+ module "eks" {
10
+ source = "terraform-aws-modules/eks/aws"
11
+ version = "21.29.0"
12
+ }
@@ -0,0 +1,12 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+
4
+ live {
5
+ estate = "fixture-estate"
6
+ }
7
+ }
8
+
9
+ module "label" {
10
+ source = "cloudposse/label/null"
11
+ version = "0.25.0"
12
+ }
@@ -0,0 +1,12 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+
4
+ live {
5
+ estate = "fixture-estate"
6
+ }
7
+ }
8
+
9
+ module "vpc" {
10
+ source = "terraform-aws-modules/vpc/aws"
11
+ version = "5.0.0"
12
+ }
@@ -44,6 +44,8 @@ import { tf042 } from "./tf042";
44
44
  import { tf043 } from "./tf043";
45
45
  import { tf044 } from "./tf044";
46
46
  import { tf045 } from "./tf045";
47
+ import { tf046 } from "./tf046";
48
+ import { tf047 } from "./tf047";
47
49
 
48
50
  export const postSynthChecks: PostSynthCheck[] = [
49
51
  tf001,
@@ -90,4 +92,6 @@ export const postSynthChecks: PostSynthCheck[] = [
90
92
  tf043,
91
93
  tf044,
92
94
  tf045,
95
+ tf046,
96
+ tf047,
93
97
  ];
@@ -0,0 +1,122 @@
1
+ /**
2
+ * The record store a live root resolves to, read from its HCL the way
3
+ * choudoufu resolves it (INTENTIUS/choudoufu#2293, `internal/configs/live_derive.go`
4
+ * at choudoufu 74ffde956bfd97f44b8ad444424584e23321adc2). Shared by TF024,
5
+ * which names where records go, and TF046, which guards a CI root that ends
6
+ * up on the local store, so the two never disagree.
7
+ *
8
+ * The order is choudoufu's:
9
+ *
10
+ * 1. A `record_store "<kind>"` block in the `live` block or the
11
+ * `estate.chdf.hcl` sidecar always wins (`source: "record_store"`).
12
+ * 2. Otherwise the backend block choudoufu ignores under live gives the store,
13
+ * s3 to s3, gcs to gcs, azurerm to azurerm (`source: "backend"`). s3 and gcs
14
+ * need a literal `bucket`; azurerm needs literal `storage_account_name`,
15
+ * `container_name` and `resource_group_name`. A value passed only with
16
+ * `-backend-config` is not in the configuration, so choudoufu does not see
17
+ * it either.
18
+ * 3. Otherwise the store is local (`source: "implied"`), with `note` saying
19
+ * why a backend that was there was not used.
20
+ *
21
+ * This mirrors `record_store.source` and `record_store.note` in
22
+ * `choudoufu live-check -json`. A literal here is a string hcl2json hands back
23
+ * with no `${...}` in it, the same "not determined" reading the Terragrunt
24
+ * rules use (`./terragrunt.ts`).
25
+ */
26
+
27
+ import type { BlockBody } from "../../hcl/parse";
28
+ import { backendTypes } from "./tf001";
29
+ import { isExpression } from "./terragrunt";
30
+
31
+ export type RecordStoreSource = "record_store" | "backend" | "implied";
32
+
33
+ export interface ResolvedRecordStore {
34
+ /** `local`, `s3`, `gcs`, `azurerm` or `kubernetes`, or whatever label a `record_store` block carries. */
35
+ kind: string;
36
+ source: RecordStoreSource;
37
+ /** The backend type the store came from, or was not derived from, when there is a backend block. */
38
+ backend?: string;
39
+ /** Why a backend block that was present did not give a store. Set only with `source: "implied"`. */
40
+ note?: string;
41
+ }
42
+
43
+ /** Backend types choudoufu derives a record store from (INTENTIUS/choudoufu#2293). */
44
+ export const DERIVABLE_BACKENDS: ReadonlySet<string> = new Set(["s3", "gcs", "azurerm"]);
45
+
46
+ const asRecord = (v: unknown): BlockBody =>
47
+ typeof v === "object" && v !== null && !Array.isArray(v) ? (v as BlockBody) : {};
48
+
49
+ const firstBody = (v: unknown): BlockBody => asRecord(Array.isArray(v) ? v[0] : v);
50
+
51
+ /**
52
+ * The label of a `record_store "<kind>"` block in a live declaration body, or
53
+ * undefined when it declares none. hcl2json nests the label one level down,
54
+ * as it does for `backend` (see `backendTypes` in `./tf001.ts`).
55
+ */
56
+ export function recordStoreKind(liveBody: BlockBody): string | undefined {
57
+ const raw = liveBody["record_store"];
58
+ if (raw === undefined || raw === null) return undefined;
59
+ if (typeof raw !== "object" || Array.isArray(raw)) return undefined;
60
+ const labels = Object.keys(raw as BlockBody);
61
+ return labels[0];
62
+ }
63
+
64
+ /** A top-level backend argument as a literal string, or undefined when it is absent, empty or an expression. */
65
+ function literal(body: BlockBody, name: string): string | undefined {
66
+ const v = body[name];
67
+ if (typeof v !== "string" || v === "" || isExpression(v)) return undefined;
68
+ return v;
69
+ }
70
+
71
+ /**
72
+ * Why a backend block gives no record store, or undefined when it gives one.
73
+ * The wording follows choudoufu's `Live.RecordStoreNote`; an empty string
74
+ * means no store and nothing to say (a `local` backend).
75
+ */
76
+ function derivationNote(type: string, body: BlockBody): string | undefined {
77
+ const where = `backend "${type}"`;
78
+ switch (type) {
79
+ case "s3":
80
+ case "gcs":
81
+ return literal(body, "bucket") === undefined
82
+ ? `${where} sets no literal bucket; values passed with -backend-config are not read`
83
+ : undefined;
84
+ case "azurerm":
85
+ for (const name of ["storage_account_name", "container_name", "resource_group_name"]) {
86
+ if (literal(body, name) === undefined) return `${where} sets no literal ${name}, which the azurerm record store needs`;
87
+ }
88
+ return undefined;
89
+ case "local":
90
+ // choudoufu leaves no note here: a local backend and the local store agree.
91
+ return "";
92
+ default:
93
+ return `${where} has no record store counterpart`;
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Resolve one live root's record store.
99
+ *
100
+ * `terraformBodies` are the bodies of every `terraform` block in the root (a
101
+ * backend can sit in a separate `backend.tf`). `liveBodies` are the root's
102
+ * live declarations: its `live` block and its sidecar, if any. choudoufu
103
+ * refuses a root that has both, so the first `record_store` found is the one.
104
+ */
105
+ export function resolveRecordStore(
106
+ terraformBodies: readonly BlockBody[],
107
+ liveBodies: readonly BlockBody[],
108
+ ): ResolvedRecordStore {
109
+ for (const live of liveBodies) {
110
+ const kind = recordStoreKind(live);
111
+ if (kind !== undefined) return { kind, source: "record_store" };
112
+ }
113
+ for (const tf of terraformBodies) {
114
+ const type = backendTypes(tf)[0];
115
+ if (type === undefined) continue;
116
+ const body = firstBody(asRecord(tf["backend"])[type]);
117
+ const note = derivationNote(type, body);
118
+ if (note === undefined) return { kind: type, source: "backend", backend: type };
119
+ return { kind: "local", source: "implied", backend: type, ...(note ? { note } : {}) };
120
+ }
121
+ return { kind: "local", source: "implied" };
122
+ }
@@ -30,8 +30,8 @@
30
30
  * module's `terraform` block is skipped here rather than read as if it were
31
31
  * the root's.
32
32
  *
33
- * Does not fire on a live root (#2103): a `backend` block is exactly what
34
- * choudoufu refuses there (TF024's territory), and the fallback to local
33
+ * Does not fire on a live root (#2103): choudoufu ignores a `backend` block
34
+ * there (TF024 reports what it still does with it), and the fallback to local
35
35
  * state this check warns about does not apply, since a live root keeps no
36
36
  * state file at all, local or remote.
37
37
  */
@@ -13,18 +13,39 @@ async function ctxFor(fixture: string, root = "estate"): Promise<PostSynthContex
13
13
  }
14
14
 
15
15
  describe("TF024: live root declares a backend or cloud block", () => {
16
- test("flags a live root with a backend block", async () => {
16
+ test("reports a backend block as ignored, at info, with the store derived from it", async () => {
17
17
  const diags = tf024.check(await ctxFor("live-with-backend"));
18
18
  expect(diags).toHaveLength(1);
19
19
  expect(diags[0].checkId).toBe("TF024");
20
- expect(diags[0].message).toContain("backend");
21
- expect(diags[0].message).toContain("Both a backend and a live");
20
+ expect(diags[0].severity).toBe("info");
21
+ expect(diags[0].message).toContain('backend "s3"');
22
+ expect(diags[0].message).toContain("ignores it");
23
+ expect(diags[0].message).toContain("-migrate-state");
24
+ expect(diags[0].message).toContain("derives the record store");
25
+ expect(diags[0].message).not.toContain("refuses this at init");
22
26
  });
23
27
 
24
- test("flags a live root with a cloud block", async () => {
28
+ test("says an explicit record_store wins over the backend", async () => {
29
+ const diags = tf024.check(await ctxFor("live-with-record-store"));
30
+ expect(diags).toHaveLength(1);
31
+ expect(diags[0].severity).toBe("info");
32
+ expect(diags[0].message).toContain("record_store the live declaration names");
33
+ expect(diags[0].message).not.toContain("derives the record store");
34
+ });
35
+
36
+ test("keys on an estate.chdf.hcl sidecar as well as a live block", async () => {
37
+ const diags = tf024.check(await ctxFor("sidecar-with-backend"));
38
+ expect(diags).toHaveLength(1);
39
+ expect(diags[0].message).toContain('backend "gcs"');
40
+ expect(diags[0].message).toContain("derives the record store");
41
+ });
42
+
43
+ test("warns on a cloud block, which choudoufu drops entirely", async () => {
25
44
  const diags = tf024.check(await ctxFor("live-with-cloud"));
26
45
  expect(diags).toHaveLength(1);
27
- expect(diags[0].message).toContain("cloud");
46
+ expect(diags[0].severity).toBe("warning");
47
+ expect(diags[0].message).toContain("cloud block");
48
+ expect(diags[0].message).toContain("no record store is derived");
28
49
  });
29
50
 
30
51
  test("passes a live root with neither block", async () => {
@@ -1,18 +1,38 @@
1
1
  /**
2
2
  * TF024: a live root declares a `backend` or `cloud` block.
3
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.
4
+ * choudoufu used to refuse this pair at `init` (#1170). Since
5
+ * INTENTIUS/choudoufu#2213 it accepts both and ignores them with a warning
6
+ * (`internal/configs/module.go`, `ignoreStateStoreUnderLive`), because
7
+ * Terragrunt's `remote_state` and Atmos's `backend.tf.json` write a backend
8
+ * beside the live block on every run. What each block still does:
9
+ *
10
+ * - `backend "<type>"`: no state is read or written there, and
11
+ * `init -migrate-state` is refused. choudoufu keeps the block as
12
+ * `IgnoredBackend`: an apply publishes the estate's non-sensitive outputs
13
+ * to the location it names, so `terraform_remote_state` readers keep
14
+ * working, and when the live declaration has no `record_store` the record
15
+ * store is derived from the backend's bucket, s3 to s3, gcs to gcs, azurerm
16
+ * to azurerm (INTENTIUS/choudoufu#2293), when the bucket is a literal in
17
+ * the configuration. An explicit `record_store` always wins. The resolution
18
+ * is shared with TF046 in `./record-store.ts`.
19
+ * - `cloud {}`: dropped entirely. Nothing is published to it and no store is
20
+ * derived from it.
21
+ *
22
+ * So the backend case is reported as `info` (the block is doing a job the
23
+ * author may want, and is the derivation source the maintainer ruled for),
24
+ * and the cloud case as `warning` (the block does nothing at all). Neither
25
+ * fails a build at default severity. The guard against a CI root that ends
26
+ * up on the local store is TF046 (chant#4561).
27
+ *
28
+ * The live marker is the root's `mode`, stamped from either a `live` block or
29
+ * an `estate.chdf.hcl` sidecar (`hcl/parse.ts`), so a sidecar estate is
30
+ * covered. A `record_store` is read from whichever `Terraform::Live` entity
31
+ * carries it: the `live` block, or the sidecar's top level.
11
32
  *
12
33
  * 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.
34
+ * configured); it does not fire on a live root. A root is flagged by at most
35
+ * one of them.
16
36
  *
17
37
  * Scope: root modules only (#2112). A child module's backend or cloud block
18
38
  * is TF015's finding, whatever binary the root runs.
@@ -26,17 +46,74 @@ import type {
26
46
  PostSynthDiagnostic,
27
47
  } from "@intentius/chant/lint/post-synth";
28
48
  import { isResourceDeclarable } from "@intentius/chant/declarable";
29
- import { TERRAFORM_TYPE, type BlockBody } from "../../hcl/parse";
30
- import { hasBlock } from "./tf001";
49
+ import { LIVE_TYPE, TERRAFORM_TYPE, type BlockBody } from "../../hcl/parse";
50
+ import { backendTypes, hasBlock } from "./tf001";
31
51
  import { isRootScoped } from "./scope";
52
+ import { DERIVABLE_BACKENDS, resolveRecordStore, type ResolvedRecordStore } from "./record-store";
53
+
54
+ export { DERIVABLE_BACKENDS } from "./record-store";
55
+
56
+ const bodyOf = (props: { body?: unknown }): BlockBody =>
57
+ (typeof props.body === "object" && props.body !== null ? props.body : {}) as BlockBody;
58
+
59
+ /** Each root's live declarations (its `live` block and its sidecar), keyed by root. */
60
+ export function liveBodiesByRoot(ctx: PostSynthContext): Map<string, BlockBody[]> {
61
+ const roots = new Map<string, BlockBody[]>();
62
+ for (const entity of ctx.entities.values()) {
63
+ if (entity.entityType !== LIVE_TYPE) continue;
64
+ if (!isResourceDeclarable(entity) || !isRootScoped(entity)) continue;
65
+ const props = entity.props as { root?: unknown; body?: unknown };
66
+ const root = typeof props.root === "string" ? props.root : "";
67
+ const list = roots.get(root) ?? [];
68
+ list.push(bodyOf(props));
69
+ roots.set(root, list);
70
+ }
71
+ return roots;
72
+ }
73
+
74
+ function backendMessage(root: string, type: string, store: ResolvedRecordStore): string {
75
+ const label = type ? `backend "${type}"` : "backend";
76
+ const head =
77
+ `Root module "${root}" runs choudoufu with a declared estate and also declares a ${label} block. ` +
78
+ "choudoufu ignores it with a warning: no state is read or written there and `init -migrate-state` " +
79
+ "is refused. An apply publishes the estate's non-sensitive outputs to the location it names, so " +
80
+ "terraform_remote_state readers keep working.";
81
+ if (store.source === "record_store") {
82
+ return `${head} Records go to the record_store the live declaration names, which wins over the backend.`;
83
+ }
84
+ if (store.source === "backend") {
85
+ return (
86
+ `${head} With no record_store declared, choudoufu derives the record store from this backend's ` +
87
+ "bucket and prints it on every init and plan (INTENTIUS/choudoufu#2293). Declare record_store to " +
88
+ "put records somewhere else."
89
+ );
90
+ }
91
+ const why = DERIVABLE_BACKENDS.has(type) && store.note
92
+ ? `No record store is derived from it: ${store.note}.`
93
+ : `No record store is derived from a ${type ? `"${type}"` : "backend of unknown type"} (only s3, gcs and azurerm are).`;
94
+ return (
95
+ `${head} ${why} No record_store is declared, so records stay in the local ` +
96
+ "store. Declare record_store if more than one machine runs this root (TF046 guards this in CI)."
97
+ );
98
+ }
99
+
100
+ function cloudMessage(root: string): string {
101
+ return (
102
+ `Root module "${root}" runs choudoufu with a declared estate and also declares a cloud block. ` +
103
+ "choudoufu ignores it entirely: no state is read or written there, no outputs are published to it, " +
104
+ "and no record store is derived from it. Remove it, or use a backend block if " +
105
+ "terraform_remote_state readers need this estate's outputs."
106
+ );
107
+ }
32
108
 
33
109
  export const tf024: PostSynthCheck = {
34
110
  id: "TF024",
35
- description: "Live root declares a backend or cloud block, which choudoufu refuses",
111
+ description: "Live root declares a backend or cloud block, which choudoufu ignores",
36
112
 
37
113
  check(ctx: PostSynthContext): PostSynthDiagnostic[] {
38
114
  const diagnostics: PostSynthDiagnostic[] = [];
39
115
  const flagged = new Set<string>();
116
+ let liveBodies: Map<string, BlockBody[]> | undefined;
40
117
 
41
118
  for (const [name, entity] of ctx.entities) {
42
119
  if (entity.entityType !== TERRAFORM_TYPE) continue;
@@ -46,20 +123,26 @@ export const tf024: PostSynthCheck = {
46
123
  const root = typeof props.root === "string" ? props.root : "";
47
124
  if (flagged.has(root)) continue;
48
125
 
49
- const body = (typeof props.body === "object" && props.body !== null ? props.body : {}) as BlockBody;
50
- const hasBackend = hasBlock(body, "backend");
126
+ const body = bodyOf(props);
51
127
  const hasCloud = hasBlock(body, "cloud");
128
+ const hasBackend = hasBlock(body, "backend");
52
129
  if (!hasBackend && !hasCloud) continue;
53
-
54
130
  flagged.add(root);
55
- const blockKind = hasBackend ? "backend" : "cloud";
131
+
132
+ // A cloud block does nothing at all, so it is the one worth a warning
133
+ // when a (malformed) root somehow carries both.
134
+ if (hasCloud) {
135
+ diagnostics.push({ checkId: "TF024", severity: "warning", message: cloudMessage(root), entity: name, lexicon: "terraform" });
136
+ continue;
137
+ }
138
+
139
+ liveBodies ??= liveBodiesByRoot(ctx);
140
+ const type = backendTypes(body)[0] ?? "";
141
+ const store = resolveRecordStore([body], liveBodies.get(root) ?? []);
56
142
  diagnostics.push({
57
143
  checkId: "TF024",
58
- severity: "error",
59
- message:
60
- `Root module "${root}" runs choudoufu with a declared estate and also declares a ` +
61
- `${blockKind} block. choudoufu refuses this at init: "Both a ${blockKind} and a live ` +
62
- `configuration are present." Remove the ${blockKind} block; a live root keeps no state to store.`,
144
+ severity: "info",
145
+ message: backendMessage(root, type, store),
63
146
  entity: name,
64
147
  lexicon: "terraform",
65
148
  });