@intentius/chant-lexicon-terraform 0.101.0 → 0.104.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 (374) hide show
  1. package/dist/__fixtures__/terragrunt/affected-cases.d.ts +23 -0
  2. package/dist/__fixtures__/terragrunt/affected-cases.d.ts.map +1 -0
  3. package/dist/__fixtures__/terragrunt/record.d.ts +17 -0
  4. package/dist/__fixtures__/terragrunt/record.d.ts.map +1 -0
  5. package/dist/change-set.d.ts +67 -0
  6. package/dist/change-set.d.ts.map +1 -0
  7. package/dist/changed-roots.d.ts +30 -0
  8. package/dist/changed-roots.d.ts.map +1 -0
  9. package/dist/codegen/package.d.ts +1 -1
  10. package/dist/commands.d.ts +26 -0
  11. package/dist/commands.d.ts.map +1 -0
  12. package/dist/components/capability-plugin.d.ts +54 -0
  13. package/dist/components/capability-plugin.d.ts.map +1 -0
  14. package/dist/composites/terraform-pin-rollout-op.d.ts +44 -0
  15. package/dist/composites/terraform-pin-rollout-op.d.ts.map +1 -0
  16. package/dist/config.d.ts +3 -3
  17. package/dist/hcl/descend.d.ts +1 -1
  18. package/dist/hcl/descend.d.ts.map +1 -1
  19. package/dist/hcl/edges.d.ts +2 -2
  20. package/dist/hcl/edges.d.ts.map +1 -1
  21. package/dist/hcl/jsonencode.d.ts +106 -0
  22. package/dist/hcl/jsonencode.d.ts.map +1 -0
  23. package/dist/hcl/marker.d.ts.map +1 -1
  24. package/dist/hcl/parse.d.ts +29 -1
  25. package/dist/hcl/parse.d.ts.map +1 -1
  26. package/dist/hcl/roots.d.ts +1 -1
  27. package/dist/hcl/roots.d.ts.map +1 -1
  28. package/dist/hcl/suppressions.d.ts.map +1 -1
  29. package/dist/index.d.ts +4 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/integrity.json +22 -4
  32. package/dist/lint/audit-catalog.d.ts.map +1 -1
  33. package/dist/lint/audit-lineage.d.ts +1 -1
  34. package/dist/lint/audit-lineage.d.ts.map +1 -1
  35. package/dist/lint/post-synth/flat-attributes.d.ts +69 -0
  36. package/dist/lint/post-synth/flat-attributes.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 +27 -1
  39. package/dist/lint/post-synth/module-source.d.ts.map +1 -1
  40. package/dist/lint/post-synth/terragrunt.d.ts +37 -0
  41. package/dist/lint/post-synth/terragrunt.d.ts.map +1 -0
  42. package/dist/lint/post-synth/tf002.d.ts +3 -1
  43. package/dist/lint/post-synth/tf002.d.ts.map +1 -1
  44. package/dist/lint/post-synth/tf030.d.ts +51 -0
  45. package/dist/lint/post-synth/tf030.d.ts.map +1 -0
  46. package/dist/lint/post-synth/tf031.d.ts +55 -0
  47. package/dist/lint/post-synth/tf031.d.ts.map +1 -0
  48. package/dist/lint/post-synth/tf032.d.ts +71 -0
  49. package/dist/lint/post-synth/tf032.d.ts.map +1 -0
  50. package/dist/lint/post-synth/tf033.d.ts +50 -0
  51. package/dist/lint/post-synth/tf033.d.ts.map +1 -0
  52. package/dist/lint/post-synth/tf034.d.ts +25 -0
  53. package/dist/lint/post-synth/tf034.d.ts.map +1 -0
  54. package/dist/lint/post-synth/tf035.d.ts +33 -0
  55. package/dist/lint/post-synth/tf035.d.ts.map +1 -0
  56. package/dist/lint/post-synth/tf036.d.ts +33 -0
  57. package/dist/lint/post-synth/tf036.d.ts.map +1 -0
  58. package/dist/lint/post-synth/tf037.d.ts +31 -0
  59. package/dist/lint/post-synth/tf037.d.ts.map +1 -0
  60. package/dist/lint/post-synth/tf038.d.ts +22 -0
  61. package/dist/lint/post-synth/tf038.d.ts.map +1 -0
  62. package/dist/lint/post-synth/tf039.d.ts +23 -0
  63. package/dist/lint/post-synth/tf039.d.ts.map +1 -0
  64. package/dist/lint/post-synth/tf040.d.ts +30 -0
  65. package/dist/lint/post-synth/tf040.d.ts.map +1 -0
  66. package/dist/lint/post-synth/tf041.d.ts +20 -0
  67. package/dist/lint/post-synth/tf041.d.ts.map +1 -0
  68. package/dist/lint/post-synth/tf042.d.ts +18 -0
  69. package/dist/lint/post-synth/tf042.d.ts.map +1 -0
  70. package/dist/lint/post-synth/tf043.d.ts +17 -0
  71. package/dist/lint/post-synth/tf043.d.ts.map +1 -0
  72. package/dist/lint/post-synth/tf044.d.ts +17 -0
  73. package/dist/lint/post-synth/tf044.d.ts.map +1 -0
  74. package/dist/lint/post-synth/tf045.d.ts +22 -0
  75. package/dist/lint/post-synth/tf045.d.ts.map +1 -0
  76. package/dist/manifest.json +1 -1
  77. package/dist/okf/index.md +16 -0
  78. package/dist/okf/rules/TF030.md +11 -0
  79. package/dist/okf/rules/TF031.md +11 -0
  80. package/dist/okf/rules/TF032.md +11 -0
  81. package/dist/okf/rules/TF033.md +11 -0
  82. package/dist/okf/rules/TF034.md +11 -0
  83. package/dist/okf/rules/TF035.md +11 -0
  84. package/dist/okf/rules/TF036.md +11 -0
  85. package/dist/okf/rules/TF037.md +11 -0
  86. package/dist/okf/rules/TF038.md +11 -0
  87. package/dist/okf/rules/TF039.md +11 -0
  88. package/dist/okf/rules/TF040.md +11 -0
  89. package/dist/okf/rules/TF041.md +11 -0
  90. package/dist/okf/rules/TF042.md +11 -0
  91. package/dist/okf/rules/TF043.md +11 -0
  92. package/dist/okf/rules/TF044.md +11 -0
  93. package/dist/okf/rules/TF045.md +11 -0
  94. package/dist/op/activities/index.d.ts +4 -0
  95. package/dist/op/activities/index.d.ts.map +1 -1
  96. package/dist/op/activities/pin-rollout.d.ts +46 -0
  97. package/dist/op/activities/pin-rollout.d.ts.map +1 -0
  98. package/dist/op/activities/terraform.d.ts +24 -50
  99. package/dist/op/activities/terraform.d.ts.map +1 -1
  100. package/dist/op/activity-contracts.d.ts +66 -18
  101. package/dist/op/activity-contracts.d.ts.map +1 -1
  102. package/dist/op/builders.d.ts +9 -0
  103. package/dist/op/builders.d.ts.map +1 -1
  104. package/dist/pin/edit-ts.d.ts +21 -0
  105. package/dist/pin/edit-ts.d.ts.map +1 -0
  106. package/dist/pin/edit.d.ts +52 -0
  107. package/dist/pin/edit.d.ts.map +1 -0
  108. package/dist/pin/forge.d.ts +39 -0
  109. package/dist/pin/forge.d.ts.map +1 -0
  110. package/dist/pin/index.d.ts +22 -0
  111. package/dist/pin/index.d.ts.map +1 -0
  112. package/dist/pin/rollout.d.ts +116 -0
  113. package/dist/pin/rollout.d.ts.map +1 -0
  114. package/dist/pin/scan.d.ts +54 -0
  115. package/dist/pin/scan.d.ts.map +1 -0
  116. package/dist/pin/source.d.ts +93 -0
  117. package/dist/pin/source.d.ts.map +1 -0
  118. package/dist/pin/waves.d.ts +66 -0
  119. package/dist/pin/waves.d.ts.map +1 -0
  120. package/dist/plan-digest.d.ts +59 -0
  121. package/dist/plan-digest.d.ts.map +1 -0
  122. package/dist/plugin.d.ts.map +1 -1
  123. package/dist/rules/flat-attributes.ts +146 -0
  124. package/dist/rules/module-source.ts +56 -1
  125. package/dist/rules/terragrunt.ts +76 -0
  126. package/dist/rules/tf002.ts +1 -1
  127. package/dist/rules/tf030.ts +290 -0
  128. package/dist/rules/tf031.ts +370 -0
  129. package/dist/rules/tf032.ts +226 -0
  130. package/dist/rules/tf033.ts +160 -0
  131. package/dist/rules/tf034.ts +63 -0
  132. package/dist/rules/tf035.ts +74 -0
  133. package/dist/rules/tf036.ts +119 -0
  134. package/dist/rules/tf037.ts +101 -0
  135. package/dist/rules/tf038.ts +71 -0
  136. package/dist/rules/tf039.ts +64 -0
  137. package/dist/rules/tf040.ts +76 -0
  138. package/dist/rules/tf041.ts +56 -0
  139. package/dist/rules/tf042.ts +42 -0
  140. package/dist/rules/tf043.ts +49 -0
  141. package/dist/rules/tf044.ts +51 -0
  142. package/dist/rules/tf045.ts +47 -0
  143. package/dist/terragrunt/affected.d.ts +119 -0
  144. package/dist/terragrunt/affected.d.ts.map +1 -0
  145. package/dist/terragrunt/index.d.ts +11 -0
  146. package/dist/terragrunt/index.d.ts.map +1 -0
  147. package/dist/terragrunt/mocks.d.ts +147 -0
  148. package/dist/terragrunt/mocks.d.ts.map +1 -0
  149. package/dist/terragrunt/run.d.ts +130 -0
  150. package/dist/terragrunt/run.d.ts.map +1 -0
  151. package/dist/terragrunt/units.d.ts +103 -0
  152. package/dist/terragrunt/units.d.ts.map +1 -0
  153. package/dist/terragrunt/wave.d.ts +89 -0
  154. package/dist/terragrunt/wave.d.ts.map +1 -0
  155. package/package.json +13 -3
  156. package/src/__fixtures__/change-set/choudoufu-set-plan.change-set.golden.json +95 -0
  157. package/src/__fixtures__/change-set/choudoufu-set-plan.json +76 -0
  158. package/src/__fixtures__/change-set/choudoufu.part.golden.json +173 -0
  159. package/src/__fixtures__/change-set/choudoufu.plan.json +610 -0
  160. package/src/__fixtures__/change-set/terraform.import-forget.plan.json +81 -0
  161. package/src/__fixtures__/change-set/terraform.part.golden.json +173 -0
  162. package/src/__fixtures__/change-set/terraform.plan.json +589 -0
  163. package/src/__fixtures__/change-set/tofu.part.golden.json +173 -0
  164. package/src/__fixtures__/change-set/tofu.plan.json +588 -0
  165. package/src/__fixtures__/change-set/v1.tf.txt +21 -0
  166. package/src/__fixtures__/change-set/v2-module-app.tf.txt +4 -0
  167. package/src/__fixtures__/change-set/v2.tf.txt +21 -0
  168. package/src/__fixtures__/pin/choudoufu-live-waves-n5.json +83 -0
  169. package/src/__fixtures__/pin/largeset-oci-n5/apply-order.txt +5 -0
  170. package/src/__fixtures__/pin/largeset-oci-n5/estates/e01/estate.chdf.hcl +6 -0
  171. package/src/__fixtures__/pin/largeset-oci-n5/estates/e01/main.tf +33 -0
  172. package/src/__fixtures__/pin/largeset-oci-n5/estates/e02/estate.chdf.hcl +6 -0
  173. package/src/__fixtures__/pin/largeset-oci-n5/estates/e02/main.tf +45 -0
  174. package/src/__fixtures__/pin/largeset-oci-n5/estates/e03/estate.chdf.hcl +6 -0
  175. package/src/__fixtures__/pin/largeset-oci-n5/estates/e03/main.tf +47 -0
  176. package/src/__fixtures__/pin/largeset-oci-n5/estates/e04/estate.chdf.hcl +6 -0
  177. package/src/__fixtures__/pin/largeset-oci-n5/estates/e04/main.tf +31 -0
  178. package/src/__fixtures__/pin/largeset-oci-n5/estates/e05/estate.chdf.hcl +6 -0
  179. package/src/__fixtures__/pin/largeset-oci-n5/estates/e05/main.tf +27 -0
  180. package/src/__fixtures__/pin/largeset-oci-n5/fixture.json +77 -0
  181. package/src/__fixtures__/plan-summary/largeset-n5-bump.json +2071 -0
  182. package/src/__fixtures__/plan-summary/largeset-n5.summary.golden.json +95 -0
  183. package/src/__fixtures__/plan-summary/largeset-n5.summary.golden.md +22 -0
  184. package/src/__fixtures__/plan-summary/largeset-n5.summary.golden.txt +12 -0
  185. package/src/__fixtures__/terragrunt/affected/catalog/units/web/terragrunt.hcl +3 -0
  186. package/src/__fixtures__/terragrunt/affected/gitignore +3 -0
  187. package/src/__fixtures__/terragrunt/affected/live/dev/app/terragrunt.hcl +3 -0
  188. package/src/__fixtures__/terragrunt/affected/live/dev/vpc/terragrunt.hcl +3 -0
  189. package/src/__fixtures__/terragrunt/affected/live/prod/app/terragrunt.hcl +3 -0
  190. package/src/__fixtures__/terragrunt/affected/live/stg/terragrunt.stack.hcl +5 -0
  191. package/src/__fixtures__/terragrunt/affected/modules/app/main.tf +6 -0
  192. package/src/__fixtures__/terragrunt/affected/modules/app/policy.json +1 -0
  193. package/src/__fixtures__/terragrunt/affected/modules/net/main.tf +2 -0
  194. package/src/__fixtures__/terragrunt/affected/modules/thing/main.tf +3 -0
  195. package/src/__fixtures__/terragrunt/affected/root.hcl +5 -0
  196. package/src/__fixtures__/terragrunt/affected-cases.ts +126 -0
  197. package/src/__fixtures__/terragrunt/five-units/catalog/units/thing/terragrunt.hcl +3 -0
  198. package/src/__fixtures__/terragrunt/five-units/live/dev/app/terragrunt.hcl +13 -0
  199. package/src/__fixtures__/terragrunt/five-units/live/dev/db/terragrunt.hcl +8 -0
  200. package/src/__fixtures__/terragrunt/five-units/live/dev/vpc/terragrunt.hcl +3 -0
  201. package/src/__fixtures__/terragrunt/five-units/live/prod/app/terragrunt.hcl +8 -0
  202. package/src/__fixtures__/terragrunt/five-units/live/prod/vpc/terragrunt.hcl +3 -0
  203. package/src/__fixtures__/terragrunt/five-units/modules/thing/main.tf +7 -0
  204. package/src/__fixtures__/terragrunt/five-units/root.hcl +5 -0
  205. package/src/__fixtures__/terragrunt/record.ts +56 -0
  206. package/src/__fixtures__/terragrunt/recorded/affected-find.json +50 -0
  207. package/src/__fixtures__/terragrunt/recorded/failed-plan-report.json +36 -0
  208. package/src/__fixtures__/terragrunt/recorded/find.json +67 -0
  209. package/src/__fixtures__/terragrunt/recorded/version.txt +1 -0
  210. package/src/__fixtures__/terragrunt/recorded/wave-1/apply-report.json +22 -0
  211. package/src/__fixtures__/terragrunt/recorded/wave-1/json/live/dev/vpc/tfplan.json +1 -0
  212. package/src/__fixtures__/terragrunt/recorded/wave-1/json/live/prod/vpc/tfplan.json +1 -0
  213. package/src/__fixtures__/terragrunt/recorded/wave-1/plan-report.json +22 -0
  214. package/src/__fixtures__/terragrunt/recorded/wave-2/json/live/dev/db/tfplan.json +1 -0
  215. package/src/__fixtures__/terragrunt/recorded/wave-2/json/live/prod/app/tfplan.json +1 -0
  216. package/src/__fixtures__/terragrunt/recorded/wave-2/plan-report.json +22 -0
  217. package/src/change-set-combined-run.test.ts +156 -0
  218. package/src/change-set.test.ts +151 -0
  219. package/src/change-set.ts +273 -0
  220. package/src/changed-roots.test.ts +58 -0
  221. package/src/changed-roots.ts +102 -0
  222. package/src/commands.ts +112 -0
  223. package/src/components/capability-plugin.test.ts +91 -0
  224. package/src/components/capability-plugin.ts +131 -0
  225. package/src/components/pr-loop.tofu.test.ts +244 -0
  226. package/src/composites/terraform-pin-rollout-op.test.ts +69 -0
  227. package/src/composites/terraform-pin-rollout-op.ts +60 -0
  228. package/src/hcl/descend.ts +1 -1
  229. package/src/hcl/edges.ts +2 -2
  230. package/src/hcl/jsonencode.test.ts +226 -0
  231. package/src/hcl/jsonencode.ts +454 -0
  232. package/src/hcl/parse.test.ts +25 -0
  233. package/src/hcl/parse.ts +91 -6
  234. package/src/hcl/roots.ts +1 -1
  235. package/src/hcl/suppressions.ts +8 -2
  236. package/src/index.ts +18 -0
  237. package/src/lint/audit-catalog.ts +230 -0
  238. package/src/lint/audit-lineage.ts +155 -1
  239. package/src/lint/audit.test.ts +3 -1
  240. package/src/lint/post-synth/estate-2284.test.ts +68 -0
  241. package/src/lint/post-synth/fixtures/TF030/negative-rules.tf +45 -0
  242. package/src/lint/post-synth/fixtures/TF030/negative.tf +55 -0
  243. package/src/lint/post-synth/fixtures/TF030/not-determined-port.tf +28 -0
  244. package/src/lint/post-synth/fixtures/TF030/not-determined-standalone.tf +32 -0
  245. package/src/lint/post-synth/fixtures/TF030/not-determined-vpc-rule.tf +21 -0
  246. package/src/lint/post-synth/fixtures/TF030/not-determined.tf +39 -0
  247. package/src/lint/post-synth/fixtures/TF030/positive-ipv6.tf +44 -0
  248. package/src/lint/post-synth/fixtures/TF030/positive-mixed.tf +36 -0
  249. package/src/lint/post-synth/fixtures/TF030/positive-standalone.tf +25 -0
  250. package/src/lint/post-synth/fixtures/TF030/positive.tf +43 -0
  251. package/src/lint/post-synth/fixtures/TF031/negative.tf +89 -0
  252. package/src/lint/post-synth/fixtures/TF031/not-determined.tf +139 -0
  253. package/src/lint/post-synth/fixtures/TF031/positive-data-source.tf +57 -0
  254. package/src/lint/post-synth/fixtures/TF031/positive-heredoc.tf +149 -0
  255. package/src/lint/post-synth/fixtures/TF031/positive-jsonencode.tf +115 -0
  256. package/src/lint/post-synth/fixtures/TF032/negative-heredoc.tf +20 -0
  257. package/src/lint/post-synth/fixtures/TF032/negative-references.tf +214 -0
  258. package/src/lint/post-synth/fixtures/TF032/negative.tf +99 -0
  259. package/src/lint/post-synth/fixtures/TF032/positive-heredoc.tf +22 -0
  260. package/src/lint/post-synth/fixtures/TF032/positive-sidecar.tf +197 -0
  261. package/src/lint/post-synth/fixtures/TF032/positive.tf +54 -0
  262. package/src/lint/post-synth/fixtures/TF033/negative.tf +39 -0
  263. package/src/lint/post-synth/fixtures/TF033/not-determined-aurora.tf +25 -0
  264. package/src/lint/post-synth/fixtures/TF033/positive-absent.tf +93 -0
  265. package/src/lint/post-synth/fixtures/TF033/positive.tf +50 -0
  266. package/src/lint/post-synth/fixtures/TF034/negative.tf +24 -0
  267. package/src/lint/post-synth/fixtures/TF034/positive-absent.tf +36 -0
  268. package/src/lint/post-synth/fixtures/TF034/positive.tf +14 -0
  269. package/src/lint/post-synth/fixtures/TF035/negative-absent.tf +43 -0
  270. package/src/lint/post-synth/fixtures/TF035/negative.tf +54 -0
  271. package/src/lint/post-synth/fixtures/TF035/positive.tf +37 -0
  272. package/src/lint/post-synth/fixtures/TF036/negative.tf +61 -0
  273. package/src/lint/post-synth/fixtures/TF036/not-determined.tf +28 -0
  274. package/src/lint/post-synth/fixtures/TF036/positive.tf +38 -0
  275. package/src/lint/post-synth/fixtures/TF037/negative-exclusion.tf +63 -0
  276. package/src/lint/post-synth/fixtures/TF037/negative.tf +27 -0
  277. package/src/lint/post-synth/fixtures/TF037/not-determined.tf +27 -0
  278. package/src/lint/post-synth/fixtures/TF037/positive-absent.tf +15 -0
  279. package/src/lint/post-synth/fixtures/TF037/positive.tf +26 -0
  280. package/src/lint/post-synth/fixtures/TF038/positive.tf +3 -0
  281. package/src/lint/post-synth/fixtures/TF039/positive.tf +4 -0
  282. package/src/lint/post-synth/fixtures/TF041/negative/terragrunt.hcl +12 -0
  283. package/src/lint/post-synth/fixtures/TF041/positive/terragrunt.hcl +7 -0
  284. package/src/lint/post-synth/fixtures/TF041/positive-apply/terragrunt.hcl +8 -0
  285. package/src/lint/post-synth/fixtures/TF042/negative/terragrunt.hcl +13 -0
  286. package/src/lint/post-synth/fixtures/TF042/positive/terragrunt.hcl +9 -0
  287. package/src/lint/post-synth/fixtures/TF043/negative/terragrunt.hcl +3 -0
  288. package/src/lint/post-synth/fixtures/TF043/negative-other/terragrunt.hcl +3 -0
  289. package/src/lint/post-synth/fixtures/TF043/positive-git/terragrunt.hcl +3 -0
  290. package/src/lint/post-synth/fixtures/TF043/positive-oci/terragrunt.hcl +3 -0
  291. package/src/lint/post-synth/fixtures/TF043/positive-tfr/terragrunt.hcl +3 -0
  292. package/src/lint/post-synth/fixtures/TF044/negative/terragrunt.hcl +9 -0
  293. package/src/lint/post-synth/fixtures/TF044/positive/terragrunt.hcl +7 -0
  294. package/src/lint/post-synth/fixtures/TF044/positive-generate/terragrunt.hcl +9 -0
  295. package/src/lint/post-synth/fixtures/TF045/negative/root.hcl +1 -0
  296. package/src/lint/post-synth/fixtures/TF045/negative/terragrunt.hcl +3 -0
  297. package/src/lint/post-synth/fixtures/TF045/positive/root.hcl +9 -0
  298. package/src/lint/post-synth/fixtures/TF045/positive/terragrunt.hcl +3 -0
  299. package/src/lint/post-synth/fixtures/TF045/unit-only/terragrunt.hcl +3 -0
  300. package/src/lint/post-synth/fixtures/estate-2284/clean/main.tf +132 -0
  301. package/src/lint/post-synth/fixtures/estate-2284/violating/main.tf +112 -0
  302. package/src/lint/post-synth/flat-attributes.ts +146 -0
  303. package/src/lint/post-synth/index.ts +32 -0
  304. package/src/lint/post-synth/module-source.test.ts +42 -1
  305. package/src/lint/post-synth/module-source.ts +56 -1
  306. package/src/lint/post-synth/terragrunt.ts +76 -0
  307. package/src/lint/post-synth/tf002.ts +1 -1
  308. package/src/lint/post-synth/tf030.test.ts +219 -0
  309. package/src/lint/post-synth/tf030.ts +290 -0
  310. package/src/lint/post-synth/tf031.test.ts +229 -0
  311. package/src/lint/post-synth/tf031.ts +370 -0
  312. package/src/lint/post-synth/tf032.test.ts +127 -0
  313. package/src/lint/post-synth/tf032.ts +226 -0
  314. package/src/lint/post-synth/tf033.test.ts +126 -0
  315. package/src/lint/post-synth/tf033.ts +160 -0
  316. package/src/lint/post-synth/tf034.test.ts +71 -0
  317. package/src/lint/post-synth/tf034.ts +63 -0
  318. package/src/lint/post-synth/tf035.test.ts +68 -0
  319. package/src/lint/post-synth/tf035.ts +74 -0
  320. package/src/lint/post-synth/tf036.test.ts +87 -0
  321. package/src/lint/post-synth/tf036.ts +119 -0
  322. package/src/lint/post-synth/tf037.test.ts +88 -0
  323. package/src/lint/post-synth/tf037.ts +101 -0
  324. package/src/lint/post-synth/tf038.test.ts +51 -0
  325. package/src/lint/post-synth/tf038.ts +71 -0
  326. package/src/lint/post-synth/tf039.test.ts +40 -0
  327. package/src/lint/post-synth/tf039.ts +64 -0
  328. package/src/lint/post-synth/tf040.test.ts +55 -0
  329. package/src/lint/post-synth/tf040.ts +76 -0
  330. package/src/lint/post-synth/tf041.test.ts +50 -0
  331. package/src/lint/post-synth/tf041.ts +56 -0
  332. package/src/lint/post-synth/tf042.test.ts +19 -0
  333. package/src/lint/post-synth/tf042.ts +42 -0
  334. package/src/lint/post-synth/tf043.test.ts +65 -0
  335. package/src/lint/post-synth/tf043.ts +49 -0
  336. package/src/lint/post-synth/tf044.test.ts +27 -0
  337. package/src/lint/post-synth/tf044.ts +51 -0
  338. package/src/lint/post-synth/tf045.test.ts +30 -0
  339. package/src/lint/post-synth/tf045.ts +47 -0
  340. package/src/op/activities/index.ts +4 -0
  341. package/src/op/activities/pin-rollout.ts +77 -0
  342. package/src/op/activities/terraform.test.ts +13 -0
  343. package/src/op/activities/terraform.ts +46 -86
  344. package/src/op/activity-contracts.test.ts +4 -1
  345. package/src/op/activity-contracts.ts +42 -0
  346. package/src/op/builders.ts +13 -0
  347. package/src/pin/bundle.test.ts +53 -0
  348. package/src/pin/edit-ts.test.ts +39 -0
  349. package/src/pin/edit-ts.ts +77 -0
  350. package/src/pin/edit.test.ts +199 -0
  351. package/src/pin/edit.ts +157 -0
  352. package/src/pin/forge.ts +85 -0
  353. package/src/pin/index.ts +22 -0
  354. package/src/pin/rollout.test.ts +232 -0
  355. package/src/pin/rollout.ts +451 -0
  356. package/src/pin/scan.ts +309 -0
  357. package/src/pin/source.ts +206 -0
  358. package/src/pin/waves.test.ts +101 -0
  359. package/src/pin/waves.ts +125 -0
  360. package/src/plan-digest.ts +99 -0
  361. package/src/plan-summary.test.ts +154 -0
  362. package/src/plugin.ts +25 -2
  363. package/src/terragrunt/affected.acceptance.test.ts +83 -0
  364. package/src/terragrunt/affected.test.ts +177 -0
  365. package/src/terragrunt/affected.ts +348 -0
  366. package/src/terragrunt/index.ts +11 -0
  367. package/src/terragrunt/mocks.acceptance.test.ts +105 -0
  368. package/src/terragrunt/mocks.test.ts +309 -0
  369. package/src/terragrunt/mocks.ts +324 -0
  370. package/src/terragrunt/run.ts +369 -0
  371. package/src/terragrunt/terragrunt.acceptance.test.ts +122 -0
  372. package/src/terragrunt/terragrunt.test.ts +332 -0
  373. package/src/terragrunt/units.ts +235 -0
  374. package/src/terragrunt/wave.ts +181 -0
