@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,55 @@
1
+ # Vendored for TF030 from https://github.com/aws-samples/web-hosting-architecture-examples-for-china-region-terraform
2
+ # Path: eks/security-groups.tf
3
+ # Commit: 718a45d536672e7f5f4e1fa6011e3acb27ab4f5a
4
+ # Licence: MIT-0, https://github.com/aws-samples/web-hosting-architecture-examples-for-china-region-terraform/blob/718a45d536672e7f5f4e1fa6011e3acb27ab4f5a/LICENSE
5
+ # The whole file, unmodified.
6
+ #
7
+ # TF030: silent. Every group opens 22, but only to private ranges.
8
+
9
+
10
+ resource "aws_security_group" "worker_group_mgmt_one" {
11
+ name_prefix = "worker_group_mgmt_one"
12
+ vpc_id = module.vpc.vpc_id
13
+
14
+ ingress {
15
+ from_port = 22
16
+ to_port = 22
17
+ protocol = "tcp"
18
+
19
+ cidr_blocks = [
20
+ "10.0.0.0/8",
21
+ ]
22
+ }
23
+ }
24
+
25
+ resource "aws_security_group" "worker_group_mgmt_two" {
26
+ name_prefix = "worker_group_mgmt_two"
27
+ vpc_id = module.vpc.vpc_id
28
+
29
+ ingress {
30
+ from_port = 22
31
+ to_port = 22
32
+ protocol = "tcp"
33
+
34
+ cidr_blocks = [
35
+ "192.168.0.0/16",
36
+ ]
37
+ }
38
+ }
39
+
40
+ resource "aws_security_group" "all_worker_mgmt" {
41
+ name_prefix = "all_worker_management"
42
+ vpc_id = module.vpc.vpc_id
43
+
44
+ ingress {
45
+ from_port = 22
46
+ to_port = 22
47
+ protocol = "tcp"
48
+
49
+ cidr_blocks = [
50
+ "10.0.0.0/8",
51
+ "172.16.0.0/12",
52
+ "192.168.0.0/16",
53
+ ]
54
+ }
55
+ }
@@ -0,0 +1,28 @@
1
+ # Vendored for TF030 from https://github.com/gruntwork-io/terratest
2
+ # Path: examples/terraform-ssh-example/main.tf
3
+ # Commit: 75a9f881c31f71255b474149edada4a1850bce22
4
+ # Licence: Apache-2.0, https://github.com/gruntwork-io/terratest/blob/75a9f881c31f71255b474149edada4a1850bce22/LICENSE
5
+ # Excerpt: lines 61-80, the aws_security_group.example block, unmodified.
6
+ #
7
+ # TF030: one info, Not determined: the CIDR is 0.0.0.0/0 but from_port and to_port are var.ssh_port. The open egress is not reported.
8
+
9
+ resource "aws_security_group" "example" {
10
+ name = var.instance_name
11
+
12
+ egress {
13
+ from_port = 0
14
+ to_port = 0
15
+ protocol = "-1"
16
+ cidr_blocks = ["0.0.0.0/0"]
17
+ }
18
+
19
+ ingress {
20
+ from_port = var.ssh_port
21
+ to_port = var.ssh_port
22
+ protocol = "tcp"
23
+
24
+ # To keep this example simple, we allow incoming SSH requests from any IP. In real-world usage, you should only
25
+ # allow SSH requests from trusted servers, such as a bastion host or VPN server.
26
+ cidr_blocks = ["0.0.0.0/0"]
27
+ }
28
+ }
@@ -0,0 +1,32 @@
1
+ # Vendored for TF030 from https://github.com/aws-samples/terraform-sample-workshop
2
+ # Path: module_1/one_file_tf/simple_nginx_stack/main.tf
3
+ # Commit: 0a265e356a3cf4fd0f15ba821b7bedf712a32239
4
+ # Licence: MIT-0, https://github.com/aws-samples/terraform-sample-workshop/blob/0a265e356a3cf4fd0f15ba821b7bedf712a32239/LICENSE
5
+ # Excerpt: lines 127-150, unmodified.
6
+ #
7
+ # TF030: one info, Not determined: allow_ssh_internal opens 22 to cidr_blocks = [var.cidr_vpc]. egress_allow_all (protocol "all", 0.0.0.0/0) is egress and is not reported.
8
+
9
+ resource "aws_security_group" "vpc_security_group" {
10
+ name = "aws-${var.vpc_name}-vpc-sg"
11
+ vpc_id = aws_vpc.vpc.id
12
+ }
13
+
14
+ resource "aws_security_group_rule" "allow_ssh_internal" {
15
+ type = "ingress"
16
+ from_port = 22
17
+ to_port = 22
18
+ protocol = "tcp"
19
+ cidr_blocks = [var.cidr_vpc]
20
+
21
+ security_group_id = aws_security_group.vpc_security_group.id
22
+ }
23
+
24
+ resource "aws_security_group_rule" "egress_allow_all" {
25
+ type = "egress"
26
+ from_port = 0
27
+ to_port = 65535
28
+ protocol = "all"
29
+ cidr_blocks = ["0.0.0.0/0"]
30
+
31
+ security_group_id = aws_security_group.vpc_security_group.id
32
+ }
@@ -0,0 +1,21 @@
1
+ # Vendored for TF030 from https://github.com/aws-samples/sample-parallel-computing-service
2
+ # Path: modules/vpc/main.tf
3
+ # Commit: e74e5806f8fa203b268532f9f6c64e649b35708e
4
+ # Licence: MIT-0, https://github.com/aws-samples/sample-parallel-computing-service/blob/e74e5806f8fa203b268532f9f6c64e649b35708e/LICENSE
5
+ # Excerpt: lines 81-93, unmodified. The for_each map it reads, local.pcs_public_security_group_rules.ingress (lines 37-51 of the same file), does open 22 to 0.0.0.0/0.
6
+ #
7
+ # TF030: one info, Not determined: every attribute is each.value.*, so the rule cannot see the open SSH port that the locals declare. This is what the info finding is for.
8
+
9
+ resource "aws_security_group" "pcs_public" {
10
+ name = "${var.project}-public-sg"
11
+ vpc_id = aws_vpc.pcs.id
12
+ }
13
+
14
+ resource "aws_vpc_security_group_ingress_rule" "pcs_public_allow_ingress" {
15
+ for_each = local.pcs_public_security_group_rules.ingress
16
+ security_group_id = aws_security_group.pcs_public.id
17
+ cidr_ipv4 = each.value.cidr_ipv4
18
+ from_port = each.value.from_port
19
+ ip_protocol = each.value.ip_protocol
20
+ to_port = each.value.to_port
21
+ }
@@ -0,0 +1,39 @@
1
+ # Vendored for TF030 from https://github.com/aws-samples/sample-issac-lab-on-aws
2
+ # Path: main.tf
3
+ # Commit: 50ea76d87d873c1d69bed92c450ab144894f437e
4
+ # Licence: MIT-0, https://github.com/aws-samples/sample-issac-lab-on-aws/blob/50ea76d87d873c1d69bed92c450ab144894f437e/LICENSE
5
+ # Excerpt: lines 116-146, the aws_security_group.isaac block, unmodified.
6
+ #
7
+ # TF030: one info, Not determined: port 22 is open to cidr_blocks = var.allowed_ssh_cidrs, which the parse cannot read. No error.
8
+
9
+ resource "aws_security_group" "isaac" {
10
+ name_prefix = "${var.project_name}-sg-"
11
+ description = "Isaac Lab training instance security group"
12
+ vpc_id = aws_vpc.isaac.id
13
+
14
+ # SSH
15
+ ingress {
16
+ description = "SSH"
17
+ from_port = 22
18
+ to_port = 22
19
+ protocol = "tcp"
20
+ cidr_blocks = var.allowed_ssh_cidrs
21
+ }
22
+
23
+ # All outbound
24
+ egress {
25
+ from_port = 0
26
+ to_port = 0
27
+ protocol = "-1"
28
+ cidr_blocks = ["0.0.0.0/0"]
29
+ }
30
+
31
+ tags = {
32
+ Name = "${var.project_name}-sg"
33
+ Project = var.project_name
34
+ }
35
+
36
+ lifecycle {
37
+ create_before_destroy = true
38
+ }
39
+ }
@@ -0,0 +1,44 @@
1
+ # Vendored for TF030 from https://github.com/bridgecrewio/checkov
2
+ # Path: tests/terraform/checks/resource/aws/example_SecurityGroupUnrestrictedIngress22/main.tf
3
+ # Commit: 4ef6eb50e33f60d8a204138f08883e12494ac230
4
+ # Licence: Apache-2.0, https://github.com/bridgecrewio/checkov/blob/4ef6eb50e33f60d8a204138f08883e12494ac230/LICENSE
5
+ # Checkov's own test corpus for CKV_AWS_24. Excerpt: lines 63-98, the aws_security_group.fail4 and aws_security_group.fail-ipv6 blocks, unmodified.
6
+ #
7
+ # TF030: two errors: fail4 writes ingress in attribute syntax with protocol "-1" (every port), fail-ipv6 opens 22 to ::/0.
8
+
9
+ resource "aws_security_group" "fail4" {
10
+ description = "SG with inline rules"
11
+ ingress = [
12
+ {
13
+ cidr_blocks = ["0.0.0.0/0"]
14
+ description = "Wide Open"
15
+ from_port = 0
16
+ ipv6_cidr_blocks = []
17
+ prefix_list_ids = []
18
+ security_groups = []
19
+ protocol = "-1"
20
+ self = false
21
+ to_port = 65535
22
+ }
23
+ ]
24
+ }
25
+
26
+ resource "aws_security_group" "fail-ipv6" {
27
+ name = "sg-bar"
28
+ vpc_id = aws_vpc.main.id
29
+
30
+ ingress {
31
+ from_port = 22
32
+ to_port = 22
33
+ protocol = "tcp"
34
+ ipv6_cidr_blocks = ["192.168.0.0/16", "::/0"]
35
+ description = "foo"
36
+ }
37
+
38
+ egress {
39
+ from_port = 0
40
+ to_port = 0
41
+ protocol = "-1"
42
+ cidr_blocks = ["0.0.0.0/0"]
43
+ }
44
+ }
@@ -0,0 +1,36 @@
1
+ # Vendored for TF030 from https://github.com/aws-samples/aws-database-acceleration-toolkit
2
+ # Path: modules/tffiles-jenkins/jenkins.tf
3
+ # Commit: dbb3d2df6a53ef95049e04b7bbe69aa70c607f81
4
+ # Licence: MIT-0, https://github.com/aws-samples/aws-database-acceleration-toolkit/blob/dbb3d2df6a53ef95049e04b7bbe69aa70c607f81/LICENSE
5
+ # Excerpt: lines 38-65, the aws_security_group.jenkins_port block, unmodified.
6
+ #
7
+ # TF030: one error, on the second ingress (port 22 from 0.0.0.0/0). The first ingress opens 8080, which is not on the sensitive list, and the egress is not ingress.
8
+
9
+ resource "aws_security_group" "jenkins_port" {
10
+ vpc_id = var.vpc_id
11
+ provider = aws.primary
12
+
13
+ egress {
14
+ from_port = 0
15
+ to_port = 0
16
+ protocol = -1
17
+ cidr_blocks = ["0.0.0.0/0"]
18
+ }
19
+
20
+
21
+ ingress {
22
+ from_port = 8080
23
+ to_port = 8080
24
+ protocol = "tcp"
25
+ cidr_blocks = ["0.0.0.0/0"]
26
+ }
27
+
28
+ ingress {
29
+ from_port = 22
30
+ to_port = 22
31
+ protocol = "tcp"
32
+ cidr_blocks = ["0.0.0.0/0"]
33
+ }
34
+
35
+ lifecycle { create_before_destroy = true }
36
+ }
@@ -0,0 +1,25 @@
1
+ # Vendored for TF030 from https://github.com/bridgecrewio/checkov
2
+ # Path: tests/terraform/checks/resource/aws/example_SecurityGroupUnrestrictedIngress22/main.tf
3
+ # Commit: 4ef6eb50e33f60d8a204138f08883e12494ac230
4
+ # Licence: Apache-2.0, https://github.com/bridgecrewio/checkov/blob/4ef6eb50e33f60d8a204138f08883e12494ac230/LICENSE
5
+ # Checkov's own test corpus for CKV_AWS_24. Excerpt: lines 100-116, the aws_security_group_rule.fail and aws_vpc_security_group_ingress_rule.fail blocks, unmodified.
6
+ #
7
+ # TF030: two errors, one per standalone shape: a 0.0.0.0/0 among other CIDRs on 22, and cidr_ipv4 = "0.0.0.0/0" on 22.
8
+
9
+ resource "aws_security_group_rule" "fail" {
10
+ type = "ingress"
11
+ from_port = 22
12
+ to_port = 22
13
+ protocol = "tcp"
14
+ cidr_blocks = ["192.168.0.0/16", "0.0.0.0/0"]
15
+ security_group_id = aws_security_group.bar-sg.id
16
+ }
17
+
18
+ resource "aws_vpc_security_group_ingress_rule" "fail" {
19
+ security_group_id = aws_security_group.example.id
20
+
21
+ cidr_ipv4 = "0.0.0.0/0"
22
+ from_port = 22
23
+ ip_protocol = "tcp"
24
+ to_port = 22
25
+ }
@@ -0,0 +1,43 @@
1
+ # Vendored for TF030 from https://github.com/aws-samples/terraform-ec2-image-builder-container-hardening-pipeline
2
+ # Path: sec-groups.tf
3
+ # Commit: 68c34a21e966afc11c572677c319f2cc8379ec94
4
+ # Licence: MIT-0, https://github.com/aws-samples/terraform-ec2-image-builder-container-hardening-pipeline/blob/68c34a21e966afc11c572677c319f2cc8379ec94/LICENSE
5
+ # The whole file, unmodified.
6
+ #
7
+ # TF030: one error, on the "Ephemeral" ingress: tcp 1025-65535 from 0.0.0.0/0 spans 3306, 3389 and 5432. The TLS ingress on 443 is not reported.
8
+
9
+ resource "aws_security_group" "image_builder_sg" {
10
+ depends_on = [
11
+ aws_vpc.hardening_pipeline
12
+ ]
13
+ name = "${var.image_name}-sg"
14
+ description = "Security group for EC2 Image Builder"
15
+ vpc_id = aws_vpc.hardening_pipeline.id
16
+
17
+ ingress {
18
+ description = "TLS"
19
+ from_port = 443
20
+ to_port = 443
21
+ protocol = "tcp"
22
+ cidr_blocks = ["0.0.0.0/0"]
23
+ }
24
+
25
+ ingress {
26
+ description = "Ephemeral"
27
+ from_port = 1025
28
+ to_port = 65535
29
+ protocol = "tcp"
30
+ cidr_blocks = ["0.0.0.0/0"]
31
+ }
32
+
33
+ egress {
34
+ description = "Allow all eggress"
35
+ from_port = 0
36
+ to_port = 0
37
+ protocol = "-1"
38
+ cidr_blocks = ["0.0.0.0/0"]
39
+ ipv6_cidr_blocks = ["::/0"]
40
+ }
41
+
42
+ tags = local.core_tags
43
+ }
@@ -0,0 +1,89 @@
1
+ # Vendored for TF031 (chant #2286), unmodified below this header.
2
+ # Source: https://github.com/alphagov/tech-ops/blob/122e78d1c6477825b22dd52f32e185a4a7838683/reliability-engineering/terraform/modules/concourse-monitoring/prometheus-ecs-iam.tf
3
+ # Repository: alphagov/tech-ops, path reliability-engineering/terraform/modules/concourse-monitoring/prometheus-ecs-iam.tf, commit 122e78d1c6477825b22dd52f32e185a4a7838683
4
+ # Licence: MIT
5
+ #
6
+ # Scoped policies only: every action is named and every resource is an
7
+ # attribute of a managed resource, which can never be "*". TF031 reports
8
+ # nothing, and not "not determined" either.
9
+ #
10
+ # Copyright (c) 2018 Government Digital Service
11
+ #
12
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ # of this software and associated documentation files (the "Software"), to deal
14
+ # in the Software without restriction, including without limitation the rights
15
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ # copies of the Software, and to permit persons to whom the Software is
17
+ # furnished to do so, subject to the following conditions:
18
+ #
19
+ # The above copyright notice and this permission notice shall be included in all
20
+ # copies or substantial portions of the Software.
21
+ #
22
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ # SOFTWARE.
29
+
30
+ data "aws_iam_policy_document" "ecs_assume_role" {
31
+ statement {
32
+ actions = ["sts:AssumeRole"]
33
+ principals {
34
+ type = "Service"
35
+ identifiers = ["ecs-tasks.amazonaws.com"]
36
+ }
37
+ }
38
+ }
39
+
40
+ resource "aws_iam_role" "prometheus_execution" {
41
+ name = "${var.deployment}-prometheus-execution"
42
+ assume_role_policy = data.aws_iam_policy_document.ecs_assume_role.json
43
+ }
44
+
45
+ data "aws_iam_policy_document" "prometheus_data_volume_access" {
46
+ statement {
47
+ principals {
48
+ type = "AWS"
49
+ identifiers = [aws_iam_role.concourse_prometheus.arn]
50
+ }
51
+
52
+ actions = [
53
+ "elasticfilesystem:ClientMount",
54
+ "elasticfilesystem:ClientWrite",
55
+ ]
56
+
57
+ condition {
58
+ test = "StringEquals"
59
+ variable = "elasticfilesystem:AccessPointArn"
60
+ values = [aws_efs_access_point.prometheus.arn]
61
+ }
62
+
63
+ resources = [aws_efs_file_system.prometheus.arn]
64
+ }
65
+ }
66
+
67
+ data "aws_iam_policy_document" "prometheus_cloudwatch_access" {
68
+ statement {
69
+ actions = [
70
+ "logs:CreateLogStream",
71
+ "logs:PutLogEvents",
72
+ ]
73
+
74
+ resources = [
75
+ aws_cloudwatch_log_group.prometheus.arn,
76
+ "${aws_cloudwatch_log_group.prometheus.arn}:log-stream:*",
77
+ ]
78
+ }
79
+ }
80
+
81
+ resource "aws_iam_policy" "prometheus_cloudwatch_access" {
82
+ name = "${var.deployment}-prometheus-cloudwatch-access"
83
+ policy = data.aws_iam_policy_document.prometheus_cloudwatch_access.json
84
+ }
85
+
86
+ resource "aws_iam_role_policy_attachment" "prometheus_cloudwatch_access" {
87
+ role = aws_iam_role.prometheus_execution.name
88
+ policy_arn = aws_iam_policy.prometheus_cloudwatch_access.arn
89
+ }
@@ -0,0 +1,139 @@
1
+ # Vendored for TF031 (chant #2286), unmodified below this header.
2
+ # Source: https://github.com/alphagov/tech-ops/blob/122e78d1c6477825b22dd52f32e185a4a7838683/reliability-engineering/terraform/modules/concourse-secrets-admin/iam.tf
3
+ # Repository: alphagov/tech-ops, path reliability-engineering/terraform/modules/concourse-secrets-admin/iam.tf, commit 122e78d1c6477825b22dd52f32e185a4a7838683
4
+ # Licence: MIT
5
+ #
6
+ # Both documents build Statement with concat(...) and a for-expression, so
7
+ # TF031 cannot read them and reports not determined, never a warning. The
8
+ # Deny statement with Action "*" and Resource "*" inside the concat is a guard
9
+ # rail and would not fire even if it were readable.
10
+ #
11
+ # Copyright (c) 2018 Government Digital Service
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_role" "concourse_secrets_admin" {
32
+ name = "${var.deployment}-${var.concourse_team_name}-concourse-secrets-admin"
33
+
34
+ assume_role_policy = jsonencode({
35
+ Version = "2012-10-17"
36
+ Statement = concat(
37
+ [
38
+ for team_id in concat(
39
+ var.trusted_github_team_id == "" ? [] : [var.trusted_github_team_id],
40
+ var.trusted_github_team_ids
41
+ ) : {
42
+ Effect = "Allow"
43
+ Principal = {
44
+ Federated = var.iam_oidc_provider_arn
45
+ }
46
+ Action = "sts:AssumeRoleWithWebIdentity"
47
+ Condition = {
48
+ StringEquals = {
49
+ "${var.oidc_host_path}:aud" = var.github_oauth_client_id
50
+ "aws:RequestTag/t${team_id}" = "t"
51
+ }
52
+ }
53
+ }
54
+ ],
55
+ [
56
+ {
57
+ Sid = "AllowPassSessionTagsAndTransitive"
58
+ Effect = "Allow"
59
+ Action = "sts:TagSession"
60
+ Principal = {
61
+ Federated = var.iam_oidc_provider_arn
62
+ }
63
+ }
64
+ ],
65
+ (length(var.allowed_cidrs) == 0 ? [] : [{
66
+ Sid = "DisallowAssumeFromUntrustedCIDR"
67
+ Effect = "Deny"
68
+ Principal = {
69
+ Federated = var.iam_oidc_provider_arn
70
+ }
71
+ Action = "sts:AssumeRoleWithWebIdentity"
72
+ Condition = {
73
+ NotIpAddress = {
74
+ "aws:SourceIp" = var.allowed_cidrs
75
+ }
76
+ }
77
+ }
78
+ ])
79
+ )
80
+ })
81
+ }
82
+
83
+ resource "aws_iam_role_policy" "concourse_secrets_admin" {
84
+ name = "${var.deployment}-${var.concourse_team_name}-concourse-secrets-admin-policy"
85
+ role = aws_iam_role.concourse_secrets_admin.id
86
+
87
+ policy = jsonencode({
88
+ Version = "2012-10-17"
89
+ Statement = concat(
90
+ [
91
+ {
92
+ Action = [
93
+ "ssm:GetParameter",
94
+ "ssm:GetParameterHistory",
95
+ "ssm:GetParameters",
96
+ "ssm:GetParametersByPath",
97
+ "ssm:DeleteParameter",
98
+ "ssm:PutParameter",
99
+ ]
100
+ Effect = "Allow"
101
+ Resource = [
102
+ "arn:aws:ssm:eu-west-2:${data.aws_caller_identity.account.account_id}:parameter/${var.deployment}/concourse/pipelines/${var.concourse_team_name}/*"
103
+ ]
104
+ }, {
105
+ Action = [
106
+ "ssm:DeleteParameter",
107
+ "ssm:PutParameter",
108
+ ]
109
+ Effect = "Deny"
110
+ Resource = [
111
+ "arn:aws:ssm:eu-west-2:${data.aws_caller_identity.account.account_id}:parameter/${var.deployment}/concourse/pipelines/${var.concourse_team_name}/readonly_*"
112
+ ]
113
+ }, {
114
+ Action = [
115
+ "kms:ListKeys",
116
+ "kms:ListAliases",
117
+ "kms:Describe*",
118
+ "kms:Decrypt",
119
+ "kms:Encrypt",
120
+ ]
121
+ Effect = "Allow"
122
+ Resource = var.kms_key_arn
123
+ }
124
+ ],
125
+ (length(var.allowed_cidrs) == 0 ? [] : [{
126
+ Sid = "DisallowAllFromUntrustedCIDR"
127
+ Effect = "Deny"
128
+ Action = "*"
129
+ Resource = "*"
130
+ Condition = {
131
+ NotIpAddress = {
132
+ "aws:SourceIp" = var.allowed_cidrs
133
+ }
134
+ }
135
+ }
136
+ ])
137
+ )
138
+ })
139
+ }
@@ -0,0 +1,57 @@
1
+ # Vendored for TF031 (chant #2286), unmodified below this header.
2
+ # Source: https://github.com/alphagov/tech-ops/blob/122e78d1c6477825b22dd52f32e185a4a7838683/cyber-security/modules/gds_security_audit_role/inline_policies.tf
3
+ # Repository: alphagov/tech-ops, path cyber-security/modules/gds_security_audit_role/inline_policies.tf, commit 122e78d1c6477825b22dd52f32e185a4a7838683
4
+ # Licence: MIT
5
+ #
6
+ # TF031 fires on both aws_iam_policy_document data sources (resources = ["*"]).
7
+ # The two aws_iam_role_policy resources name those documents' .json and are
8
+ # not reported again.
9
+ #
10
+ # Copyright (c) 2018 Government Digital Service
11
+ #
12
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ # of this software and associated documentation files (the "Software"), to deal
14
+ # in the Software without restriction, including without limitation the rights
15
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ # copies of the Software, and to permit persons to whom the Software is
17
+ # furnished to do so, subject to the following conditions:
18
+ #
19
+ # The above copyright notice and this permission notice shall be included in all
20
+ # copies or substantial portions of the Software.
21
+ #
22
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ # SOFTWARE.
29
+
30
+ data "aws_iam_policy_document" "support_inline_policy_document" {
31
+ statement {
32
+ effect = "Allow"
33
+ actions = ["support:*"]
34
+ resources = ["*"]
35
+ }
36
+ }
37
+
38
+ resource "aws_iam_role_policy" "support_inline_policy" {
39
+ name = "${var.prefix}GDSSecurityAuditInlineSupportPolicy"
40
+ role = aws_iam_role.gds_security_audit_role.id
41
+ policy = data.aws_iam_policy_document.support_inline_policy_document.json
42
+ }
43
+
44
+ data "aws_iam_policy_document" "sts_inline_policy_document" {
45
+ statement {
46
+ effect = "Allow"
47
+ actions = ["sts:GetCallerIdentity"]
48
+ resources = ["*"]
49
+ }
50
+ }
51
+
52
+ resource "aws_iam_role_policy" "sts_inline_policy" {
53
+ name = "${var.prefix}GDSSecurityAuditInlineSTSPolicy"
54
+ role = aws_iam_role.gds_security_audit_role.id
55
+ policy = data.aws_iam_policy_document.sts_inline_policy_document.json
56
+ }
57
+