@guardian/cdk 0.0.0-canary-20260805130549

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 (622) hide show
  1. package/README.md +50 -0
  2. package/bin/gu-cdk +5 -0
  3. package/lib/aspects/cfn-include-reporter.d.ts +9 -0
  4. package/lib/aspects/cfn-include-reporter.d.ts.map +1 -0
  5. package/lib/aspects/cfn-include-reporter.js +18 -0
  6. package/lib/aspects/cfn-include-reporter.js.map +1 -0
  7. package/lib/aspects/cfn-parameter-reporter.d.ts +9 -0
  8. package/lib/aspects/cfn-parameter-reporter.d.ts.map +1 -0
  9. package/lib/aspects/cfn-parameter-reporter.js +21 -0
  10. package/lib/aspects/cfn-parameter-reporter.js.map +1 -0
  11. package/lib/aspects/metadata.d.ts +8 -0
  12. package/lib/aspects/metadata.d.ts.map +1 -0
  13. package/lib/aspects/metadata.js +28 -0
  14. package/lib/aspects/metadata.js.map +1 -0
  15. package/lib/bin/aws-credential-provider.d.ts +3 -0
  16. package/lib/bin/aws-credential-provider.d.ts.map +1 -0
  17. package/lib/bin/aws-credential-provider.js +9 -0
  18. package/lib/bin/aws-credential-provider.js.map +1 -0
  19. package/lib/bin/commands/account-readiness/index.d.ts +11 -0
  20. package/lib/bin/commands/account-readiness/index.d.ts.map +1 -0
  21. package/lib/bin/commands/account-readiness/index.js +26 -0
  22. package/lib/bin/commands/account-readiness/index.js.map +1 -0
  23. package/lib/bin/commands/account-readiness/ssm.d.ts +12 -0
  24. package/lib/bin/commands/account-readiness/ssm.d.ts.map +1 -0
  25. package/lib/bin/commands/account-readiness/ssm.js +76 -0
  26. package/lib/bin/commands/account-readiness/ssm.js.map +1 -0
  27. package/lib/bin/commands/aws-cdk-version.d.ts +3 -0
  28. package/lib/bin/commands/aws-cdk-version.d.ts.map +1 -0
  29. package/lib/bin/commands/aws-cdk-version.js +9 -0
  30. package/lib/bin/commands/aws-cdk-version.js.map +1 -0
  31. package/lib/bin/commands/new-project/index.d.ts +14 -0
  32. package/lib/bin/commands/new-project/index.d.ts.map +1 -0
  33. package/lib/bin/commands/new-project/index.js +134 -0
  34. package/lib/bin/commands/new-project/index.js.map +1 -0
  35. package/lib/bin/commands/new-project/template/.gitignore.template +11 -0
  36. package/lib/bin/commands/new-project/template/README.md +5 -0
  37. package/lib/bin/commands/new-project/template/bin/.ignore +2 -0
  38. package/lib/bin/commands/new-project/template/cdk.json +7 -0
  39. package/lib/bin/commands/new-project/template/eslint.config.mjs +6 -0
  40. package/lib/bin/commands/new-project/template/jest.setup.js +2 -0
  41. package/lib/bin/commands/new-project/template/tsconfig.json.template +12 -0
  42. package/lib/bin/commands/new-project/utils/app.d.ts +23 -0
  43. package/lib/bin/commands/new-project/utils/app.d.ts.map +1 -0
  44. package/lib/bin/commands/new-project/utils/app.js +36 -0
  45. package/lib/bin/commands/new-project/utils/app.js.map +1 -0
  46. package/lib/bin/commands/new-project/utils/imports.d.ts +11 -0
  47. package/lib/bin/commands/new-project/utils/imports.d.ts.map +1 -0
  48. package/lib/bin/commands/new-project/utils/imports.js +107 -0
  49. package/lib/bin/commands/new-project/utils/imports.js.map +1 -0
  50. package/lib/bin/commands/new-project/utils/init.d.ts +13 -0
  51. package/lib/bin/commands/new-project/utils/init.d.ts.map +1 -0
  52. package/lib/bin/commands/new-project/utils/init.js +113 -0
  53. package/lib/bin/commands/new-project/utils/init.js.map +1 -0
  54. package/lib/bin/commands/new-project/utils/snapshot.d.ts +21 -0
  55. package/lib/bin/commands/new-project/utils/snapshot.d.ts.map +1 -0
  56. package/lib/bin/commands/new-project/utils/snapshot.js +41 -0
  57. package/lib/bin/commands/new-project/utils/snapshot.js.map +1 -0
  58. package/lib/bin/commands/new-project/utils/stack.d.ts +21 -0
  59. package/lib/bin/commands/new-project/utils/stack.d.ts.map +1 -0
  60. package/lib/bin/commands/new-project/utils/stack.js +40 -0
  61. package/lib/bin/commands/new-project/utils/stack.js.map +1 -0
  62. package/lib/bin/commands/new-project/utils/utils.d.ts +12 -0
  63. package/lib/bin/commands/new-project/utils/utils.d.ts.map +1 -0
  64. package/lib/bin/commands/new-project/utils/utils.js +16 -0
  65. package/lib/bin/commands/new-project/utils/utils.js.map +1 -0
  66. package/lib/bin/index.d.ts +3 -0
  67. package/lib/bin/index.d.ts.map +1 -0
  68. package/lib/bin/index.js +124 -0
  69. package/lib/bin/index.js.map +1 -0
  70. package/lib/constants/__mocks__/library-info.d.ts +6 -0
  71. package/lib/constants/__mocks__/library-info.d.ts.map +1 -0
  72. package/lib/constants/__mocks__/library-info.js +11 -0
  73. package/lib/constants/__mocks__/library-info.js.map +1 -0
  74. package/lib/constants/__mocks__/tracking-tag.d.ts +5 -0
  75. package/lib/constants/__mocks__/tracking-tag.d.ts.map +1 -0
  76. package/lib/constants/__mocks__/tracking-tag.js +9 -0
  77. package/lib/constants/__mocks__/tracking-tag.js.map +1 -0
  78. package/lib/constants/access.d.ts +18 -0
  79. package/lib/constants/access.d.ts.map +1 -0
  80. package/lib/constants/access.js +22 -0
  81. package/lib/constants/access.js.map +1 -0
  82. package/lib/constants/context-keys.d.ts +7 -0
  83. package/lib/constants/context-keys.d.ts.map +1 -0
  84. package/lib/constants/context-keys.js +10 -0
  85. package/lib/constants/context-keys.js.map +1 -0
  86. package/lib/constants/fastly-aws-account-id.d.ts +8 -0
  87. package/lib/constants/fastly-aws-account-id.d.ts.map +1 -0
  88. package/lib/constants/fastly-aws-account-id.js +11 -0
  89. package/lib/constants/fastly-aws-account-id.js.map +1 -0
  90. package/lib/constants/index.d.ts +9 -0
  91. package/lib/constants/index.d.ts.map +1 -0
  92. package/lib/constants/index.js +25 -0
  93. package/lib/constants/index.js.map +1 -0
  94. package/lib/constants/library-info.d.ts +28 -0
  95. package/lib/constants/library-info.d.ts.map +1 -0
  96. package/lib/constants/library-info.js +46 -0
  97. package/lib/constants/library-info.js.map +1 -0
  98. package/lib/constants/metadata-keys.d.ts +9 -0
  99. package/lib/constants/metadata-keys.d.ts.map +1 -0
  100. package/lib/constants/metadata-keys.js +12 -0
  101. package/lib/constants/metadata-keys.js.map +1 -0
  102. package/lib/constants/regex-pattern.d.ts +5 -0
  103. package/lib/constants/regex-pattern.d.ts.map +1 -0
  104. package/lib/constants/regex-pattern.js +11 -0
  105. package/lib/constants/regex-pattern.js.map +1 -0
  106. package/lib/constants/ssm-parameter-paths.d.ts +24 -0
  107. package/lib/constants/ssm-parameter-paths.d.ts.map +1 -0
  108. package/lib/constants/ssm-parameter-paths.js +56 -0
  109. package/lib/constants/ssm-parameter-paths.js.map +1 -0
  110. package/lib/constants/tracking-tag.d.ts +5 -0
  111. package/lib/constants/tracking-tag.d.ts.map +1 -0
  112. package/lib/constants/tracking-tag.js +10 -0
  113. package/lib/constants/tracking-tag.js.map +1 -0
  114. package/lib/constructs/acm/certificate.d.ts +24 -0
  115. package/lib/constructs/acm/certificate.d.ts.map +1 -0
  116. package/lib/constructs/acm/certificate.js +34 -0
  117. package/lib/constructs/acm/certificate.js.map +1 -0
  118. package/lib/constructs/acm/index.d.ts +2 -0
  119. package/lib/constructs/acm/index.d.ts.map +1 -0
  120. package/lib/constructs/acm/index.js +18 -0
  121. package/lib/constructs/acm/index.js.map +1 -0
  122. package/lib/constructs/autoscaling/asg.d.ts +75 -0
  123. package/lib/constructs/autoscaling/asg.d.ts.map +1 -0
  124. package/lib/constructs/autoscaling/asg.js +103 -0
  125. package/lib/constructs/autoscaling/asg.js.map +1 -0
  126. package/lib/constructs/autoscaling/index.d.ts +3 -0
  127. package/lib/constructs/autoscaling/index.d.ts.map +1 -0
  128. package/lib/constructs/autoscaling/index.js +19 -0
  129. package/lib/constructs/autoscaling/index.js.map +1 -0
  130. package/lib/constructs/autoscaling/user-data.d.ts +28 -0
  131. package/lib/constructs/autoscaling/user-data.d.ts.map +1 -0
  132. package/lib/constructs/autoscaling/user-data.js +66 -0
  133. package/lib/constructs/autoscaling/user-data.js.map +1 -0
  134. package/lib/constructs/cloudwatch/alarm.d.ts +35 -0
  135. package/lib/constructs/cloudwatch/alarm.d.ts.map +1 -0
  136. package/lib/constructs/cloudwatch/alarm.js +37 -0
  137. package/lib/constructs/cloudwatch/alarm.js.map +1 -0
  138. package/lib/constructs/cloudwatch/api-gateway-alarms.d.ts +17 -0
  139. package/lib/constructs/cloudwatch/api-gateway-alarms.d.ts.map +1 -0
  140. package/lib/constructs/cloudwatch/api-gateway-alarms.js +39 -0
  141. package/lib/constructs/cloudwatch/api-gateway-alarms.js.map +1 -0
  142. package/lib/constructs/cloudwatch/ec2-alarms.d.ts +36 -0
  143. package/lib/constructs/cloudwatch/ec2-alarms.d.ts.map +1 -0
  144. package/lib/constructs/cloudwatch/ec2-alarms.js +102 -0
  145. package/lib/constructs/cloudwatch/ec2-alarms.js.map +1 -0
  146. package/lib/constructs/cloudwatch/index.d.ts +5 -0
  147. package/lib/constructs/cloudwatch/index.d.ts.map +1 -0
  148. package/lib/constructs/cloudwatch/index.js +21 -0
  149. package/lib/constructs/cloudwatch/index.js.map +1 -0
  150. package/lib/constructs/cloudwatch/lambda-alarms.d.ts +43 -0
  151. package/lib/constructs/cloudwatch/lambda-alarms.d.ts.map +1 -0
  152. package/lib/constructs/cloudwatch/lambda-alarms.js +54 -0
  153. package/lib/constructs/cloudwatch/lambda-alarms.js.map +1 -0
  154. package/lib/constructs/cloudwatch/no-monitoring.d.ts +4 -0
  155. package/lib/constructs/cloudwatch/no-monitoring.d.ts.map +1 -0
  156. package/lib/constructs/cloudwatch/no-monitoring.js +3 -0
  157. package/lib/constructs/cloudwatch/no-monitoring.js.map +1 -0
  158. package/lib/constructs/core/identity.d.ts +16 -0
  159. package/lib/constructs/core/identity.d.ts.map +1 -0
  160. package/lib/constructs/core/identity.js +21 -0
  161. package/lib/constructs/core/identity.js.map +1 -0
  162. package/lib/constructs/core/index.d.ts +5 -0
  163. package/lib/constructs/core/index.d.ts.map +1 -0
  164. package/lib/constructs/core/index.js +21 -0
  165. package/lib/constructs/core/index.js.map +1 -0
  166. package/lib/constructs/core/migrating.d.ts +11 -0
  167. package/lib/constructs/core/migrating.d.ts.map +1 -0
  168. package/lib/constructs/core/migrating.js +3 -0
  169. package/lib/constructs/core/migrating.js.map +1 -0
  170. package/lib/constructs/core/parameters/acm.d.ts +7 -0
  171. package/lib/constructs/core/parameters/acm.d.ts.map +1 -0
  172. package/lib/constructs/core/parameters/acm.js +17 -0
  173. package/lib/constructs/core/parameters/acm.js.map +1 -0
  174. package/lib/constructs/core/parameters/anghammarad.d.ts +20 -0
  175. package/lib/constructs/core/parameters/anghammarad.d.ts.map +1 -0
  176. package/lib/constructs/core/parameters/anghammarad.js +35 -0
  177. package/lib/constructs/core/parameters/anghammarad.js.map +1 -0
  178. package/lib/constructs/core/parameters/base.d.ts +20 -0
  179. package/lib/constructs/core/parameters/base.d.ts.map +1 -0
  180. package/lib/constructs/core/parameters/base.js +33 -0
  181. package/lib/constructs/core/parameters/base.js.map +1 -0
  182. package/lib/constructs/core/parameters/ec2.d.ts +7 -0
  183. package/lib/constructs/core/parameters/ec2.d.ts.map +1 -0
  184. package/lib/constructs/core/parameters/ec2.js +16 -0
  185. package/lib/constructs/core/parameters/ec2.js.map +1 -0
  186. package/lib/constructs/core/parameters/fastly.d.ts +13 -0
  187. package/lib/constructs/core/parameters/fastly.d.ts.map +1 -0
  188. package/lib/constructs/core/parameters/fastly.js +28 -0
  189. package/lib/constructs/core/parameters/fastly.js.map +1 -0
  190. package/lib/constructs/core/parameters/index.d.ts +9 -0
  191. package/lib/constructs/core/parameters/index.d.ts.map +1 -0
  192. package/lib/constructs/core/parameters/index.js +25 -0
  193. package/lib/constructs/core/parameters/index.js.map +1 -0
  194. package/lib/constructs/core/parameters/log-shipping.d.ts +8 -0
  195. package/lib/constructs/core/parameters/log-shipping.d.ts.map +1 -0
  196. package/lib/constructs/core/parameters/log-shipping.js +23 -0
  197. package/lib/constructs/core/parameters/log-shipping.js.map +1 -0
  198. package/lib/constructs/core/parameters/s3.d.ts +25 -0
  199. package/lib/constructs/core/parameters/s3.d.ts.map +1 -0
  200. package/lib/constructs/core/parameters/s3.js +58 -0
  201. package/lib/constructs/core/parameters/s3.js.map +1 -0
  202. package/lib/constructs/core/parameters/vpc.d.ts +17 -0
  203. package/lib/constructs/core/parameters/vpc.d.ts.map +1 -0
  204. package/lib/constructs/core/parameters/vpc.js +35 -0
  205. package/lib/constructs/core/parameters/vpc.js.map +1 -0
  206. package/lib/constructs/core/stack.d.ts +166 -0
  207. package/lib/constructs/core/stack.d.ts.map +1 -0
  208. package/lib/constructs/core/stack.js +183 -0
  209. package/lib/constructs/core/stack.js.map +1 -0
  210. package/lib/constructs/dns/dns-records.d.ts +37 -0
  211. package/lib/constructs/dns/dns-records.d.ts.map +1 -0
  212. package/lib/constructs/dns/dns-records.js +75 -0
  213. package/lib/constructs/dns/dns-records.js.map +1 -0
  214. package/lib/constructs/dns/index.d.ts +2 -0
  215. package/lib/constructs/dns/index.d.ts.map +1 -0
  216. package/lib/constructs/dns/index.js +18 -0
  217. package/lib/constructs/dns/index.js.map +1 -0
  218. package/lib/constructs/dynamodb/dynamodb.d.ts +31 -0
  219. package/lib/constructs/dynamodb/dynamodb.d.ts.map +1 -0
  220. package/lib/constructs/dynamodb/dynamodb.js +18 -0
  221. package/lib/constructs/dynamodb/dynamodb.js.map +1 -0
  222. package/lib/constructs/dynamodb/index.d.ts +2 -0
  223. package/lib/constructs/dynamodb/index.d.ts.map +1 -0
  224. package/lib/constructs/dynamodb/index.js +18 -0
  225. package/lib/constructs/dynamodb/index.js.map +1 -0
  226. package/lib/constructs/ec2/index.d.ts +3 -0
  227. package/lib/constructs/ec2/index.d.ts.map +1 -0
  228. package/lib/constructs/ec2/index.js +19 -0
  229. package/lib/constructs/ec2/index.js.map +1 -0
  230. package/lib/constructs/ec2/security-groups/base.d.ts +60 -0
  231. package/lib/constructs/ec2/security-groups/base.d.ts.map +1 -0
  232. package/lib/constructs/ec2/security-groups/base.js +57 -0
  233. package/lib/constructs/ec2/security-groups/base.js.map +1 -0
  234. package/lib/constructs/ec2/security-groups/index.d.ts +2 -0
  235. package/lib/constructs/ec2/security-groups/index.d.ts.map +1 -0
  236. package/lib/constructs/ec2/security-groups/index.js +18 -0
  237. package/lib/constructs/ec2/security-groups/index.js.map +1 -0
  238. package/lib/constructs/ec2/vpc.d.ts +26 -0
  239. package/lib/constructs/ec2/vpc.d.ts.map +1 -0
  240. package/lib/constructs/ec2/vpc.js +76 -0
  241. package/lib/constructs/ec2/vpc.js.map +1 -0
  242. package/lib/constructs/ecs/ecs-task.d.ts +139 -0
  243. package/lib/constructs/ecs/ecs-task.d.ts.map +1 -0
  244. package/lib/constructs/ecs/ecs-task.js +169 -0
  245. package/lib/constructs/ecs/ecs-task.js.map +1 -0
  246. package/lib/constructs/ecs/index.d.ts +2 -0
  247. package/lib/constructs/ecs/index.d.ts.map +1 -0
  248. package/lib/constructs/ecs/index.js +18 -0
  249. package/lib/constructs/ecs/index.js.map +1 -0
  250. package/lib/constructs/iam/fastly-logs-iam.d.ts +38 -0
  251. package/lib/constructs/iam/fastly-logs-iam.d.ts.map +1 -0
  252. package/lib/constructs/iam/fastly-logs-iam.js +44 -0
  253. package/lib/constructs/iam/fastly-logs-iam.js.map +1 -0
  254. package/lib/constructs/iam/index.d.ts +4 -0
  255. package/lib/constructs/iam/index.d.ts.map +1 -0
  256. package/lib/constructs/iam/index.js +20 -0
  257. package/lib/constructs/iam/index.js.map +1 -0
  258. package/lib/constructs/iam/policies/anghammarad.d.ts +15 -0
  259. package/lib/constructs/iam/policies/anghammarad.d.ts.map +1 -0
  260. package/lib/constructs/iam/policies/anghammarad.js +30 -0
  261. package/lib/constructs/iam/policies/anghammarad.js.map +1 -0
  262. package/lib/constructs/iam/policies/assume-role.d.ts +10 -0
  263. package/lib/constructs/iam/policies/assume-role.d.ts.map +1 -0
  264. package/lib/constructs/iam/policies/assume-role.js +21 -0
  265. package/lib/constructs/iam/policies/assume-role.js.map +1 -0
  266. package/lib/constructs/iam/policies/base-policy.d.ts +20 -0
  267. package/lib/constructs/iam/policies/base-policy.d.ts.map +1 -0
  268. package/lib/constructs/iam/policies/base-policy.js +33 -0
  269. package/lib/constructs/iam/policies/base-policy.js.map +1 -0
  270. package/lib/constructs/iam/policies/cloudwatch.d.ts +14 -0
  271. package/lib/constructs/iam/policies/cloudwatch.d.ts.map +1 -0
  272. package/lib/constructs/iam/policies/cloudwatch.js +28 -0
  273. package/lib/constructs/iam/policies/cloudwatch.js.map +1 -0
  274. package/lib/constructs/iam/policies/describe-ec2.d.ts +8 -0
  275. package/lib/constructs/iam/policies/describe-ec2.d.ts.map +1 -0
  276. package/lib/constructs/iam/policies/describe-ec2.js +33 -0
  277. package/lib/constructs/iam/policies/describe-ec2.js.map +1 -0
  278. package/lib/constructs/iam/policies/dynamodb.d.ts +20 -0
  279. package/lib/constructs/iam/policies/dynamodb.d.ts.map +1 -0
  280. package/lib/constructs/iam/policies/dynamodb.js +32 -0
  281. package/lib/constructs/iam/policies/dynamodb.js.map +1 -0
  282. package/lib/constructs/iam/policies/index.d.ts +13 -0
  283. package/lib/constructs/iam/policies/index.d.ts.map +1 -0
  284. package/lib/constructs/iam/policies/index.js +29 -0
  285. package/lib/constructs/iam/policies/index.js.map +1 -0
  286. package/lib/constructs/iam/policies/kcl.d.ts +17 -0
  287. package/lib/constructs/iam/policies/kcl.d.ts.map +1 -0
  288. package/lib/constructs/iam/policies/kcl.js +60 -0
  289. package/lib/constructs/iam/policies/kcl.js.map +1 -0
  290. package/lib/constructs/iam/policies/log-shipping.d.ts +8 -0
  291. package/lib/constructs/iam/policies/log-shipping.d.ts.map +1 -0
  292. package/lib/constructs/iam/policies/log-shipping.js +24 -0
  293. package/lib/constructs/iam/policies/log-shipping.js.map +1 -0
  294. package/lib/constructs/iam/policies/parameter-store-read.d.ts +39 -0
  295. package/lib/constructs/iam/policies/parameter-store-read.d.ts.map +1 -0
  296. package/lib/constructs/iam/policies/parameter-store-read.js +73 -0
  297. package/lib/constructs/iam/policies/parameter-store-read.js.map +1 -0
  298. package/lib/constructs/iam/policies/s3-get-object.d.ts +57 -0
  299. package/lib/constructs/iam/policies/s3-get-object.d.ts.map +1 -0
  300. package/lib/constructs/iam/policies/s3-get-object.js +73 -0
  301. package/lib/constructs/iam/policies/s3-get-object.js.map +1 -0
  302. package/lib/constructs/iam/policies/s3-put-object.d.ts +11 -0
  303. package/lib/constructs/iam/policies/s3-put-object.d.ts.map +1 -0
  304. package/lib/constructs/iam/policies/s3-put-object.js +13 -0
  305. package/lib/constructs/iam/policies/s3-put-object.js.map +1 -0
  306. package/lib/constructs/iam/policies/ses.d.ts +15 -0
  307. package/lib/constructs/iam/policies/ses.d.ts.map +1 -0
  308. package/lib/constructs/iam/policies/ses.js +14 -0
  309. package/lib/constructs/iam/policies/ses.js.map +1 -0
  310. package/lib/constructs/iam/policies/ssm-ssh.d.ts +19 -0
  311. package/lib/constructs/iam/policies/ssm-ssh.d.ts.map +1 -0
  312. package/lib/constructs/iam/policies/ssm-ssh.js +49 -0
  313. package/lib/constructs/iam/policies/ssm-ssh.js.map +1 -0
  314. package/lib/constructs/iam/roles/github-actions.d.ts +41 -0
  315. package/lib/constructs/iam/roles/github-actions.d.ts.map +1 -0
  316. package/lib/constructs/iam/roles/github-actions.js +77 -0
  317. package/lib/constructs/iam/roles/github-actions.js.map +1 -0
  318. package/lib/constructs/iam/roles/index.d.ts +4 -0
  319. package/lib/constructs/iam/roles/index.d.ts.map +1 -0
  320. package/lib/constructs/iam/roles/index.js +20 -0
  321. package/lib/constructs/iam/roles/index.js.map +1 -0
  322. package/lib/constructs/iam/roles/instance-role.d.ts +38 -0
  323. package/lib/constructs/iam/roles/instance-role.d.ts.map +1 -0
  324. package/lib/constructs/iam/roles/instance-role.js +45 -0
  325. package/lib/constructs/iam/roles/instance-role.js.map +1 -0
  326. package/lib/constructs/iam/roles/roles.d.ts +8 -0
  327. package/lib/constructs/iam/roles/roles.d.ts.map +1 -0
  328. package/lib/constructs/iam/roles/roles.js +11 -0
  329. package/lib/constructs/iam/roles/roles.js.map +1 -0
  330. package/lib/constructs/kinesis/index.d.ts +2 -0
  331. package/lib/constructs/kinesis/index.d.ts.map +1 -0
  332. package/lib/constructs/kinesis/index.js +18 -0
  333. package/lib/constructs/kinesis/index.js.map +1 -0
  334. package/lib/constructs/kinesis/kinesis-stream.d.ts +14 -0
  335. package/lib/constructs/kinesis/kinesis-stream.d.ts.map +1 -0
  336. package/lib/constructs/kinesis/kinesis-stream.js +17 -0
  337. package/lib/constructs/kinesis/kinesis-stream.js.map +1 -0
  338. package/lib/constructs/lambda/index.d.ts +2 -0
  339. package/lib/constructs/lambda/index.d.ts.map +1 -0
  340. package/lib/constructs/lambda/index.js +18 -0
  341. package/lib/constructs/lambda/index.js.map +1 -0
  342. package/lib/constructs/lambda/lambda.d.ts +95 -0
  343. package/lib/constructs/lambda/lambda.d.ts.map +1 -0
  344. package/lib/constructs/lambda/lambda.js +115 -0
  345. package/lib/constructs/lambda/lambda.js.map +1 -0
  346. package/lib/constructs/loadbalancing/alb/application-listener.d.ts +49 -0
  347. package/lib/constructs/loadbalancing/alb/application-listener.d.ts.map +1 -0
  348. package/lib/constructs/loadbalancing/alb/application-listener.js +53 -0
  349. package/lib/constructs/loadbalancing/alb/application-listener.js.map +1 -0
  350. package/lib/constructs/loadbalancing/alb/application-load-balancer.d.ts +63 -0
  351. package/lib/constructs/loadbalancing/alb/application-load-balancer.d.ts.map +1 -0
  352. package/lib/constructs/loadbalancing/alb/application-load-balancer.js +70 -0
  353. package/lib/constructs/loadbalancing/alb/application-load-balancer.js.map +1 -0
  354. package/lib/constructs/loadbalancing/alb/application-target-group.d.ts +42 -0
  355. package/lib/constructs/loadbalancing/alb/application-target-group.d.ts.map +1 -0
  356. package/lib/constructs/loadbalancing/alb/application-target-group.js +64 -0
  357. package/lib/constructs/loadbalancing/alb/application-target-group.js.map +1 -0
  358. package/lib/constructs/loadbalancing/alb/index.d.ts +4 -0
  359. package/lib/constructs/loadbalancing/alb/index.d.ts.map +1 -0
  360. package/lib/constructs/loadbalancing/alb/index.js +20 -0
  361. package/lib/constructs/loadbalancing/alb/index.js.map +1 -0
  362. package/lib/constructs/loadbalancing/index.d.ts +2 -0
  363. package/lib/constructs/loadbalancing/index.d.ts.map +1 -0
  364. package/lib/constructs/loadbalancing/index.js +18 -0
  365. package/lib/constructs/loadbalancing/index.js.map +1 -0
  366. package/lib/constructs/rds/index.d.ts +2 -0
  367. package/lib/constructs/rds/index.d.ts.map +1 -0
  368. package/lib/constructs/rds/index.js +18 -0
  369. package/lib/constructs/rds/index.js.map +1 -0
  370. package/lib/constructs/rds/instance.d.ts +33 -0
  371. package/lib/constructs/rds/instance.d.ts.map +1 -0
  372. package/lib/constructs/rds/instance.js +27 -0
  373. package/lib/constructs/rds/instance.js.map +1 -0
  374. package/lib/constructs/root.d.ts +32 -0
  375. package/lib/constructs/root.d.ts.map +1 -0
  376. package/lib/constructs/root.js +46 -0
  377. package/lib/constructs/root.js.map +1 -0
  378. package/lib/constructs/s3/index.d.ts +18 -0
  379. package/lib/constructs/s3/index.d.ts.map +1 -0
  380. package/lib/constructs/s3/index.js +21 -0
  381. package/lib/constructs/s3/index.js.map +1 -0
  382. package/lib/constructs/ses/index.d.ts +35 -0
  383. package/lib/constructs/ses/index.d.ts.map +1 -0
  384. package/lib/constructs/ses/index.js +52 -0
  385. package/lib/constructs/ses/index.js.map +1 -0
  386. package/lib/constructs/vpc/index.d.ts +2 -0
  387. package/lib/constructs/vpc/index.d.ts.map +1 -0
  388. package/lib/constructs/vpc/index.js +18 -0
  389. package/lib/constructs/vpc/index.js.map +1 -0
  390. package/lib/constructs/vpc/vpc.d.ts +57 -0
  391. package/lib/constructs/vpc/vpc.d.ts.map +1 -0
  392. package/lib/constructs/vpc/vpc.js +91 -0
  393. package/lib/constructs/vpc/vpc.js.map +1 -0
  394. package/lib/experimental/constructs/iam/index.d.ts +2 -0
  395. package/lib/experimental/constructs/iam/index.d.ts.map +1 -0
  396. package/lib/experimental/constructs/iam/index.js +18 -0
  397. package/lib/experimental/constructs/iam/index.js.map +1 -0
  398. package/lib/experimental/constructs/iam/policies/developer-policy.d.ts +63 -0
  399. package/lib/experimental/constructs/iam/policies/developer-policy.d.ts.map +1 -0
  400. package/lib/experimental/constructs/iam/policies/developer-policy.js +150 -0
  401. package/lib/experimental/constructs/iam/policies/developer-policy.js.map +1 -0
  402. package/lib/experimental/constructs/iam/policies/index.d.ts +2 -0
  403. package/lib/experimental/constructs/iam/policies/index.d.ts.map +1 -0
  404. package/lib/experimental/constructs/iam/policies/index.js +18 -0
  405. package/lib/experimental/constructs/iam/policies/index.js.map +1 -0
  406. package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.d.ts +30 -0
  407. package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.d.ts.map +1 -0
  408. package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.js +34 -0
  409. package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.js.map +1 -0
  410. package/lib/experimental/constructs/iam/roles/index.d.ts +2 -0
  411. package/lib/experimental/constructs/iam/roles/index.d.ts.map +1 -0
  412. package/lib/experimental/constructs/iam/roles/index.js +18 -0
  413. package/lib/experimental/constructs/iam/roles/index.js.map +1 -0
  414. package/lib/experimental/constructs/policies/index.d.ts +2 -0
  415. package/lib/experimental/constructs/policies/index.d.ts.map +1 -0
  416. package/lib/experimental/constructs/policies/index.js +18 -0
  417. package/lib/experimental/constructs/policies/index.js.map +1 -0
  418. package/lib/experimental/constructs/policies/kinesis-put-records.d.ts +11 -0
  419. package/lib/experimental/constructs/policies/kinesis-put-records.d.ts.map +1 -0
  420. package/lib/experimental/constructs/policies/kinesis-put-records.js +12 -0
  421. package/lib/experimental/constructs/policies/kinesis-put-records.js.map +1 -0
  422. package/lib/experimental/constructs/riff-raff-deployment-id.d.ts +8 -0
  423. package/lib/experimental/constructs/riff-raff-deployment-id.d.ts.map +1 -0
  424. package/lib/experimental/constructs/riff-raff-deployment-id.js +21 -0
  425. package/lib/experimental/constructs/riff-raff-deployment-id.js.map +1 -0
  426. package/lib/experimental/patterns/ec2-app.d.ts +175 -0
  427. package/lib/experimental/patterns/ec2-app.d.ts.map +1 -0
  428. package/lib/experimental/patterns/ec2-app.js +412 -0
  429. package/lib/experimental/patterns/ec2-app.js.map +1 -0
  430. package/lib/experimental/patterns/gu-load-balanced-app.d.ts +360 -0
  431. package/lib/experimental/patterns/gu-load-balanced-app.d.ts.map +1 -0
  432. package/lib/experimental/patterns/gu-load-balanced-app.js +520 -0
  433. package/lib/experimental/patterns/gu-load-balanced-app.js.map +1 -0
  434. package/lib/experimental/patterns/index.d.ts +3 -0
  435. package/lib/experimental/patterns/index.d.ts.map +1 -0
  436. package/lib/experimental/patterns/index.js +19 -0
  437. package/lib/experimental/patterns/index.js.map +1 -0
  438. package/lib/experimental/patterns/kinesis-lambda.d.ts +75 -0
  439. package/lib/experimental/patterns/kinesis-lambda.d.ts.map +1 -0
  440. package/lib/experimental/patterns/kinesis-lambda.js +48 -0
  441. package/lib/experimental/patterns/kinesis-lambda.js.map +1 -0
  442. package/lib/experimental/patterns/sns-lambda.d.ts +62 -0
  443. package/lib/experimental/patterns/sns-lambda.d.ts.map +1 -0
  444. package/lib/experimental/patterns/sns-lambda.js +41 -0
  445. package/lib/experimental/patterns/sns-lambda.js.map +1 -0
  446. package/lib/index.d.ts +2 -0
  447. package/lib/index.d.ts.map +1 -0
  448. package/lib/index.js +18 -0
  449. package/lib/index.js.map +1 -0
  450. package/lib/patterns/api-lambda.d.ts +61 -0
  451. package/lib/patterns/api-lambda.d.ts.map +1 -0
  452. package/lib/patterns/api-lambda.js +62 -0
  453. package/lib/patterns/api-lambda.js.map +1 -0
  454. package/lib/patterns/api-multiple-lambdas.d.ts +122 -0
  455. package/lib/patterns/api-multiple-lambdas.d.ts.map +1 -0
  456. package/lib/patterns/api-multiple-lambdas.js +93 -0
  457. package/lib/patterns/api-multiple-lambdas.js.map +1 -0
  458. package/lib/patterns/ec2-app/base.d.ts +325 -0
  459. package/lib/patterns/ec2-app/base.d.ts.map +1 -0
  460. package/lib/patterns/ec2-app/base.js +273 -0
  461. package/lib/patterns/ec2-app/base.js.map +1 -0
  462. package/lib/patterns/ec2-app/framework.d.ts +32 -0
  463. package/lib/patterns/ec2-app/framework.d.ts.map +1 -0
  464. package/lib/patterns/ec2-app/framework.js +46 -0
  465. package/lib/patterns/ec2-app/framework.js.map +1 -0
  466. package/lib/patterns/ec2-app/index.d.ts +3 -0
  467. package/lib/patterns/ec2-app/index.d.ts.map +1 -0
  468. package/lib/patterns/ec2-app/index.js +19 -0
  469. package/lib/patterns/ec2-app/index.js.map +1 -0
  470. package/lib/patterns/index.d.ts +6 -0
  471. package/lib/patterns/index.d.ts.map +1 -0
  472. package/lib/patterns/index.js +22 -0
  473. package/lib/patterns/index.js.map +1 -0
  474. package/lib/patterns/scheduled-ecs-task.d.ts +36 -0
  475. package/lib/patterns/scheduled-ecs-task.d.ts.map +1 -0
  476. package/lib/patterns/scheduled-ecs-task.js +30 -0
  477. package/lib/patterns/scheduled-ecs-task.js.map +1 -0
  478. package/lib/patterns/scheduled-lambda.d.ts +42 -0
  479. package/lib/patterns/scheduled-lambda.d.ts.map +1 -0
  480. package/lib/patterns/scheduled-lambda.js +33 -0
  481. package/lib/patterns/scheduled-lambda.js.map +1 -0
  482. package/lib/riff-raff-yaml-file/deployments/autoscaling.d.ts +5 -0
  483. package/lib/riff-raff-yaml-file/deployments/autoscaling.d.ts.map +1 -0
  484. package/lib/riff-raff-yaml-file/deployments/autoscaling.js +44 -0
  485. package/lib/riff-raff-yaml-file/deployments/autoscaling.js.map +1 -0
  486. package/lib/riff-raff-yaml-file/deployments/cloudformation.d.ts +7 -0
  487. package/lib/riff-raff-yaml-file/deployments/cloudformation.d.ts.map +1 -0
  488. package/lib/riff-raff-yaml-file/deployments/cloudformation.js +64 -0
  489. package/lib/riff-raff-yaml-file/deployments/cloudformation.js.map +1 -0
  490. package/lib/riff-raff-yaml-file/deployments/lambda.d.ts +5 -0
  491. package/lib/riff-raff-yaml-file/deployments/lambda.d.ts.map +1 -0
  492. package/lib/riff-raff-yaml-file/deployments/lambda.js +71 -0
  493. package/lib/riff-raff-yaml-file/deployments/lambda.js.map +1 -0
  494. package/lib/riff-raff-yaml-file/deployments/update-parameters.d.ts +3 -0
  495. package/lib/riff-raff-yaml-file/deployments/update-parameters.d.ts.map +1 -0
  496. package/lib/riff-raff-yaml-file/deployments/update-parameters.js +17 -0
  497. package/lib/riff-raff-yaml-file/deployments/update-parameters.js.map +1 -0
  498. package/lib/riff-raff-yaml-file/group-by.d.ts +8 -0
  499. package/lib/riff-raff-yaml-file/group-by.d.ts.map +1 -0
  500. package/lib/riff-raff-yaml-file/group-by.js +25 -0
  501. package/lib/riff-raff-yaml-file/group-by.js.map +1 -0
  502. package/lib/riff-raff-yaml-file/index.d.ts +71 -0
  503. package/lib/riff-raff-yaml-file/index.d.ts.map +1 -0
  504. package/lib/riff-raff-yaml-file/index.js +244 -0
  505. package/lib/riff-raff-yaml-file/index.js.map +1 -0
  506. package/lib/riff-raff-yaml-file/types.d.ts +35 -0
  507. package/lib/riff-raff-yaml-file/types.d.ts.map +1 -0
  508. package/lib/riff-raff-yaml-file/types.js +10 -0
  509. package/lib/riff-raff-yaml-file/types.js.map +1 -0
  510. package/lib/types/access.d.ts +66 -0
  511. package/lib/types/access.d.ts.map +1 -0
  512. package/lib/types/access.js +39 -0
  513. package/lib/types/access.js.map +1 -0
  514. package/lib/types/amigo.d.ts +17 -0
  515. package/lib/types/amigo.d.ts.map +1 -0
  516. package/lib/types/amigo.js +3 -0
  517. package/lib/types/amigo.js.map +1 -0
  518. package/lib/types/asg.d.ts +19 -0
  519. package/lib/types/asg.d.ts.map +1 -0
  520. package/lib/types/asg.js +3 -0
  521. package/lib/types/asg.js.map +1 -0
  522. package/lib/types/cli.d.ts +12 -0
  523. package/lib/types/cli.d.ts.map +1 -0
  524. package/lib/types/cli.js +3 -0
  525. package/lib/types/cli.js.map +1 -0
  526. package/lib/types/distributable.d.ts +19 -0
  527. package/lib/types/distributable.d.ts.map +1 -0
  528. package/lib/types/distributable.js +9 -0
  529. package/lib/types/distributable.js.map +1 -0
  530. package/lib/types/domain-names.d.ts +15 -0
  531. package/lib/types/domain-names.d.ts.map +1 -0
  532. package/lib/types/domain-names.js +3 -0
  533. package/lib/types/domain-names.js.map +1 -0
  534. package/lib/types/index.d.ts +5 -0
  535. package/lib/types/index.d.ts.map +1 -0
  536. package/lib/types/index.js +21 -0
  537. package/lib/types/index.js.map +1 -0
  538. package/lib/utils/array.d.ts +7 -0
  539. package/lib/utils/array.d.ts.map +1 -0
  540. package/lib/utils/array.js +19 -0
  541. package/lib/utils/array.js.map +1 -0
  542. package/lib/utils/cli/vpc.d.ts +8 -0
  543. package/lib/utils/cli/vpc.d.ts.map +1 -0
  544. package/lib/utils/cli/vpc.js +74 -0
  545. package/lib/utils/cli/vpc.js.map +1 -0
  546. package/lib/utils/cognito/cognito.d.ts +2 -0
  547. package/lib/utils/cognito/cognito.d.ts.map +1 -0
  548. package/lib/utils/cognito/cognito.js +19 -0
  549. package/lib/utils/cognito/cognito.js.map +1 -0
  550. package/lib/utils/ec2/index.d.ts +2 -0
  551. package/lib/utils/ec2/index.d.ts.map +1 -0
  552. package/lib/utils/ec2/index.js +18 -0
  553. package/lib/utils/ec2/index.js.map +1 -0
  554. package/lib/utils/ec2/private-config.d.ts +11 -0
  555. package/lib/utils/ec2/private-config.d.ts.map +1 -0
  556. package/lib/utils/ec2/private-config.js +3 -0
  557. package/lib/utils/ec2/private-config.js.map +1 -0
  558. package/lib/utils/exec.d.ts +7 -0
  559. package/lib/utils/exec.d.ts.map +1 -0
  560. package/lib/utils/exec.js +46 -0
  561. package/lib/utils/exec.js.map +1 -0
  562. package/lib/utils/git.d.ts +3 -0
  563. package/lib/utils/git.d.ts.map +1 -0
  564. package/lib/utils/git.js +23 -0
  565. package/lib/utils/git.js.map +1 -0
  566. package/lib/utils/lambda/event-source.d.ts +52 -0
  567. package/lib/utils/lambda/event-source.d.ts.map +1 -0
  568. package/lib/utils/lambda/event-source.js +41 -0
  569. package/lib/utils/lambda/event-source.js.map +1 -0
  570. package/lib/utils/lambda/index.d.ts +2 -0
  571. package/lib/utils/lambda/index.d.ts.map +1 -0
  572. package/lib/utils/lambda/index.js +18 -0
  573. package/lib/utils/lambda/index.js.map +1 -0
  574. package/lib/utils/math.d.ts +2 -0
  575. package/lib/utils/math.d.ts.map +1 -0
  576. package/lib/utils/math.js +6 -0
  577. package/lib/utils/math.js.map +1 -0
  578. package/lib/utils/mixin/app-aware-construct.d.ts +11 -0
  579. package/lib/utils/mixin/app-aware-construct.d.ts.map +1 -0
  580. package/lib/utils/mixin/app-aware-construct.js +35 -0
  581. package/lib/utils/mixin/app-aware-construct.js.map +1 -0
  582. package/lib/utils/mixin/types.d.ts +2 -0
  583. package/lib/utils/mixin/types.d.ts.map +1 -0
  584. package/lib/utils/mixin/types.js +3 -0
  585. package/lib/utils/mixin/types.js.map +1 -0
  586. package/lib/utils/security-groups/helpers.d.ts +4 -0
  587. package/lib/utils/security-groups/helpers.d.ts.map +1 -0
  588. package/lib/utils/security-groups/helpers.js +15 -0
  589. package/lib/utils/security-groups/helpers.js.map +1 -0
  590. package/lib/utils/security-groups/index.d.ts +2 -0
  591. package/lib/utils/security-groups/index.d.ts.map +1 -0
  592. package/lib/utils/security-groups/index.js +18 -0
  593. package/lib/utils/security-groups/index.js.map +1 -0
  594. package/lib/utils/singleton.d.ts +40 -0
  595. package/lib/utils/singleton.d.ts.map +1 -0
  596. package/lib/utils/singleton.js +43 -0
  597. package/lib/utils/singleton.js.map +1 -0
  598. package/lib/utils/string.d.ts +3 -0
  599. package/lib/utils/string.d.ts.map +1 -0
  600. package/lib/utils/string.js +19 -0
  601. package/lib/utils/string.js.map +1 -0
  602. package/lib/utils/test/assertions.d.ts +24 -0
  603. package/lib/utils/test/assertions.d.ts.map +1 -0
  604. package/lib/utils/test/assertions.js +88 -0
  605. package/lib/utils/test/assertions.js.map +1 -0
  606. package/lib/utils/test/attach-policy-to-test-role.d.ts +4 -0
  607. package/lib/utils/test/attach-policy-to-test-role.d.ts.map +1 -0
  608. package/lib/utils/test/attach-policy-to-test-role.js +15 -0
  609. package/lib/utils/test/attach-policy-to-test-role.js.map +1 -0
  610. package/lib/utils/test/index.d.ts +5 -0
  611. package/lib/utils/test/index.d.ts.map +1 -0
  612. package/lib/utils/test/index.js +21 -0
  613. package/lib/utils/test/index.js.map +1 -0
  614. package/lib/utils/test/simple-gu-stack.d.ts +4 -0
  615. package/lib/utils/test/simple-gu-stack.d.ts.map +1 -0
  616. package/lib/utils/test/simple-gu-stack.js +13 -0
  617. package/lib/utils/test/simple-gu-stack.js.map +1 -0
  618. package/lib/utils/test/template.d.ts +12 -0
  619. package/lib/utils/test/template.d.ts.map +1 -0
  620. package/lib/utils/test/template.js +28 -0
  621. package/lib/utils/test/template.js.map +1 -0
  622. package/package.json +72 -0
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Guardian CDK Library
2
+
3
+ ![npm][badge-npm] [![CD][badge-cd]][internal-cd-file]
4
+
5
+ [badge-cd]: https://github.com/guardian/cdk/actions/workflows/cd.yaml/badge.svg
6
+ [badge-npm]: https://img.shields.io/npm/v/@guardian/cdk?style=flat-square
7
+ [internal-cd-file]: https://github.com/guardian/cdk/actions/workflows/cd.yaml
8
+
9
+ The [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) (AWS CDK) is an open-source software
10
+ development framework to define cloud infrastructure in code and provision it
11
+ through AWS CloudFormation.
12
+
13
+ `@guardian/cdk` builds on CDK to provide Guardian-specific [patterns](./src/patterns) and
14
+ [constructs](./src/constructs). It is an opinionated and secure-by-default way to describe and
15
+ provision your AWS resources.
16
+
17
+ Jump to:
18
+
19
+ - [Quickstart](#quickstart)
20
+ - [CDK demo including screencast](https://github.com/guardian/cdk-demo)
21
+ - [Setting up a new project](./docs/setting-up-a-gucdk-project.md)
22
+ - [Migrating an existing Cloudformation template](./docs/migration-guide.md)
23
+ - View the [typedocs](https://guardian.github.io/cdk/)
24
+ - [Contributing](#contributing) to `@guardian/cdk`
25
+ - [Best practices](./docs/best-practices.md)
26
+
27
+ ## Quickstart
28
+
29
+ `@guardian/cdk` expects certain Parameter Store values to be present - for
30
+ example, VPC IDs, and the location of dist buckets. To check for account
31
+ readiness and fix any issues, run:
32
+
33
+ npx @guardian/cdk@latest account-readiness --profile [profile]
34
+
35
+ Once you've confirmed that your account is ready, you can start provisioning your infrastructure.
36
+
37
+ > Tip: Setting up a new project? [Start here!](./docs/setting-up-a-gucdk-project.md)
38
+
39
+ > Tip: Migrating an app? See the [Migration Guide](./docs/migration-guide.md) for more detail.
40
+
41
+ > Tip: New to CDK? The [AWS CDK Developer Guide](https://docs.aws.amazon.com/cdk/v2/guide/home.html) is worth a read.
42
+
43
+ ## Contributing
44
+
45
+ We welcome contributions to `@guardian/cdk`!
46
+
47
+ To get started, please read our [Contribution Guidelines](./docs/contributing.md).
48
+
49
+ > [!NOTE]
50
+ > This repository uses the GitHub App [guardian/cdk](https://github.com/organizations/guardian/settings/apps/guardian-cdk) (requires GitHub admin) for various automations.
package/bin/gu-cdk ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ // The file `index.js` is created at build time.
4
+ // To use the CLI locally run `./script/cli`.
5
+ require('../lib/bin/index.js');
@@ -0,0 +1,9 @@
1
+ import type { IAspect } from "aws-cdk-lib";
2
+ import type { IConstruct } from "constructs";
3
+ /**
4
+ * An Aspect to remind users to check for stateful resources when migrating a YAML/JSON template.
5
+ */
6
+ export declare class CfnIncludeReporter implements IAspect {
7
+ visit(node: IConstruct): void;
8
+ }
9
+ //# sourceMappingURL=cfn-include-reporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cfn-include-reporter.d.ts","sourceRoot":"","sources":["../../src/aspects/cfn-include-reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C;;GAEG;AACH,qBAAa,kBAAmB,YAAW,OAAO;IACzC,KAAK,CAAC,IAAI,EAAE,UAAU;CAO9B"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CfnIncludeReporter = void 0;
4
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
5
+ const cloudformation_include_1 = require("aws-cdk-lib/cloudformation-include");
6
+ const constants_1 = require("../constants");
7
+ /**
8
+ * An Aspect to remind users to check for stateful resources when migrating a YAML/JSON template.
9
+ */
10
+ class CfnIncludeReporter {
11
+ visit(node) {
12
+ if (node instanceof cloudformation_include_1.CfnInclude) {
13
+ aws_cdk_lib_1.Annotations.of(node).addWarning(`As you're migrating a YAML/JSON template to ${constants_1.LibraryInfo.NAME}, be sure to check for any stateful resources! See https://github.com/guardian/cdk/blob/main/docs/stateful-resources.md.`);
14
+ }
15
+ }
16
+ }
17
+ exports.CfnIncludeReporter = CfnIncludeReporter;
18
+ //# sourceMappingURL=cfn-include-reporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cfn-include-reporter.js","sourceRoot":"","sources":["../../src/aspects/cfn-include-reporter.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAC1C,+EAAgE;AAEhE,4CAA2C;AAE3C;;GAEG;AACH,MAAa,kBAAkB;IACtB,KAAK,CAAC,IAAgB;QAC3B,IAAI,IAAI,YAAY,mCAAU,EAAE,CAAC;YAC/B,yBAAW,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,CAC7B,+CAA+C,uBAAW,CAAC,IAAI,0HAA0H,CAC1L,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AARD,gDAQC","sourcesContent":["import type { IAspect } from \"aws-cdk-lib\";\nimport { Annotations } from \"aws-cdk-lib\";\nimport { CfnInclude } from \"aws-cdk-lib/cloudformation-include\";\nimport type { IConstruct } from \"constructs\";\nimport { LibraryInfo } from \"../constants\";\n\n/**\n * An Aspect to remind users to check for stateful resources when migrating a YAML/JSON template.\n */\nexport class CfnIncludeReporter implements IAspect {\n public visit(node: IConstruct) {\n if (node instanceof CfnInclude) {\n Annotations.of(node).addWarning(\n `As you're migrating a YAML/JSON template to ${LibraryInfo.NAME}, be sure to check for any stateful resources! See https://github.com/guardian/cdk/blob/main/docs/stateful-resources.md.`,\n );\n }\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { IAspect } from "aws-cdk-lib";
2
+ import type { IConstruct } from "constructs";
3
+ /**
4
+ * An Aspect to remind users to check Parameters to ensure Riff-Raff can successfully deploy the stack.
5
+ */
6
+ export declare class CfnParameterReporter implements IAspect {
7
+ visit(node: IConstruct): void;
8
+ }
9
+ //# sourceMappingURL=cfn-parameter-reporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cfn-parameter-reporter.d.ts","sourceRoot":"","sources":["../../src/aspects/cfn-parameter-reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;GAEG;AACH,qBAAa,oBAAqB,YAAW,OAAO;IAC3C,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;CAarC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CfnParameterReporter = void 0;
4
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
5
+ /**
6
+ * An Aspect to remind users to check Parameters to ensure Riff-Raff can successfully deploy the stack.
7
+ */
8
+ class CfnParameterReporter {
9
+ visit(node) {
10
+ if (node instanceof aws_cdk_lib_1.CfnParameter) {
11
+ const defaultValue = node.default;
12
+ const hasDefault = !!defaultValue;
13
+ const isSsmParameter = node.type.startsWith("AWS::SSM::Parameter::Value");
14
+ if (isSsmParameter && hasDefault) {
15
+ aws_cdk_lib_1.Annotations.of(node.stack).addInfo(`Stack reads the SSM Parameter '${defaultValue}'. Ensure it exists prior to deployment.`);
16
+ }
17
+ }
18
+ }
19
+ }
20
+ exports.CfnParameterReporter = CfnParameterReporter;
21
+ //# sourceMappingURL=cfn-parameter-reporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cfn-parameter-reporter.js","sourceRoot":"","sources":["../../src/aspects/cfn-parameter-reporter.ts"],"names":[],"mappings":";;;AACA,6CAAwD;AAGxD;;GAEG;AACH,MAAa,oBAAoB;IACxB,KAAK,CAAC,IAAgB;QAC3B,IAAI,IAAI,YAAY,0BAAY,EAAE,CAAC;YACjC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAiB,CAAC;YAC5C,MAAM,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC;YAClC,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAC;YAE1E,IAAI,cAAc,IAAI,UAAU,EAAE,CAAC;gBACjC,yBAAW,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAChC,kCAAkC,YAAY,0CAA0C,CACzF,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAdD,oDAcC","sourcesContent":["import type { IAspect } from \"aws-cdk-lib\";\nimport { Annotations, CfnParameter } from \"aws-cdk-lib\";\nimport type { IConstruct } from \"constructs\";\n\n/**\n * An Aspect to remind users to check Parameters to ensure Riff-Raff can successfully deploy the stack.\n */\nexport class CfnParameterReporter implements IAspect {\n public visit(node: IConstruct): void {\n if (node instanceof CfnParameter) {\n const defaultValue = node.default as string;\n const hasDefault = !!defaultValue;\n const isSsmParameter = node.type.startsWith(\"AWS::SSM::Parameter::Value\");\n\n if (isSsmParameter && hasDefault) {\n Annotations.of(node.stack).addInfo(\n `Stack reads the SSM Parameter '${defaultValue}'. Ensure it exists prior to deployment.`,\n );\n }\n }\n }\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import type { IAspect, Stack } from "aws-cdk-lib";
2
+ import type { IConstruct } from "constructs";
3
+ export declare class Metadata implements IAspect {
4
+ readonly stack: Stack;
5
+ constructor(s: Stack);
6
+ visit(node: IConstruct): void;
7
+ }
8
+ //# sourceMappingURL=metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/aspects/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,qBAAa,QAAS,YAAW,OAAO;IACtC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;gBAGH,CAAC,EAAE,KAAK;IAapB,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;CASrC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Metadata = void 0;
4
+ const constants_1 = require("../constants");
5
+ class Metadata {
6
+ // eslint-disable-next-line custom-rules/valid-constructors -- doesn't apply here
7
+ constructor(s) {
8
+ this.stack = s;
9
+ this.stack.templateOptions.metadata = {
10
+ [constants_1.MetadataKeys.CONSTRUCTS_KEY]: [],
11
+ /*
12
+ `TrackingTag.Value` is a proxy to `LibraryInfo.VERSION`.
13
+ Intentionally using `TrackingTag.Value` so that the published mock can be used.
14
+ */
15
+ [constants_1.MetadataKeys.VERSION]: constants_1.TrackingTag.Value,
16
+ };
17
+ }
18
+ visit(node) {
19
+ const metadata = this.stack.templateOptions.metadata;
20
+ const name = node.constructor.name;
21
+ // We assume any construct named Gu* is part of our public API.
22
+ if (metadata && name.startsWith("Gu")) {
23
+ metadata[constants_1.MetadataKeys.CONSTRUCTS_KEY].push(name);
24
+ }
25
+ }
26
+ }
27
+ exports.Metadata = Metadata;
28
+ //# sourceMappingURL=metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/aspects/metadata.ts"],"names":[],"mappings":";;;AAEA,4CAAyD;AAEzD,MAAa,QAAQ;IAGnB,iFAAiF;IACjF,YAAmB,CAAQ;QACzB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,QAAQ,GAAG;YACpC,CAAC,wBAAY,CAAC,cAAc,CAAC,EAAE,EAAE;YAEjC;;;eAGG;YACH,CAAC,wBAAY,CAAC,OAAO,CAAC,EAAE,uBAAW,CAAC,KAAK;SAC1C,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,IAAgB;QAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC;QACrD,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAEnC,+DAA+D;QAC/D,IAAI,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,QAAQ,CAAC,wBAAY,CAAC,cAAc,CAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;CACF;AA1BD,4BA0BC","sourcesContent":["import type { IAspect, Stack } from \"aws-cdk-lib\";\nimport type { IConstruct } from \"constructs\";\nimport { MetadataKeys, TrackingTag } from \"../constants\";\n\nexport class Metadata implements IAspect {\n readonly stack: Stack;\n\n // eslint-disable-next-line custom-rules/valid-constructors -- doesn't apply here\n public constructor(s: Stack) {\n this.stack = s;\n this.stack.templateOptions.metadata = {\n [MetadataKeys.CONSTRUCTS_KEY]: [],\n\n /*\n `TrackingTag.Value` is a proxy to `LibraryInfo.VERSION`.\n Intentionally using `TrackingTag.Value` so that the published mock can be used.\n */\n [MetadataKeys.VERSION]: TrackingTag.Value,\n };\n }\n\n public visit(node: IConstruct): void {\n const metadata = this.stack.templateOptions.metadata;\n const name = node.constructor.name;\n\n // We assume any construct named Gu* is part of our public API.\n if (metadata && name.startsWith(\"Gu\")) {\n (metadata[MetadataKeys.CONSTRUCTS_KEY] as string[]).push(name);\n }\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { AwsCredentialIdentityProvider } from "@aws-sdk/types";
2
+ export declare const awsCredentialProviderChain: (profile: string | undefined) => AwsCredentialIdentityProvider;
3
+ //# sourceMappingURL=aws-credential-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws-credential-provider.d.ts","sourceRoot":"","sources":["../../src/bin/aws-credential-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAEpE,eAAO,MAAM,0BAA0B,GAAI,SAAS,MAAM,GAAG,SAAS,KAAG,6BAExE,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.awsCredentialProviderChain = void 0;
4
+ const credential_providers_1 = require("@aws-sdk/credential-providers");
5
+ const awsCredentialProviderChain = (profile) => {
6
+ return profile ? (0, credential_providers_1.createCredentialChain)((0, credential_providers_1.fromEnv)(), (0, credential_providers_1.fromIni)({ profile })) : (0, credential_providers_1.createCredentialChain)((0, credential_providers_1.fromEnv)());
7
+ };
8
+ exports.awsCredentialProviderChain = awsCredentialProviderChain;
9
+ //# sourceMappingURL=aws-credential-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws-credential-provider.js","sourceRoot":"","sources":["../../src/bin/aws-credential-provider.ts"],"names":[],"mappings":";;;AAAA,wEAAwF;AAGjF,MAAM,0BAA0B,GAAG,CAAC,OAA2B,EAAiC,EAAE;IACvG,OAAO,OAAO,CAAC,CAAC,CAAC,IAAA,4CAAqB,EAAC,IAAA,8BAAO,GAAE,EAAE,IAAA,8BAAO,EAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,4CAAqB,EAAC,IAAA,8BAAO,GAAE,CAAC,CAAC;AAC7G,CAAC,CAAC;AAFW,QAAA,0BAA0B,8BAErC","sourcesContent":["import { createCredentialChain, fromEnv, fromIni } from \"@aws-sdk/credential-providers\";\nimport type { AwsCredentialIdentityProvider } from \"@aws-sdk/types\";\n\nexport const awsCredentialProviderChain = (profile: string | undefined): AwsCredentialIdentityProvider => {\n return profile ? createCredentialChain(fromEnv(), fromIni({ profile })) : createCredentialChain(fromEnv());\n};\n"]}
@@ -0,0 +1,11 @@
1
+ import type { AwsConfig, CliCommandResponse } from "../../../types/cli";
2
+ export interface Report {
3
+ name: string;
4
+ isPass: boolean;
5
+ msg?: string;
6
+ errors: Map<string, string>;
7
+ parametersFound: number;
8
+ parametersMissing: number;
9
+ }
10
+ export declare const accountReadinessCommand: (props: AwsConfig) => CliCommandResponse;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/commands/account-readiness/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxE,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,uBAAuB,GAAU,OAAO,SAAS,KAAG,kBAsBhE,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.accountReadinessCommand = void 0;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const ssm_1 = require("./ssm");
9
+ const accountReadinessCommand = async (props) => {
10
+ const report = await (0, ssm_1.report)(props);
11
+ console.log(chalk_1.default.bold(report.name + ":") + " " + (report.isPass ? "✅ Pass" : "❌ Fail"));
12
+ if (report.parametersFound === 0) {
13
+ console.log(`It looks like this account has not been set up for @guardian/cdk yet. See https://github.com/guardian/aws-account-setup`);
14
+ return 1;
15
+ }
16
+ if (!report.isPass) {
17
+ if (report.msg) {
18
+ console.log(report.msg + "\n");
19
+ }
20
+ report.errors.forEach((errMsg, name) => console.log(`${chalk_1.default.red(name)}: ${errMsg}`));
21
+ console.log();
22
+ }
23
+ return report.isPass ? 0 : 1;
24
+ };
25
+ exports.accountReadinessCommand = accountReadinessCommand;
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bin/commands/account-readiness/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,+BAA4C;AAWrC,MAAM,uBAAuB,GAAG,KAAK,EAAE,KAAgB,EAAsB,EAAE;IACpF,MAAM,MAAM,GAAG,MAAM,IAAA,YAAS,EAAC,KAAK,CAAC,CAAC;IAEtC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEzF,IAAI,MAAM,CAAC,eAAe,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,GAAG,CACT,yHAAyH,CAC1H,CAAC;QAEF,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,IAAI,MAAM,CAAC,GAAG,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;QACjC,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC;QACtF,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AAtBW,QAAA,uBAAuB,2BAsBlC","sourcesContent":["import chalk from \"chalk\";\nimport type { AwsConfig, CliCommandResponse } from \"../../../types/cli\";\nimport { report as reportSSM } from \"./ssm\";\n\nexport interface Report {\n name: string;\n isPass: boolean;\n msg?: string;\n errors: Map<string, string>;\n parametersFound: number;\n parametersMissing: number;\n}\n\nexport const accountReadinessCommand = async (props: AwsConfig): CliCommandResponse => {\n const report = await reportSSM(props);\n\n console.log(chalk.bold(report.name + \":\") + \" \" + (report.isPass ? \"✅ Pass\" : \"❌ Fail\"));\n\n if (report.parametersFound === 0) {\n console.log(\n `It looks like this account has not been set up for @guardian/cdk yet. See https://github.com/guardian/aws-account-setup`,\n );\n\n return 1;\n }\n\n if (!report.isPass) {\n if (report.msg) {\n console.log(report.msg + \"\\n\");\n }\n report.errors.forEach((errMsg, name) => console.log(`${chalk.red(name)}: ${errMsg}`));\n console.log();\n }\n\n return report.isPass ? 0 : 1;\n};\n"]}
@@ -0,0 +1,12 @@
1
+ import type { SsmParameterPath } from "../../../constants";
2
+ import type { AwsConfig } from "../../../types/cli";
3
+ import type { Report } from ".";
4
+ interface SSMParameterReadinessOutput {
5
+ missingParameters: SsmParameterPath[];
6
+ foundParameters: SsmParameterPath[];
7
+ defaultVPCReferences: SsmParameterPath[];
8
+ }
9
+ export declare const report: (props: AwsConfig) => Promise<Report>;
10
+ export declare const isPass: (output: SSMParameterReadinessOutput) => boolean;
11
+ export {};
12
+ //# sourceMappingURL=ssm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssm.d.ts","sourceRoot":"","sources":["../../../../src/bin/commands/account-readiness/ssm.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAEhC,UAAU,2BAA2B;IACnC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,eAAe,EAAE,gBAAgB,EAAE,CAAC;IACpC,oBAAoB,EAAE,gBAAgB,EAAE,CAAC;CAC1C;AAgDD,eAAO,MAAM,MAAM,GAAU,OAAO,SAAS,KAAG,OAAO,CAAC,MAAM,CAgC7D,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,QAAQ,2BAA2B,KAAG,OAE5D,CAAC"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isPass = exports.report = void 0;
7
+ const client_ec2_1 = require("@aws-sdk/client-ec2");
8
+ const client_ssm_1 = require("@aws-sdk/client-ssm");
9
+ const chalk_1 = __importDefault(require("chalk"));
10
+ const constants_1 = require("../../../constants");
11
+ const vpc_1 = require("../../../utils/cli/vpc");
12
+ const ssmParamReadiness = async ({ credentialProvider, region }) => {
13
+ const ssmClient = new client_ssm_1.SSM({
14
+ credentials: credentialProvider,
15
+ region,
16
+ });
17
+ const ec2Client = new client_ec2_1.EC2({
18
+ credentials: credentialProvider,
19
+ region,
20
+ });
21
+ const ssmParams = constants_1.ALL_SSM_PARAMETER_PATHS.filter((param) => !param.optional);
22
+ const paths = ssmParams.map((param) => param.path);
23
+ const awsResponse = await ssmClient.getParameters({ Names: paths });
24
+ const notFoundParameters = awsResponse.InvalidParameters ?? [];
25
+ const notFoundInDetail = ssmParams.filter((_) => notFoundParameters.includes(_.path));
26
+ const foundInDetail = ssmParams.filter((_) => !notFoundParameters.includes(_.path));
27
+ const vpcs = await (0, vpc_1.getVpcsInDetail)(ec2Client);
28
+ const ssmParamsFromAccount = await (0, vpc_1.getSsmParametersForVpc)(ssmClient);
29
+ const defaultVpcs = vpcs
30
+ .filter((vpc) => vpc.IsDefault)
31
+ .map((vpc) => {
32
+ // Non-null-assertion, A VPC always has an ID, the type in CDK is odd!
33
+ return vpc.VpcId;
34
+ });
35
+ const ssmParametersMatchingDefaultVpc = ssmParamsFromAccount.filter(({ Value }) => Value && defaultVpcs.includes(Value));
36
+ const defaultVPCReferencePaths = ssmParametersMatchingDefaultVpc
37
+ .map((param) => {
38
+ return ssmParams.find((p) => p.path === param.Name);
39
+ })
40
+ .filter((p) => p !== undefined);
41
+ return {
42
+ foundParameters: foundInDetail,
43
+ missingParameters: notFoundInDetail,
44
+ defaultVPCReferences: defaultVPCReferencePaths,
45
+ };
46
+ };
47
+ const report = async (props) => {
48
+ const output = await ssmParamReadiness(props);
49
+ const isPass = output.missingParameters.length === 0 && output.defaultVPCReferences.length === 0;
50
+ const errs = new Map();
51
+ const parametersMsg = "CDK uses predefined SSM parameters within patterns and constructs. For example, the EC2 APP pattern uses a parameter to determine which Kinesis stream to forward logs to. Your CDK app may fail at runtime if these parameters do not exist.";
52
+ const missingParamsMsg = "Required parameters are missing";
53
+ const missingParams = output.missingParameters.map((p) => ` ${chalk_1.default.yellowBright(p.path)}: ${p.description}`);
54
+ if (output.missingParameters.length > 0) {
55
+ errs.set(missingParamsMsg, `\n${missingParams.join("\n")}`);
56
+ }
57
+ if (output.defaultVPCReferences.length > 0) {
58
+ errs.set("Default VPC referenced in VPC parameters", `you should use a custom VPC instead. Default VPC is referenced in paths: ${output.defaultVPCReferences
59
+ .map((vpc) => vpc.path)
60
+ .join(", ")}.`);
61
+ }
62
+ return {
63
+ name: "SSM Parameter Readiness",
64
+ isPass: isPass,
65
+ msg: parametersMsg,
66
+ errors: errs,
67
+ parametersFound: output.foundParameters.length,
68
+ parametersMissing: output.missingParameters.length,
69
+ };
70
+ };
71
+ exports.report = report;
72
+ const isPass = (output) => {
73
+ return output.missingParameters.length === 0;
74
+ };
75
+ exports.isPass = isPass;
76
+ //# sourceMappingURL=ssm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssm.js","sourceRoot":"","sources":["../../../../src/bin/commands/account-readiness/ssm.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA0C;AAC1C,oDAA0C;AAC1C,kDAA0B;AAE1B,kDAA6D;AAE7D,gDAAiF;AASjF,MAAM,iBAAiB,GAAG,KAAK,EAAE,EAAE,kBAAkB,EAAE,MAAM,EAAa,EAAwC,EAAE;IAClH,MAAM,SAAS,GAAG,IAAI,gBAAG,CAAC;QACxB,WAAW,EAAE,kBAAkB;QAC/B,MAAM;KACP,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,IAAI,gBAAG,CAAC;QACxB,WAAW,EAAE,kBAAkB;QAC/B,MAAM;KACP,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,mCAAuB,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7E,MAAM,KAAK,GAAa,SAAS,CAAC,GAAG,CAAC,CAAC,KAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/E,MAAM,WAAW,GAAG,MAAM,SAAS,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAEpE,MAAM,kBAAkB,GAAG,WAAW,CAAC,iBAAiB,IAAI,EAAE,CAAC;IAC/D,MAAM,gBAAgB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,QAAQ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AW,EAAE;IACrE,OAAO,MAAM,CAAC,iBAAiB,CAAC,MAAM,KAAK,CAAC,CAAC;AAC/C,CAAC,CAAC;AAFW,QAAA,MAAM,UAEjB","sourcesContent":["import { EC2 } from \"@aws-sdk/client-ec2\";\nimport { SSM } from \"@aws-sdk/client-ssm\";\nimport chalk from \"chalk\";\nimport type { SsmParameterPath } from \"../../../constants\";\nimport { ALL_SSM_PARAMETER_PATHS } from \"../../../constants\";\nimport type { AwsConfig } from \"../../../types/cli\";\nimport { getSsmParametersForVpc, getVpcsInDetail } from \"../../../utils/cli/vpc\";\nimport type { Report } from \".\";\n\ninterface SSMParameterReadinessOutput {\n missingParameters: SsmParameterPath[];\n foundParameters: SsmParameterPath[];\n defaultVPCReferences: SsmParameterPath[];\n}\n\nconst ssmParamReadiness = async ({ credentialProvider, region }: AwsConfig): Promise<SSMParameterReadinessOutput> => {\n const ssmClient = new SSM({\n credentials: credentialProvider,\n region,\n });\n\n const ec2Client = new EC2({\n credentials: credentialProvider,\n region,\n });\n\n const ssmParams = ALL_SSM_PARAMETER_PATHS.filter((param) => !param.optional);\n const paths: string[] = ssmParams.map((param: SsmParameterPath) => param.path);\n\n const awsResponse = await ssmClient.getParameters({ Names: paths });\n\n const notFoundParameters = awsResponse.InvalidParameters ?? [];\n const notFoundInDetail = ssmParams.filter((_) => notFoundParameters.includes(_.path));\n const foundInDetail = ssmParams.filter((_) => !notFoundParameters.includes(_.path));\n\n const vpcs = await getVpcsInDetail(ec2Client);\n const ssmParamsFromAccount = await getSsmParametersForVpc(ssmClient);\n const defaultVpcs: string[] = vpcs\n .filter((vpc) => vpc.IsDefault)\n .map((vpc) => {\n // Non-null-assertion, A VPC always has an ID, the type in CDK is odd!\n return vpc.VpcId!;\n });\n\n const ssmParametersMatchingDefaultVpc = ssmParamsFromAccount.filter(\n ({ Value }) => Value && defaultVpcs.includes(Value),\n );\n\n const defaultVPCReferencePaths = ssmParametersMatchingDefaultVpc\n .map((param) => {\n return ssmParams.find((p) => p.path === param.Name);\n })\n .filter((p): p is SsmParameterPath => p !== undefined);\n\n return {\n foundParameters: foundInDetail,\n missingParameters: notFoundInDetail,\n defaultVPCReferences: defaultVPCReferencePaths,\n };\n};\n\nexport const report = async (props: AwsConfig): Promise<Report> => {\n const output = await ssmParamReadiness(props);\n const isPass = output.missingParameters.length === 0 && output.defaultVPCReferences.length === 0;\n\n const errs = new Map<string, string>();\n const parametersMsg =\n \"CDK uses predefined SSM parameters within patterns and constructs. For example, the EC2 APP pattern uses a parameter to determine which Kinesis stream to forward logs to. Your CDK app may fail at runtime if these parameters do not exist.\";\n\n const missingParamsMsg = \"Required parameters are missing\";\n const missingParams = output.missingParameters.map((p) => ` ${chalk.yellowBright(p.path)}: ${p.description}`);\n\n if (output.missingParameters.length > 0) {\n errs.set(missingParamsMsg, `\\n${missingParams.join(\"\\n\")}`);\n }\n\n if (output.defaultVPCReferences.length > 0) {\n errs.set(\n \"Default VPC referenced in VPC parameters\",\n `you should use a custom VPC instead. Default VPC is referenced in paths: ${output.defaultVPCReferences\n .map((vpc) => vpc.path)\n .join(\", \")}.`,\n );\n }\n\n return {\n name: \"SSM Parameter Readiness\",\n isPass: isPass,\n msg: parametersMsg,\n errors: errs,\n parametersFound: output.foundParameters.length,\n parametersMissing: output.missingParameters.length,\n };\n};\n\nexport const isPass = (output: SSMParameterReadinessOutput): boolean => {\n return output.missingParameters.length === 0;\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import type { CliCommandResponse } from "../../types/cli";
2
+ export declare const awsCdkVersionCommand: () => CliCommandResponse;
3
+ //# sourceMappingURL=aws-cdk-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws-cdk-version.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/aws-cdk-version.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,eAAO,MAAM,oBAAoB,QAAO,kBAEvC,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.awsCdkVersionCommand = void 0;
4
+ const constants_1 = require("../../constants");
5
+ const awsCdkVersionCommand = () => {
6
+ return Promise.resolve(constants_1.LibraryInfo.AWS_CDK_VERSION);
7
+ };
8
+ exports.awsCdkVersionCommand = awsCdkVersionCommand;
9
+ //# sourceMappingURL=aws-cdk-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws-cdk-version.js","sourceRoot":"","sources":["../../../src/bin/commands/aws-cdk-version.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAGvC,MAAM,oBAAoB,GAAG,GAAuB,EAAE;IAC3D,OAAO,OAAO,CAAC,OAAO,CAAC,uBAAW,CAAC,eAAe,CAAC,CAAC;AACtD,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B","sourcesContent":["import { LibraryInfo } from \"../../constants\";\nimport type { CliCommandResponse } from \"../../types/cli\";\n\nexport const awsCdkVersionCommand = (): CliCommandResponse => {\n return Promise.resolve(LibraryInfo.AWS_CDK_VERSION);\n};\n"]}
@@ -0,0 +1,14 @@
1
+ import type { CliCommandResponse } from "../../../types/cli";
2
+ export type PackageManager = "npm" | "yarn";
3
+ interface NewProjectProps {
4
+ init: boolean;
5
+ app: string;
6
+ stack: string;
7
+ stages: string[];
8
+ regions: string[];
9
+ yamlTemplateLocation?: string;
10
+ packageManager: PackageManager;
11
+ }
12
+ export declare const newCdkProject: (props: NewProjectProps) => CliCommandResponse;
13
+ export {};
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/commands/new-project/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAY7D,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5C,UAAU,eAAe;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,cAAc,CAAC;CAChC;AAuED,eAAO,MAAM,aAAa,GAAU,OAAO,eAAe,KAAG,kBA8E5D,CAAC"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.newCdkProject = void 0;
7
+ const fs_1 = require("fs");
8
+ const path_1 = require("path");
9
+ const chalk_1 = __importDefault(require("chalk"));
10
+ const exec_1 = require("../../../utils/exec");
11
+ const git_1 = require("../../../utils/git");
12
+ const string_1 = require("../../../utils/string");
13
+ const app_1 = require("./utils/app");
14
+ const imports_1 = require("./utils/imports");
15
+ const init_1 = require("./utils/init");
16
+ const snapshot_1 = require("./utils/snapshot");
17
+ const stack_1 = require("./utils/stack");
18
+ const utils_1 = require("./utils/utils");
19
+ const checkPathExists = (path) => {
20
+ if (!(0, fs_1.existsSync)(path)) {
21
+ throw new Error(`File not found - ${path}`);
22
+ }
23
+ };
24
+ const checkPathDoesNotExist = (path) => {
25
+ if ((0, fs_1.existsSync)(path)) {
26
+ throw new Error(`There is already a file at - ${path}`);
27
+ }
28
+ };
29
+ function validateConfig(config) {
30
+ if (!config.init) {
31
+ checkPathExists(config.cdkDir);
32
+ }
33
+ checkPathDoesNotExist(config.appPath); // TODO: Update the app file if it already exists
34
+ checkPathDoesNotExist(config.stackPath);
35
+ if (config.yamlTemplateLocation) {
36
+ checkPathExists(config.yamlTemplateLocation);
37
+ }
38
+ }
39
+ function getConfig(props) {
40
+ const { init, app, stack, stages, regions, yamlTemplateLocation, packageManager } = props;
41
+ const rootDir = (0, git_1.gitRootOrCwd)();
42
+ const cdkDir = (0, path_1.join)(rootDir, "/cdk");
43
+ const appName = (0, string_1.toPascalCase)(app);
44
+ const kebabAppName = (0, string_1.toKebabCase)(appName);
45
+ const stackName = (0, string_1.toPascalCase)(stack);
46
+ const kebabStackName = (0, string_1.toKebabCase)(stackName);
47
+ const config = {
48
+ init,
49
+ yamlTemplateLocation,
50
+ stages,
51
+ regions,
52
+ cdkDir,
53
+ appName: {
54
+ kebab: kebabAppName,
55
+ pascal: appName,
56
+ },
57
+ appPath: `${cdkDir}/bin/${kebabAppName}.ts`,
58
+ stackName: {
59
+ kebab: kebabStackName,
60
+ pascal: stackName,
61
+ },
62
+ stackPath: `${cdkDir}/lib/${kebabAppName}.ts`,
63
+ testPath: `${cdkDir}/lib/${kebabAppName}.test.ts`,
64
+ packageManager,
65
+ };
66
+ validateConfig(config);
67
+ return config;
68
+ }
69
+ const newCdkProject = async (props) => {
70
+ console.log("Starting CDK generator");
71
+ const config = getConfig(props);
72
+ if (config.init) {
73
+ (0, init_1.buildDirectory)({ outputDir: config.cdkDir });
74
+ }
75
+ console.log(`New app ${config.appName.pascal} will be written to ${config.appPath}`);
76
+ console.log(`New stack ${config.stackName.pascal} will be written to ${config.stackPath}`);
77
+ // bin directory
78
+ await (0, app_1.constructApp)({
79
+ appName: config.appName,
80
+ outputFile: "cdk.ts",
81
+ outputDir: (0, path_1.dirname)(config.appPath),
82
+ stack: config.stackName,
83
+ imports: imports_1.Imports.newAppImports(config.appName),
84
+ stages: config.stages,
85
+ regions: config.regions,
86
+ });
87
+ // lib directory
88
+ await (0, stack_1.constructStack)({
89
+ imports: imports_1.Imports.newStackImports(!!config.yamlTemplateLocation),
90
+ appName: config.appName,
91
+ outputFile: (0, path_1.basename)(config.stackPath),
92
+ outputDir: (0, path_1.dirname)(config.stackPath),
93
+ yamlTemplateLocation: config.yamlTemplateLocation,
94
+ });
95
+ // lib directory
96
+ await (0, snapshot_1.constructTest)({
97
+ imports: imports_1.Imports.newTestImports(config.appName),
98
+ stackName: config.stackName,
99
+ appName: config.appName,
100
+ outputFile: (0, path_1.basename)(config.testPath),
101
+ outputDir: (0, path_1.dirname)(config.stackPath),
102
+ });
103
+ const commands = (0, utils_1.getCommands)(config.packageManager, config.cdkDir);
104
+ if (config.init) {
105
+ console.log(chalk_1.default.yellow("Installing dependencies. This may take a while..."));
106
+ await commands.installDependencies();
107
+ console.log(chalk_1.default.green(" ✅ Successfully installed dependencies"));
108
+ }
109
+ // Run `eslint --fix` on the generated files instead of trying to generate code that completely satisfies the linter.
110
+ // Each glob must be a separate argument: `execute` uses `spawn` with `shell: false`, so a single
111
+ // "lib/** bin/**" string would be treated as one (non-matching) pattern and silently fixed nothing.
112
+ await (0, exec_1.execute)("./node_modules/.bin/eslint", ["lib/**", "bin/**", "--no-error-on-unmatched-pattern", "--fix"], {
113
+ cwd: config.cdkDir,
114
+ });
115
+ console.log(chalk_1.default.yellow("Running lint check..."));
116
+ await commands.lint();
117
+ console.log(chalk_1.default.green(" ✅ Successfully passed lint check"));
118
+ console.log(chalk_1.default.yellow("Running tests..."));
119
+ await commands.test();
120
+ console.log(chalk_1.default.green(" ✅ Successfully passed tests"));
121
+ console.log(chalk_1.default.yellow("Running initial synthesis..."));
122
+ await commands.synth();
123
+ console.log(chalk_1.default.green(" ✅ Successfully synthesized CDK app"));
124
+ console.log(chalk_1.default.green("Success! Here's a summary of the created files:"));
125
+ const tree = await (0, exec_1.execute)("tree", ["-I", "node_modules|cdk.out"], {
126
+ cwd: config.cdkDir,
127
+ });
128
+ console.log(tree);
129
+ const docsUrl = "https://github.com/guardian/cdk/tree/main/docs";
130
+ console.log(chalk_1.default.green(`Please see the docs (${docsUrl}) for next steps.`));
131
+ return Promise.resolve(0);
132
+ };
133
+ exports.newCdkProject = newCdkProject;
134
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/bin/commands/new-project/index.ts"],"names":[],"mappings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ACnB,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAElB,MAAM,OAAO,GAAG,gDAAgD,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,wBAAwB,OAAO,mBAAmB,CAAC,CAAC,CAAC;IAE7E,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC,CAAC;AA9EW,QAAA,aAAa,iBA8ExB","sourcesContent":["import { existsSync } from \"fs\";\nimport { basename, dirname, join } from \"path\";\nimport chalk from \"chalk\";\nimport type { CliCommandResponse } from \"../../../types/cli\";\nimport { execute } from \"../../../utils/exec\";\nimport { gitRootOrCwd } from \"../../../utils/git\";\nimport { toKebabCase, toPascalCase } from \"../../../utils/string\";\nimport { constructApp } from \"./utils/app\";\nimport { Imports } from \"./utils/imports\";\nimport { buildDirectory } from \"./utils/init\";\nimport { constructTest } from \"./utils/snapshot\";\nimport { constructStack } from \"./utils/stack\";\nimport type { Name } from \"./utils/utils\";\nimport { getCommands } from \"./utils/utils\";\n\nexport type PackageManager = \"npm\" | \"yarn\";\n\ninterface NewProjectProps {\n init: boolean;\n app: string;\n stack: string;\n stages: string[];\n regions: string[];\n yamlTemplateLocation?: string;\n packageManager: PackageManager;\n}\n\ninterface NewProjectConfig extends Omit<NewProjectProps, \"stack\" | \"app\"> {\n cdkDir: string;\n appPath: string;\n appName: Name;\n stackPath: string;\n stackName: Name;\n testPath: string;\n}\n\nconst checkPathExists = (path: string): void => {\n if (!existsSync(path)) {\n throw new Error(`File not found - ${path}`);\n }\n};\n\nconst checkPathDoesNotExist = (path: string): void => {\n if (existsSync(path)) {\n throw new Error(`There is already a file at - ${path}`);\n }\n};\n\nfunction validateConfig(config: NewProjectConfig): void {\n if (!config.init) {\n checkPathExists(config.cdkDir);\n }\n checkPathDoesNotExist(config.appPath); // TODO: Update the app file if it already exists\n checkPathDoesNotExist(config.stackPath);\n\n if (config.yamlTemplateLocation) {\n checkPathExists(config.yamlTemplateLocation);\n }\n}\n\nfunction getConfig(props: NewProjectProps): NewProjectConfig {\n const { init, app, stack, stages, regions, yamlTemplateLocation, packageManager } = props;\n\n const rootDir = gitRootOrCwd();\n const cdkDir = join(rootDir, \"/cdk\");\n\n const appName = toPascalCase(app);\n const kebabAppName = toKebabCase(appName);\n const stackName = toPascalCase(stack);\n const kebabStackName = toKebabCase(stackName);\n\n const config: NewProjectConfig = {\n init,\n yamlTemplateLocation,\n stages,\n regions,\n cdkDir,\n appName: {\n kebab: kebabAppName,\n pascal: appName,\n },\n appPath: `${cdkDir}/bin/${kebabAppName}.ts`,\n stackName: {\n kebab: kebabStackName,\n pascal: stackName,\n },\n stackPath: `${cdkDir}/lib/${kebabAppName}.ts`,\n testPath: `${cdkDir}/lib/${kebabAppName}.test.ts`,\n packageManager,\n };\n\n validateConfig(config);\n\n return config;\n}\n\nexport const newCdkProject = async (props: NewProjectProps): CliCommandResponse => {\n console.log(\"Starting CDK generator\");\n\n const config = getConfig(props);\n\n if (config.init) {\n buildDirectory({ outputDir: config.cdkDir });\n }\n\n console.log(`New app ${config.appName.pascal} will be written to ${config.appPath}`);\n console.log(`New stack ${config.stackName.pascal} will be written to ${config.stackPath}`);\n\n // bin directory\n await constructApp({\n appName: config.appName,\n outputFile: \"cdk.ts\",\n outputDir: dirname(config.appPath),\n stack: config.stackName,\n imports: Imports.newAppImports(config.appName),\n stages: config.stages,\n regions: config.regions,\n });\n\n // lib directory\n await constructStack({\n imports: Imports.newStackImports(!!config.yamlTemplateLocation),\n appName: config.appName,\n outputFile: basename(config.stackPath),\n outputDir: dirname(config.stackPath),\n yamlTemplateLocation: config.yamlTemplateLocation,\n });\n\n // lib directory\n await constructTest({\n imports: Imports.newTestImports(config.appName),\n stackName: config.stackName,\n appName: config.appName,\n outputFile: basename(config.testPath),\n outputDir: dirname(config.stackPath),\n });\n\n const commands = getCommands(config.packageManager, config.cdkDir);\n\n if (config.init) {\n console.log(chalk.yellow(\"Installing dependencies. This may take a while...\"));\n await commands.installDependencies();\n console.log(chalk.green(\" ✅ Successfully installed dependencies\"));\n }\n\n // Run `eslint --fix` on the generated files instead of trying to generate code that completely satisfies the linter.\n // Each glob must be a separate argument: `execute` uses `spawn` with `shell: false`, so a single\n // \"lib/** bin/**\" string would be treated as one (non-matching) pattern and silently fixed nothing.\n await execute(\"./node_modules/.bin/eslint\", [\"lib/**\", \"bin/**\", \"--no-error-on-unmatched-pattern\", \"--fix\"], {\n cwd: config.cdkDir,\n });\n\n console.log(chalk.yellow(\"Running lint check...\"));\n await commands.lint();\n console.log(chalk.green(\" ✅ Successfully passed lint check\"));\n\n console.log(chalk.yellow(\"Running tests...\"));\n await commands.test();\n console.log(chalk.green(\" ✅ Successfully passed tests\"));\n\n console.log(chalk.yellow(\"Running initial synthesis...\"));\n await commands.synth();\n console.log(chalk.green(\" ✅ Successfully synthesized CDK app\"));\n\n console.log(chalk.green(\"Success! Here's a summary of the created files:\"));\n const tree = await execute(\"tree\", [\"-I\", \"node_modules|cdk.out\"], {\n cwd: config.cdkDir,\n });\n console.log(tree);\n\n const docsUrl = \"https://github.com/guardian/cdk/tree/main/docs\";\n console.log(chalk.green(`Please see the docs (${docsUrl}) for next steps.`));\n\n return Promise.resolve(0);\n};\n"]}
@@ -0,0 +1,11 @@
1
+ *.js
2
+ !jest.config.js
3
+ !jest.setup.js
4
+ !.eslintrc.js
5
+ *.d.ts
6
+ node_modules
7
+ dist
8
+
9
+ # CDK asset staging directory
10
+ .cdk.staging
11
+ cdk.out
@@ -0,0 +1,5 @@
1
+ # Infrastructure
2
+
3
+ This directory defines the components to be deployed to AWS.
4
+
5
+ See [`package.json`](./package.json) for a list of available scripts.
@@ -0,0 +1,2 @@
1
+ This file exists to ensure that the empty directory remains version controlled
2
+ It is ignored by the `init` command when generating files
@@ -0,0 +1,7 @@
1
+ {
2
+ "app": "npx ts-node bin/cdk.ts",
3
+ "context": {
4
+ "aws-cdk:enableDiffNoFail": "true",
5
+ "@aws-cdk/core:stackRelativeExports": "true"
6
+ }
7
+ }
@@ -0,0 +1,6 @@
1
+ import guardian from '@guardian/eslint-config';
2
+
3
+ export default [
4
+ ...guardian.configs.recommended,
5
+ ...guardian.configs.jest
6
+ ];
@@ -0,0 +1,2 @@
1
+ /* eslint-disable no-undef -- jest globals are missing due to guardian.recommended.jest eslint rules not covering jest.setup.js */
2
+ jest.mock("@guardian/cdk/lib/constants/tracking-tag");