@@ -0,0 +1,149 @@
1
+ # Vendored for TF031 (chant #2286), unmodified below this header.
2
+ # Source: https://github.com/terraform-community-modules/tf_aws_ecs/blob/4a41e9c5acf4b71893bcb1ab3856c7c630f283d6/iam.tf
3
+ # Repository: terraform-community-modules/tf_aws_ecs, path iam.tf, commit 4a41e9c5acf4b71893bcb1ab3856c7c630f283d6
4
+ # Licence: MIT
5
+ #
6
+ # A heredoc with no interpolation is a literal string in the parse, so TF031
7
+ # reads it as JSON: aws_iam_policy.ecs_policy (Resource "*") fires, and so does
8
+ # data.aws_iam_policy_document.consul_task_policy. aws_iam_policy.custom_ecs_policy
9
+ # is "${var.custom_iam_policy}" and is reported as not determined.
10
+ #
11
+ # Copyright (c) 2016 Tim Hartmann
12
+ #
13
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ # of this software and associated documentation files (the "Software"), to deal
15
+ # in the Software without restriction, including without limitation the rights
16
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ # copies of the Software, and to permit persons to whom the Software is
18
+ # furnished to do so, subject to the following conditions:
19
+ #
20
+ # The above copyright notice and this permission notice shall be included in all
21
+ # copies or substantial portions of the Software.
22
+ #
23
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ # SOFTWARE.
30
+
31
+ resource "aws_iam_instance_profile" "ecs_profile" {
32
+ name_prefix = "${replace(format("%.102s", replace("tf-ECSProfile-${var.name}-", "_", "-")), "/\\s/", "-")}"
33
+ role = "${aws_iam_role.ecs_role.name}"
34
+ path = "${var.iam_path}"
35
+ }
36
+
37
+ resource "aws_iam_role" "ecs_role" {
38
+ name_prefix = "${replace(format("%.32s", replace("tf-ECSInRole-${var.name}-", "_", "-")), "/\\s/", "-")}"
39
+ path = "${var.iam_path}"
40
+
41
+ assume_role_policy = <<EOF
42
+ {
43
+ "Version": "2012-10-17",
44
+ "Statement": [
45
+ {
46
+ "Action": "sts:AssumeRole",
47
+ "Principal": {
48
+ "Service": ["ecs.amazonaws.com", "ec2.amazonaws.com"]
49
+
50
+ },
51
+ "Effect": "Allow",
52
+ "Sid": ""
53
+ }
54
+ ]
55
+ }
56
+ EOF
57
+ }
58
+
59
+ # It may be useful to add the following for troubleshooting the InstanceStatus
60
+ # Health check if using the fitnesskeeper/consul docker image
61
+ # "ec2:Describe*",
62
+ # "autoscaling:Describe*",
63
+
64
+ resource "aws_iam_policy" "ecs_policy" {
65
+ name_prefix = "${replace(format("%.102s", replace("tf-ECSInPol-${var.name}-", "_", "-")), "/\\s/", "-")}"
66
+ description = "A terraform created policy for ECS"
67
+ path = "${var.iam_path}"
68
+ count = "${length(var.custom_iam_policy) > 0 ? 0 : 1}"
69
+
70
+ policy = <<EOF
71
+ {
72
+ "Version": "2012-10-17",
73
+ "Statement": [
74
+ {
75
+ "Effect": "Allow",
76
+ "Action": [
77
+ "ecs:CreateCluster",
78
+ "ecs:DeregisterContainerInstance",
79
+ "ecs:DiscoverPollEndpoint",
80
+ "ecs:Poll",
81
+ "ecs:RegisterContainerInstance",
82
+ "ecs:StartTelemetrySession",
83
+ "ecs:Submit*",
84
+ "ecr:GetAuthorizationToken",
85
+ "ecr:BatchCheckLayerAvailability",
86
+ "ecr:GetDownloadUrlForLayer",
87
+ "ecr:BatchGetImage",
88
+ "logs:CreateLogStream",
89
+ "logs:PutLogEvents"
90
+ ],
91
+ "Resource": "*"
92
+ }
93
+ ]
94
+ }
95
+ EOF
96
+ }
97
+
98
+ resource "aws_iam_policy" "custom_ecs_policy" {
99
+ name_prefix = "${replace(format("%.102s", replace("tf-ECSInPol-${var.name}-", "_", "-")), "/\\s/", "-")}"
100
+ description = "A terraform created policy for ECS"
101
+ path = "${var.iam_path}"
102
+ count = "${length(var.custom_iam_policy) > 0 ? 1 : 0}"
103
+
104
+ policy = "${var.custom_iam_policy}"
105
+ }
106
+
107
+ resource "aws_iam_policy_attachment" "attach_ecs" {
108
+ name = "ecs-attachment"
109
+ roles = ["${aws_iam_role.ecs_role.name}"]
110
+ policy_arn = "${element(concat(aws_iam_policy.ecs_policy.*.arn, aws_iam_policy.custom_ecs_policy.*.arn), 0)}"
111
+ }
112
+
113
+ # IAM Resources for Consul and Registrator Agents
114
+
115
+ data "aws_iam_policy_document" "consul_task_policy" {
116
+ statement {
117
+ actions = [
118
+ "ec2:Describe*",
119
+ "autoscaling:Describe*",
120
+ ]
121
+
122
+ resources = ["*"]
123
+ }
124
+ }
125
+
126
+ data "aws_iam_policy_document" "assume_role_consul_task" {
127
+ statement {
128
+ actions = ["sts:AssumeRole"]
129
+
130
+ principals {
131
+ type = "Service"
132
+ identifiers = ["ecs-tasks.amazonaws.com"]
133
+ }
134
+ }
135
+ }
136
+
137
+ resource "aws_iam_role" "consul_task" {
138
+ count = "${var.enable_agents ? 1 : 0}"
139
+ name_prefix = "${replace(format("%.32s", replace("tf-agentTaskRole-${var.name}-", "_", "-")), "/\\s/", "-")}"
140
+ path = "${var.iam_path}"
141
+ assume_role_policy = "${data.aws_iam_policy_document.assume_role_consul_task.json}"
142
+ }
143
+
144
+ resource "aws_iam_role_policy" "consul_ecs_task" {
145
+ count = "${var.enable_agents ? 1 : 0}"
146
+ name_prefix = "${replace(format("%.102s", replace("tf-agentTaskPol-${var.name}-", "_", "-")), "/\\s/", "-")}"
147
+ role = "${aws_iam_role.consul_task.id}"
148
+ policy = "${data.aws_iam_policy_document.consul_task_policy.json}"
149
+ }
@@ -0,0 +1,115 @@
1
+ # Vendored for TF031 (chant #2286), unmodified below this header.
2
+ # Source: https://github.com/BishopFox/iam-vulnerable/blob/0f298666f9b7cfa01488b86912afdb211773188a/modules/free-resources/privesc-paths/privesc-AssumeRole.tf
3
+ # Repository: BishopFox/iam-vulnerable, path modules/free-resources/privesc-paths/privesc-AssumeRole.tf, commit 0f298666f9b7cfa01488b86912afdb211773188a
4
+ # Licence: MIT
5
+ #
6
+ # TF031 fires on aws_iam_policy.privesc-AssumeRole-high-priv-policy: a literal
7
+ # jsonencode() policy whose one Allow statement has Action "*" and Resource "*".
8
+ # The three roles' assume_role_policy documents carry a reference Principal
9
+ # beside a literal Action, and are read as scoped, not as not determined.
10
+ #
11
+ # Copyright (c) 2021 Bishop Fox
12
+ #
13
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ # of this software and associated documentation files (the "Software"), to deal
15
+ # in the Software without restriction, including without limitation the rights
16
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ # copies of the Software, and to permit persons to whom the Software is
18
+ # furnished to do so, subject to the following conditions:
19
+ #
20
+ # The above copyright notice and this permission notice shall be included in all
21
+ # copies or substantial portions of the Software.
22
+ #
23
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ # SOFTWARE.
30
+
31
+ resource "aws_iam_policy" "privesc-AssumeRole-high-priv-policy" {
32
+ name = "privesc-AssumeRole-high-priv-policy"
33
+ path = "/"
34
+ description = "Allows privesc via targeted sts:AssumeRole"
35
+
36
+ # Terraform's "jsonencode" function converts a
37
+ # Terraform expression result to valid JSON syntax.
38
+ policy = jsonencode({
39
+ Version = "2012-10-17"
40
+ Statement = [
41
+ {
42
+ Effect = "Allow"
43
+ Action = "*"
44
+ Resource = "*"
45
+ },
46
+ ]
47
+ })
48
+ }
49
+
50
+ resource "aws_iam_role" "privesc-AssumeRole-starting-role" {
51
+ name = "privesc-AssumeRole-starting-role"
52
+ assume_role_policy = jsonencode({
53
+ Version = "2012-10-17"
54
+ Statement = [
55
+ {
56
+ Action = "sts:AssumeRole"
57
+ Effect = "Allow"
58
+ Sid = ""
59
+ Principal = {
60
+ AWS = var.aws_assume_role_arn
61
+ }
62
+ },
63
+ ]
64
+ })
65
+ }
66
+
67
+ resource "aws_iam_role" "privesc-AssumeRole-intermediate-role" {
68
+ name = "privesc-AssumeRole-intermediate-role"
69
+ assume_role_policy = jsonencode({
70
+ Version = "2012-10-17"
71
+ Statement = [
72
+ {
73
+ Action = "sts:AssumeRole"
74
+ Effect = "Allow"
75
+ Sid = ""
76
+ Principal = {
77
+ AWS = aws_iam_role.privesc-AssumeRole-starting-role.arn
78
+ }
79
+ },
80
+ ]
81
+ })
82
+ }
83
+
84
+
85
+ resource "aws_iam_role" "privesc-AssumeRole-ending-role" {
86
+ name = "privesc-AssumeRole-ending-role"
87
+ assume_role_policy = jsonencode({
88
+ Version = "2012-10-17"
89
+ Statement = [
90
+ {
91
+ Action = "sts:AssumeRole"
92
+ Effect = "Allow"
93
+ Sid = ""
94
+ Principal = {
95
+ AWS = aws_iam_role.privesc-AssumeRole-intermediate-role.arn
96
+ }
97
+ },
98
+ ]
99
+ })
100
+ }
101
+
102
+
103
+
104
+ resource "aws_iam_user" "privesc-AssumeRole-start-user" {
105
+ name = "privesc-AssumeRole-start-user"
106
+ path = "/"
107
+ }
108
+ resource "aws_iam_access_key" "privesc-AssumeRole-start-user" {
109
+ user = aws_iam_user.privesc-AssumeRole-start-user.name
110
+ }
111
+ resource "aws_iam_role_policy_attachment" "privesc-AssumeRole-high-priv-policy-role-attach-policy" {
112
+ role = aws_iam_role.privesc-AssumeRole-ending-role.name
113
+ policy_arn = aws_iam_policy.privesc-AssumeRole-high-priv-policy.arn
114
+
115
+ }
@@ -0,0 +1,20 @@
1
+ # Vendored for TF032 (chant #2287). Source: https://github.com/aquasecurity/trivy-checks
2
+ # Path: checks/cloud/aws/ecs/no_plaintext_secrets.yaml (terraform.good[0])
3
+ # Commit: 71c05d02845cc2c3a5dfa4fe914a68a052cc88bf
4
+ # Licence: MIT
5
+ # Copyright (c) 2024 Aqua Security. MIT licence: https://github.com/aquasecurity/trivy-checks/blob/71c05d02845cc2c3a5dfa4fe914a68a052cc88bf/LICENSE
6
+ # The upstream check's own passing example, lifted out of its YAML block scalar unchanged.
7
+ # Silent: the one environment entry is not a credential.
8
+
9
+ resource "aws_ecs_task_definition" "good_example" {
10
+ container_definitions = <<EOF
11
+ [
12
+ {
13
+ "name": "my_service",
14
+ "environment": [
15
+ { "name": "ENVIRONMENT", "value": "development" }
16
+ ]
17
+ }
18
+ ]
19
+ EOF
20
+ }
@@ -0,0 +1,214 @@
1
+ # Vendored for TF032 (chant #2287). Source: https://github.com/testdrivenio/django-ecs-terraform
2
+ # Path: terraform/07_ecs.tf
3
+ # Commit: 6571bcce48cee37fa10b1ee9a5caec147356b047
4
+ # Licence: MIT
5
+ # Copyright (c) 2023 TestDriven.io. MIT licence: https://github.com/testdrivenio/django-ecs-terraform/blob/6571bcce48cee37fa10b1ee9a5caec147356b047/LICENSE
6
+ # Copied verbatim below this header. No finding: RDS_PASSWORD is var.rds_password (a reference, not a literal), and the collectstatic task has no environment. The app task's container_definitions is data.template_file.app.rendered, which is not determined.
7
+
8
+ resource "aws_ecs_cluster" "production" {
9
+ name = "${var.ecs_cluster_name}-cluster"
10
+ }
11
+
12
+ data "template_file" "app" {
13
+ template = file("templates/django_app.json.tpl")
14
+
15
+ vars = {
16
+ docker_image_url_django = var.docker_image_url_django
17
+ docker_image_url_nginx = var.docker_image_url_nginx
18
+ region = var.region
19
+ rds_db_name = var.rds_db_name
20
+ rds_username = var.rds_username
21
+ rds_password = var.rds_password
22
+ rds_hostname = aws_db_instance.production.address
23
+ allowed_hosts = var.allowed_hosts
24
+ }
25
+ }
26
+
27
+ resource "aws_ecs_task_definition" "app" {
28
+ family = "django-app"
29
+ depends_on = [aws_db_instance.production]
30
+ network_mode = "awsvpc" # Required for Fargate
31
+ requires_compatibilities = ["FARGATE"]
32
+ cpu = "${var.fargate_cpu}"
33
+ memory = "${var.fargate_memory}"
34
+ execution_role_arn = aws_iam_role.ecs-task-execution-role.arn
35
+ task_role_arn = aws_iam_role.ecs-task-execution-role.arn
36
+ container_definitions = data.template_file.app.rendered
37
+ volume {
38
+ name = "efs-volume"
39
+ efs_volume_configuration {
40
+ file_system_id = aws_efs_file_system.efs.id
41
+ root_directory = "/"
42
+ transit_encryption = "ENABLED"
43
+ transit_encryption_port = 2049
44
+ authorization_config {
45
+ access_point_id = aws_efs_access_point.app_access_point.id
46
+ iam = "ENABLED"
47
+ }
48
+ }
49
+ }
50
+ }
51
+
52
+ resource "aws_ecs_service" "production" {
53
+ name = "${var.ecs_cluster_name}-service"
54
+ cluster = aws_ecs_cluster.production.id
55
+ task_definition = aws_ecs_task_definition.app.arn
56
+ launch_type = "FARGATE"
57
+ desired_count = var.app_count
58
+ network_configuration {
59
+ subnets = [aws_subnet.public-subnet-1.id, aws_subnet.public-subnet-2.id]
60
+ security_groups = [aws_security_group.ecs-fargate.id]
61
+ assign_public_ip = true
62
+ }
63
+
64
+ load_balancer {
65
+ target_group_arn = aws_alb_target_group.default-target-group.arn
66
+ container_name = "nginx"
67
+ container_port = 80
68
+ }
69
+ }
70
+
71
+ resource "aws_ecs_task_definition" "django_migration" {
72
+ family = "django-migration-task"
73
+ network_mode = "awsvpc"
74
+ requires_compatibilities = ["FARGATE"]
75
+ cpu = var.fargate_cpu
76
+ memory = var.fargate_memory
77
+ execution_role_arn = aws_iam_role.ecs-task-execution-role.arn
78
+
79
+ container_definitions = jsonencode([
80
+ {
81
+ name = "django-migration-container"
82
+ image = var.docker_image_url_django
83
+ environment: [
84
+ {
85
+ "name": "RDS_DB_NAME",
86
+ "value": var.rds_db_name
87
+ },
88
+ {
89
+ "name": "RDS_USERNAME",
90
+ "value": var.rds_username
91
+ },
92
+ {
93
+ "name": "RDS_PASSWORD",
94
+ "value": var.rds_password
95
+ },
96
+ {
97
+ "name": "RDS_HOSTNAME",
98
+ "value": aws_db_instance.production.address
99
+ },
100
+ {
101
+ "name": "RDS_PORT",
102
+ "value": "5432"
103
+ }
104
+ ],
105
+ # Run migrations as the command
106
+ command = ["python", "manage.py", "migrate"]
107
+
108
+ # Add log configuration for CloudWatch
109
+ logConfiguration = {
110
+ logDriver = "awslogs"
111
+ options = {
112
+ awslogs-group = "/ecs/django-app"
113
+ awslogs-region = var.region
114
+ awslogs-stream-prefix = "ecs"
115
+ }
116
+ }
117
+
118
+ # Other required configurations go here...
119
+ portMappings = [
120
+ {
121
+ containerPort = 8000
122
+ }
123
+ ]
124
+ }
125
+ ])
126
+ }
127
+
128
+ resource "aws_efs_file_system" "efs" {
129
+ lifecycle_policy {
130
+ transition_to_ia = "AFTER_30_DAYS"
131
+ }
132
+ }
133
+
134
+ resource "aws_efs_access_point" "app_access_point" {
135
+ file_system_id = aws_efs_file_system.efs.id
136
+ posix_user {
137
+ uid = 1000
138
+ gid = 1000
139
+ }
140
+ root_directory {
141
+ path = "/efs"
142
+ creation_info {
143
+ owner_uid = 1000
144
+ owner_gid = 1000
145
+ permissions = "755"
146
+ }
147
+ }
148
+ }
149
+
150
+ resource "aws_efs_mount_target" "efs_mount" {
151
+ count = length([aws_subnet.public-subnet-1.id, aws_subnet.public-subnet-2.id])
152
+ file_system_id = aws_efs_file_system.efs.id
153
+ subnet_id = [aws_subnet.public-subnet-1.id, aws_subnet.public-subnet-2.id][count.index]
154
+ security_groups = [aws_security_group.efs_sg.id]
155
+ }
156
+
157
+ resource "aws_ecs_task_definition" "django_collectstatic" {
158
+ family = "django-collectstatic-task"
159
+ network_mode = "awsvpc"
160
+ requires_compatibilities = ["FARGATE"]
161
+ cpu = var.fargate_cpu
162
+ memory = var.fargate_memory
163
+ execution_role_arn = aws_iam_role.ecs-task-execution-role.arn
164
+ task_role_arn = aws_iam_role.ecs-task-execution-role.arn
165
+ volume {
166
+ name = "efs-volume"
167
+ efs_volume_configuration {
168
+ file_system_id = aws_efs_file_system.efs.id
169
+ root_directory = "/"
170
+ transit_encryption = "ENABLED"
171
+ transit_encryption_port = 2049
172
+ authorization_config {
173
+ access_point_id = aws_efs_access_point.app_access_point.id
174
+ iam = "ENABLED"
175
+ }
176
+ }
177
+ }
178
+ container_definitions = jsonencode([
179
+ {
180
+ name = "django-collectstatic-container"
181
+ image = var.docker_image_url_django
182
+ linuxParameters = {
183
+ user = "1000:1000"
184
+ },
185
+ # Run collectstatic as the command
186
+ command = ["python", "manage.py", "collectstatic", "--no-input", "-v", "3"]
187
+
188
+ mountPoints = [
189
+ {
190
+ sourceVolume = "efs-volume",
191
+ containerPath = "/efs/staticfiles/",
192
+ readOnly = false
193
+ }
194
+ ]
195
+
196
+ # Add log configuration for CloudWatch
197
+ logConfiguration = {
198
+ logDriver = "awslogs"
199
+ options = {
200
+ awslogs-group = "/ecs/django-app"
201
+ awslogs-region = var.region
202
+ awslogs-stream-prefix = "ecs"
203
+ }
204
+ }
205
+
206
+ # Other required configurations go here...
207
+ portMappings = [
208
+ {
209
+ containerPort = 8000
210
+ }
211
+ ]
212
+ }
213
+ ])
214
+ }
@@ -0,0 +1,99 @@
1
+ # Vendored for TF032 (chant #2287). Source: https://github.com/vapor/penny-bot
2
+ # Path: infra/ecs.tf
3
+ # Commit: e1481d187e703649e2116d36c3cb022357946916
4
+ # Licence: Apache-2.0
5
+ # Copyright the penny-bot contributors. Licensed under the Apache License, Version 2.0: https://github.com/vapor/penny-bot/blob/e1481d187e703649e2116d36c3cb022357946916/LICENSE
6
+ # Copied verbatim below this header. Unmodified. Silent: BOT_TOKEN and SO_API_KEY arrive through secrets/valueFrom, and environment holds only a literal stage name and a reference.
7
+
8
+ resource "aws_ecs_cluster" "penny" {
9
+ name = module.constants.ecs_cluster_name
10
+ }
11
+
12
+ resource "aws_ecs_task_definition" "penny" {
13
+ family = "penny-bot"
14
+ skip_destroy = true
15
+ cpu = "256"
16
+ memory = "512"
17
+ network_mode = "awsvpc"
18
+ requires_compatibilities = ["FARGATE"]
19
+ execution_role_arn = data.aws_iam_role.ecs_task_execution.arn
20
+ task_role_arn = data.aws_iam_role.ecs_task.arn
21
+
22
+ runtime_platform {
23
+ cpu_architecture = "ARM64"
24
+ operating_system_family = "LINUX"
25
+ }
26
+
27
+ container_definitions = jsonencode([
28
+ {
29
+ name = "penny-bot"
30
+ image = "${aws_ecr_repository.penny_bot_discord_image.repository_url}:${local.penny_image_tag}"
31
+ cpu = 0
32
+ essential = true
33
+ portMappings = []
34
+ mountPoints = []
35
+ volumesFrom = []
36
+ systemControls = []
37
+ environment = [
38
+ {
39
+ name = "DEPLOYMENT_ENVIRONMENT"
40
+ value = "prod"
41
+ },
42
+ {
43
+ name = "GH_OAUTH_CLIENT_ID"
44
+ value = module.constants.gh_oauth_client_id
45
+ }
46
+ ]
47
+ secrets = [
48
+ {
49
+ name = "BOT_TOKEN"
50
+ valueFrom = aws_secretsmanager_secret.discord_bot_token.arn
51
+ },
52
+ {
53
+ name = "LOGGING_WEBHOOK_URL"
54
+ valueFrom = aws_secretsmanager_secret.logs_webhook_url.arn
55
+ },
56
+ {
57
+ name = "ACCOUNT_LINKING_OAUTH_FLOW_PRIV_KEY"
58
+ valueFrom = aws_secretsmanager_secret.account_linking_priv_key.arn
59
+ },
60
+ {
61
+ name = "SO_API_KEY"
62
+ valueFrom = aws_secretsmanager_secret.stack_overflow_api_key.arn
63
+ }
64
+ ]
65
+ logConfiguration = {
66
+ logDriver = "awslogs"
67
+ options = {
68
+ awslogs-group = aws_cloudwatch_log_group.ecs_api.name
69
+ awslogs-region = local.region
70
+ awslogs-stream-prefix = "ecs"
71
+ }
72
+ }
73
+ }
74
+ ])
75
+ }
76
+
77
+ resource "aws_ecs_service" "penny" {
78
+ name = module.constants.ecs_service_name
79
+ cluster = aws_ecs_cluster.penny.id
80
+ task_definition = "${aws_ecs_task_definition.penny.family}:${aws_ecs_task_definition.penny.revision}"
81
+ desired_count = 1
82
+ launch_type = "FARGATE"
83
+ platform_version = "1.4.0"
84
+ wait_for_steady_state = true
85
+
86
+ deployment_minimum_healthy_percent = 100
87
+ deployment_maximum_percent = 200
88
+
89
+ deployment_circuit_breaker {
90
+ enable = true
91
+ rollback = true
92
+ }
93
+
94
+ network_configuration {
95
+ subnets = data.aws_subnets.default.ids
96
+ security_groups = [aws_security_group.ecs_service.id]
97
+ assign_public_ip = true
98
+ }
99
+ }
@@ -0,0 +1,22 @@
1
+ # Vendored for TF032 (chant #2287). Source: https://github.com/aquasecurity/trivy-checks
2
+ # Path: checks/cloud/aws/ecs/no_plaintext_secrets.yaml (terraform.bad[0])
3
+ # Commit: 71c05d02845cc2c3a5dfa4fe914a68a052cc88bf
4
+ # Licence: MIT
5
+ # Copyright (c) 2024 Aqua Security. MIT licence: https://github.com/aquasecurity/trivy-checks/blob/71c05d02845cc2c3a5dfa4fe914a68a052cc88bf/LICENSE
6
+ # The upstream check's own failing example, lifted out of its YAML block scalar unchanged.
7
+ # A heredoc with no interpolation arrives from hcl2json as a plain string, so it is read
8
+ # as JSON. Fires once, on DATABASE_PASSWORD.
9
+
10
+ resource "aws_ecs_task_definition" "bad_example" {
11
+ container_definitions = <<EOF
12
+ [
13
+ {
14
+ "name": "my_service",
15
+ "environment": [
16
+ { "name": "ENVIRONMENT", "value": "development" },
17
+ { "name": "DATABASE_PASSWORD", "value": "oh no D:"}
18
+ ]
19
+ }
20
+ ]
21
+ EOF
22
+ }