skuba 0.0.0-master-20231121000709 → 0.0.0-master-20240206001217

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 (207) hide show
  1. package/README.md +3 -3
  2. package/jest/transform.test.ts +3 -1
  3. package/lib/api/jest/index.d.ts +1 -1
  4. package/lib/api/jest/index.js.map +2 -2
  5. package/lib/cli/adapter/prettier.d.ts +1 -1
  6. package/lib/cli/adapter/prettier.js +11 -10
  7. package/lib/cli/adapter/prettier.js.map +2 -2
  8. package/lib/cli/build/index.js +0 -2
  9. package/lib/cli/build/index.js.map +2 -2
  10. package/lib/cli/buildPackage.js +0 -2
  11. package/lib/cli/buildPackage.js.map +2 -2
  12. package/lib/cli/configure/analyseConfiguration.d.ts +2 -0
  13. package/lib/cli/configure/analyseConfiguration.js.map +2 -2
  14. package/lib/cli/configure/getEntryPoint.js +1 -1
  15. package/lib/cli/configure/getEntryPoint.js.map +2 -2
  16. package/lib/cli/configure/getProjectType.js +1 -1
  17. package/lib/cli/configure/getProjectType.js.map +2 -2
  18. package/lib/cli/configure/index.js +11 -8
  19. package/lib/cli/configure/index.js.map +2 -2
  20. package/lib/cli/configure/modules/index.js +0 -2
  21. package/lib/cli/configure/modules/index.js.map +2 -2
  22. package/lib/cli/configure/modules/package.d.ts +1 -1
  23. package/lib/cli/configure/modules/package.js +2 -1
  24. package/lib/cli/configure/modules/package.js.map +2 -2
  25. package/lib/cli/configure/patchRenovateConfig.d.ts +2 -1
  26. package/lib/cli/configure/patchRenovateConfig.js +23 -10
  27. package/lib/cli/configure/patchRenovateConfig.js.map +2 -2
  28. package/lib/cli/configure/types.d.ts +2 -0
  29. package/lib/cli/configure/types.js.map +1 -1
  30. package/lib/cli/configure/upgrade/index.d.ts +15 -0
  31. package/lib/cli/configure/upgrade/index.js +130 -0
  32. package/lib/cli/configure/upgrade/index.js.map +7 -0
  33. package/lib/cli/configure/{addEmptyExports.d.ts → upgrade/patches/7.3.1/addEmptyExports.d.ts} +2 -2
  34. package/lib/cli/configure/{addEmptyExports.js → upgrade/patches/7.3.1/addEmptyExports.js} +15 -11
  35. package/lib/cli/configure/upgrade/patches/7.3.1/addEmptyExports.js.map +7 -0
  36. package/lib/cli/configure/upgrade/patches/7.3.1/index.d.ts +2 -0
  37. package/lib/cli/configure/upgrade/patches/7.3.1/index.js +55 -0
  38. package/lib/cli/configure/upgrade/patches/7.3.1/index.js.map +7 -0
  39. package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.d.ts +2 -0
  40. package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js +94 -0
  41. package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js.map +7 -0
  42. package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.d.ts +2 -0
  43. package/lib/cli/configure/{patchDockerfile.js → upgrade/patches/7.3.1/patchDockerfile.js} +18 -12
  44. package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.js.map +7 -0
  45. package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.d.ts +2 -0
  46. package/lib/cli/configure/{patchServerListener.js → upgrade/patches/7.3.1/patchServerListener.js} +18 -14
  47. package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.js.map +7 -0
  48. package/lib/cli/format.js +7 -14
  49. package/lib/cli/format.js.map +2 -2
  50. package/lib/cli/init/getConfig.d.ts +4 -2
  51. package/lib/cli/init/getConfig.js +53 -26
  52. package/lib/cli/init/getConfig.js.map +2 -2
  53. package/lib/cli/init/git.d.ts +2 -1
  54. package/lib/cli/init/git.js +2 -9
  55. package/lib/cli/init/git.js.map +2 -2
  56. package/lib/cli/init/index.d.ts +1 -1
  57. package/lib/cli/init/index.js +19 -9
  58. package/lib/cli/init/index.js.map +2 -2
  59. package/lib/cli/init/prompts.d.ts +26 -3
  60. package/lib/cli/init/prompts.js +10 -2
  61. package/lib/cli/init/prompts.js.map +2 -2
  62. package/lib/cli/init/types.d.ts +21 -0
  63. package/lib/cli/init/types.js +5 -1
  64. package/lib/cli/init/types.js.map +2 -2
  65. package/lib/cli/init/writePackageJson.d.ts +6 -0
  66. package/lib/cli/init/writePackageJson.js.map +2 -2
  67. package/lib/cli/lint/annotate/buildkite/index.d.ts +2 -1
  68. package/lib/cli/lint/annotate/buildkite/index.js +5 -3
  69. package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
  70. package/lib/cli/lint/annotate/buildkite/internal.d.ts +2 -0
  71. package/lib/cli/lint/annotate/buildkite/internal.js +45 -0
  72. package/lib/cli/lint/annotate/buildkite/internal.js.map +7 -0
  73. package/lib/cli/lint/annotate/github/index.d.ts +2 -1
  74. package/lib/cli/lint/annotate/github/index.js +4 -2
  75. package/lib/cli/lint/annotate/github/index.js.map +2 -2
  76. package/lib/cli/lint/annotate/github/internal.d.ts +3 -0
  77. package/lib/cli/lint/annotate/github/internal.js +36 -0
  78. package/lib/cli/lint/annotate/github/internal.js.map +7 -0
  79. package/lib/cli/lint/annotate/index.d.ts +4 -3
  80. package/lib/cli/lint/annotate/index.js +9 -3
  81. package/lib/cli/lint/annotate/index.js.map +2 -2
  82. package/lib/cli/lint/autofix.d.ts +3 -1
  83. package/lib/cli/lint/autofix.js +36 -59
  84. package/lib/cli/lint/autofix.js.map +3 -3
  85. package/lib/cli/lint/external.d.ts +6 -1
  86. package/lib/cli/lint/external.js +6 -29
  87. package/lib/cli/lint/external.js.map +2 -2
  88. package/lib/cli/lint/index.d.ts +2 -1
  89. package/lib/cli/lint/index.js +46 -14
  90. package/lib/cli/lint/index.js.map +2 -2
  91. package/lib/cli/lint/internal.d.ts +12 -1
  92. package/lib/cli/lint/internal.js +55 -19
  93. package/lib/cli/lint/internal.js.map +3 -3
  94. package/lib/cli/lint/internalLints/deleteFiles.d.ts +3 -0
  95. package/lib/cli/lint/internalLints/deleteFiles.js +102 -0
  96. package/lib/cli/lint/internalLints/deleteFiles.js.map +7 -0
  97. package/lib/cli/lint/internalLints/noSkubaTemplateJs.d.ts +3 -0
  98. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +75 -0
  99. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +7 -0
  100. package/lib/cli/lint/internalLints/refreshConfigFiles.d.ts +11 -0
  101. package/lib/cli/lint/internalLints/refreshConfigFiles.js +147 -0
  102. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +7 -0
  103. package/lib/cli/test/index.js +0 -2
  104. package/lib/cli/test/index.js.map +2 -2
  105. package/lib/skuba.d.ts +1 -1
  106. package/lib/skuba.js.map +1 -1
  107. package/lib/utils/exec.d.ts +2 -1
  108. package/lib/utils/exec.js +1 -0
  109. package/lib/utils/exec.js.map +2 -2
  110. package/lib/utils/logging.d.ts +2 -0
  111. package/lib/utils/logging.js +1 -0
  112. package/lib/utils/logging.js.map +2 -2
  113. package/lib/utils/logo.js +6 -10
  114. package/lib/utils/logo.js.map +3 -3
  115. package/lib/utils/manifest.d.ts +1 -1
  116. package/lib/utils/manifest.js +1 -1
  117. package/lib/utils/manifest.js.map +2 -2
  118. package/lib/utils/npmrc.d.ts +1 -0
  119. package/lib/utils/npmrc.js +29 -0
  120. package/lib/utils/npmrc.js.map +7 -0
  121. package/lib/utils/packageManager.d.ts +24 -0
  122. package/lib/utils/packageManager.js +97 -0
  123. package/lib/utils/packageManager.js.map +7 -0
  124. package/lib/utils/template.d.ts +3 -0
  125. package/lib/utils/template.js +2 -0
  126. package/lib/utils/template.js.map +2 -2
  127. package/lib/utils/worker.d.ts +1 -0
  128. package/lib/wrapper/http.d.ts +1 -0
  129. package/package.json +39 -36
  130. package/template/base/_.dockerignore +0 -1
  131. package/template/base/_.eslintignore +1 -0
  132. package/template/base/_.gitignore +1 -1
  133. package/template/base/_.npmrc +8 -0
  134. package/template/express-rest-api/.buildkite/pipeline.yml +13 -10
  135. package/template/express-rest-api/.gantry/dev.yml +3 -0
  136. package/template/express-rest-api/Dockerfile +6 -12
  137. package/template/express-rest-api/Dockerfile.dev-deps +6 -5
  138. package/template/express-rest-api/README.md +6 -6
  139. package/template/express-rest-api/docker-compose.yml +0 -10
  140. package/template/express-rest-api/gantry.apply.yml +5 -0
  141. package/template/express-rest-api/gantry.build.yml +1 -2
  142. package/template/express-rest-api/package.json +2 -2
  143. package/template/express-rest-api/skuba.template.js +1 -0
  144. package/template/greeter/.buildkite/pipeline.yml +12 -9
  145. package/template/greeter/Dockerfile +6 -5
  146. package/template/greeter/README.md +6 -6
  147. package/template/greeter/docker-compose.yml +0 -10
  148. package/template/greeter/package.json +1 -1
  149. package/template/greeter/skuba.template.js +1 -0
  150. package/template/koa-rest-api/.buildkite/pipeline.yml +13 -10
  151. package/template/koa-rest-api/.gantry/dev.yml +3 -0
  152. package/template/koa-rest-api/.nvmrc +1 -1
  153. package/template/koa-rest-api/Dockerfile +6 -12
  154. package/template/koa-rest-api/Dockerfile.dev-deps +6 -5
  155. package/template/koa-rest-api/README.md +6 -6
  156. package/template/koa-rest-api/docker-compose.yml +0 -10
  157. package/template/koa-rest-api/gantry.apply.yml +5 -0
  158. package/template/koa-rest-api/gantry.build.yml +1 -2
  159. package/template/koa-rest-api/package.json +8 -6
  160. package/template/koa-rest-api/skuba.template.js +1 -0
  161. package/template/koa-rest-api/src/framework/validation.test.ts +48 -15
  162. package/template/koa-rest-api/src/framework/validation.ts +31 -8
  163. package/template/koa-rest-api/src/testing/types.ts +16 -4
  164. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +21 -15
  165. package/template/lambda-sqs-worker/Dockerfile +6 -6
  166. package/template/lambda-sqs-worker/README.md +8 -8
  167. package/template/lambda-sqs-worker/_.npmrc +12 -0
  168. package/template/lambda-sqs-worker/docker-compose.yml +0 -15
  169. package/template/lambda-sqs-worker/package.json +3 -4
  170. package/template/lambda-sqs-worker/serverless.yml +4 -1
  171. package/template/lambda-sqs-worker/skuba.template.js +1 -0
  172. package/template/lambda-sqs-worker/src/hooks.ts +1 -2
  173. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +42 -18
  174. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
  175. package/template/lambda-sqs-worker-cdk/Dockerfile +9 -7
  176. package/template/lambda-sqs-worker-cdk/cdk.json +12 -6
  177. package/template/lambda-sqs-worker-cdk/docker-compose.yml +0 -15
  178. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +1587 -225
  179. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +23 -3
  180. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +127 -14
  181. package/template/lambda-sqs-worker-cdk/package.json +5 -3
  182. package/template/lambda-sqs-worker-cdk/shared/context-types.ts +1 -0
  183. package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -0
  184. package/template/lambda-sqs-worker-cdk/src/app.ts +14 -1
  185. package/template/lambda-sqs-worker-cdk/src/postHook.ts +154 -0
  186. package/template/lambda-sqs-worker-cdk/src/preHook.ts +95 -0
  187. package/template/oss-npm-package/.github/workflows/release.yml +10 -7
  188. package/template/oss-npm-package/.github/workflows/validate.yml +10 -7
  189. package/template/oss-npm-package/.releaserc +16 -0
  190. package/template/oss-npm-package/README.md +17 -17
  191. package/template/oss-npm-package/_package.json +3 -2
  192. package/template/oss-npm-package/skuba.template.js +1 -0
  193. package/template/private-npm-package/.releaserc +16 -0
  194. package/template/private-npm-package/README.md +16 -16
  195. package/template/private-npm-package/_package.json +3 -3
  196. package/template/private-npm-package/skuba.template.js +1 -0
  197. package/lib/cli/configure/addEmptyExports.js.map +0 -7
  198. package/lib/cli/configure/modules/tsconfig.d.ts +0 -2
  199. package/lib/cli/configure/modules/tsconfig.js +0 -87
  200. package/lib/cli/configure/modules/tsconfig.js.map +0 -7
  201. package/lib/cli/configure/patchDockerfile.d.ts +0 -1
  202. package/lib/cli/configure/patchDockerfile.js.map +0 -7
  203. package/lib/cli/configure/patchServerListener.d.ts +0 -3
  204. package/lib/cli/configure/patchServerListener.js.map +0 -7
  205. package/lib/cli/configure/refreshIgnoreFiles.d.ts +0 -3
  206. package/lib/cli/configure/refreshIgnoreFiles.js +0 -78
  207. package/lib/cli/configure/refreshIgnoreFiles.js.map +0 -7
@@ -2,7 +2,306 @@
2
2
 
3
3
  exports[`returns expected CloudFormation stack for dev 1`] = `
4
4
  {
5
+ "Mappings": {
6
+ "ServiceprincipalMap": {
7
+ "af-south-1": {
8
+ "codedeploy": "codedeploy.af-south-1.amazonaws.com",
9
+ },
10
+ "ap-east-1": {
11
+ "codedeploy": "codedeploy.ap-east-1.amazonaws.com",
12
+ },
13
+ "ap-northeast-1": {
14
+ "codedeploy": "codedeploy.ap-northeast-1.amazonaws.com",
15
+ },
16
+ "ap-northeast-2": {
17
+ "codedeploy": "codedeploy.ap-northeast-2.amazonaws.com",
18
+ },
19
+ "ap-northeast-3": {
20
+ "codedeploy": "codedeploy.ap-northeast-3.amazonaws.com",
21
+ },
22
+ "ap-south-1": {
23
+ "codedeploy": "codedeploy.ap-south-1.amazonaws.com",
24
+ },
25
+ "ap-south-2": {
26
+ "codedeploy": "codedeploy.ap-south-2.amazonaws.com",
27
+ },
28
+ "ap-southeast-1": {
29
+ "codedeploy": "codedeploy.ap-southeast-1.amazonaws.com",
30
+ },
31
+ "ap-southeast-2": {
32
+ "codedeploy": "codedeploy.ap-southeast-2.amazonaws.com",
33
+ },
34
+ "ap-southeast-3": {
35
+ "codedeploy": "codedeploy.ap-southeast-3.amazonaws.com",
36
+ },
37
+ "ap-southeast-4": {
38
+ "codedeploy": "codedeploy.ap-southeast-4.amazonaws.com",
39
+ },
40
+ "ca-central-1": {
41
+ "codedeploy": "codedeploy.ca-central-1.amazonaws.com",
42
+ },
43
+ "cn-north-1": {
44
+ "codedeploy": "codedeploy.cn-north-1.amazonaws.com.cn",
45
+ },
46
+ "cn-northwest-1": {
47
+ "codedeploy": "codedeploy.cn-northwest-1.amazonaws.com.cn",
48
+ },
49
+ "eu-central-1": {
50
+ "codedeploy": "codedeploy.eu-central-1.amazonaws.com",
51
+ },
52
+ "eu-central-2": {
53
+ "codedeploy": "codedeploy.eu-central-2.amazonaws.com",
54
+ },
55
+ "eu-north-1": {
56
+ "codedeploy": "codedeploy.eu-north-1.amazonaws.com",
57
+ },
58
+ "eu-south-1": {
59
+ "codedeploy": "codedeploy.eu-south-1.amazonaws.com",
60
+ },
61
+ "eu-south-2": {
62
+ "codedeploy": "codedeploy.eu-south-2.amazonaws.com",
63
+ },
64
+ "eu-west-1": {
65
+ "codedeploy": "codedeploy.eu-west-1.amazonaws.com",
66
+ },
67
+ "eu-west-2": {
68
+ "codedeploy": "codedeploy.eu-west-2.amazonaws.com",
69
+ },
70
+ "eu-west-3": {
71
+ "codedeploy": "codedeploy.eu-west-3.amazonaws.com",
72
+ },
73
+ "il-central-1": {
74
+ "codedeploy": "codedeploy.il-central-1.amazonaws.com",
75
+ },
76
+ "me-central-1": {
77
+ "codedeploy": "codedeploy.me-central-1.amazonaws.com",
78
+ },
79
+ "me-south-1": {
80
+ "codedeploy": "codedeploy.me-south-1.amazonaws.com",
81
+ },
82
+ "sa-east-1": {
83
+ "codedeploy": "codedeploy.sa-east-1.amazonaws.com",
84
+ },
85
+ "us-east-1": {
86
+ "codedeploy": "codedeploy.us-east-1.amazonaws.com",
87
+ },
88
+ "us-east-2": {
89
+ "codedeploy": "codedeploy.us-east-2.amazonaws.com",
90
+ },
91
+ "us-gov-east-1": {
92
+ "codedeploy": "codedeploy.us-gov-east-1.amazonaws.com",
93
+ },
94
+ "us-gov-west-1": {
95
+ "codedeploy": "codedeploy.us-gov-west-1.amazonaws.com",
96
+ },
97
+ "us-iso-east-1": {
98
+ "codedeploy": "codedeploy.amazonaws.com",
99
+ },
100
+ "us-iso-west-1": {
101
+ "codedeploy": "codedeploy.amazonaws.com",
102
+ },
103
+ "us-isob-east-1": {
104
+ "codedeploy": "codedeploy.amazonaws.com",
105
+ },
106
+ "us-west-1": {
107
+ "codedeploy": "codedeploy.us-west-1.amazonaws.com",
108
+ },
109
+ "us-west-2": {
110
+ "codedeploy": "codedeploy.us-west-2.amazonaws.com",
111
+ },
112
+ },
113
+ },
114
+ "Parameters": {
115
+ "BootstrapVersion": {
116
+ "Default": "/cdk-bootstrap/hnb659fds/version",
117
+ "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]",
118
+ "Type": "AWS::SSM::Parameter::Value<String>",
119
+ },
120
+ },
5
121
  "Resources": {
122
+ "codedeployalarm9F48D05F": {
123
+ "Properties": {
124
+ "ComparisonOperator": "GreaterThanOrEqualToThreshold",
125
+ "Dimensions": [
126
+ {
127
+ "Name": "FunctionName",
128
+ "Value": {
129
+ "Ref": "worker28EA3E30",
130
+ },
131
+ },
132
+ {
133
+ "Name": "Resource",
134
+ "Value": {
135
+ "Fn::Join": [
136
+ "",
137
+ [
138
+ {
139
+ "Ref": "worker28EA3E30",
140
+ },
141
+ ":live",
142
+ ],
143
+ ],
144
+ },
145
+ },
146
+ ],
147
+ "EvaluationPeriods": 1,
148
+ "MetricName": "Errors",
149
+ "Namespace": "AWS/Lambda",
150
+ "Period": 60,
151
+ "Statistic": "Sum",
152
+ "Threshold": 1,
153
+ },
154
+ "Type": "AWS::CloudWatch::Alarm",
155
+ },
156
+ "codedeployapplicationF49B9864": {
157
+ "Properties": {
158
+ "ComputePlatform": "Lambda",
159
+ },
160
+ "Type": "AWS::CodeDeploy::Application",
161
+ },
162
+ "codedeploygroup441B094B": {
163
+ "Properties": {
164
+ "AlarmConfiguration": {
165
+ "Alarms": [
166
+ {
167
+ "Name": {
168
+ "Ref": "codedeployalarm9F48D05F",
169
+ },
170
+ },
171
+ ],
172
+ "Enabled": true,
173
+ },
174
+ "ApplicationName": {
175
+ "Ref": "codedeployapplicationF49B9864",
176
+ },
177
+ "AutoRollbackConfiguration": {
178
+ "Enabled": true,
179
+ "Events": [
180
+ "DEPLOYMENT_FAILURE",
181
+ "DEPLOYMENT_STOP_ON_ALARM",
182
+ ],
183
+ },
184
+ "DeploymentConfigName": "CodeDeployDefault.LambdaAllAtOnce",
185
+ "DeploymentStyle": {
186
+ "DeploymentOption": "WITH_TRAFFIC_CONTROL",
187
+ "DeploymentType": "BLUE_GREEN",
188
+ },
189
+ "ServiceRoleArn": {
190
+ "Fn::GetAtt": [
191
+ "codedeploygroupServiceRole1BD49E37",
192
+ "Arn",
193
+ ],
194
+ },
195
+ },
196
+ "Type": "AWS::CodeDeploy::DeploymentGroup",
197
+ },
198
+ "codedeploygroupServiceRole1BD49E37": {
199
+ "Properties": {
200
+ "AssumeRolePolicyDocument": {
201
+ "Statement": [
202
+ {
203
+ "Action": "sts:AssumeRole",
204
+ "Effect": "Allow",
205
+ "Principal": {
206
+ "Service": {
207
+ "Fn::FindInMap": [
208
+ "ServiceprincipalMap",
209
+ {
210
+ "Ref": "AWS::Region",
211
+ },
212
+ "codedeploy",
213
+ ],
214
+ },
215
+ },
216
+ },
217
+ ],
218
+ "Version": "2012-10-17",
219
+ },
220
+ "ManagedPolicyArns": [
221
+ {
222
+ "Fn::Join": [
223
+ "",
224
+ [
225
+ "arn:",
226
+ {
227
+ "Ref": "AWS::Partition",
228
+ },
229
+ ":iam::aws:policy/service-role/AWSCodeDeployRoleForLambdaLimited",
230
+ ],
231
+ ],
232
+ },
233
+ ],
234
+ },
235
+ "Type": "AWS::IAM::Role",
236
+ },
237
+ "codedeploygroupServiceRoleDefaultPolicy2027BC9A": {
238
+ "Properties": {
239
+ "PolicyDocument": {
240
+ "Statement": [
241
+ {
242
+ "Action": "lambda:InvokeFunction",
243
+ "Effect": "Allow",
244
+ "Resource": [
245
+ {
246
+ "Fn::GetAtt": [
247
+ "workerprehook415B13CE",
248
+ "Arn",
249
+ ],
250
+ },
251
+ {
252
+ "Fn::Join": [
253
+ "",
254
+ [
255
+ {
256
+ "Fn::GetAtt": [
257
+ "workerprehook415B13CE",
258
+ "Arn",
259
+ ],
260
+ },
261
+ ":*",
262
+ ],
263
+ ],
264
+ },
265
+ ],
266
+ },
267
+ {
268
+ "Action": "lambda:InvokeFunction",
269
+ "Effect": "Allow",
270
+ "Resource": [
271
+ {
272
+ "Fn::GetAtt": [
273
+ "workerposthook150842D6",
274
+ "Arn",
275
+ ],
276
+ },
277
+ {
278
+ "Fn::Join": [
279
+ "",
280
+ [
281
+ {
282
+ "Fn::GetAtt": [
283
+ "workerposthook150842D6",
284
+ "Arn",
285
+ ],
286
+ },
287
+ ":*",
288
+ ],
289
+ ],
290
+ },
291
+ ],
292
+ },
293
+ ],
294
+ "Version": "2012-10-17",
295
+ },
296
+ "PolicyName": "codedeploygroupServiceRoleDefaultPolicy2027BC9A",
297
+ "Roles": [
298
+ {
299
+ "Ref": "codedeploygroupServiceRole1BD49E37",
300
+ },
301
+ ],
302
+ },
303
+ "Type": "AWS::IAM::Policy",
304
+ },
6
305
  "kmskey49FBC3B3": {
7
306
  "DeletionPolicy": "Retain",
8
307
  "Properties": {
@@ -128,16 +427,7 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
128
427
  },
129
428
  "Type": "AWS::KMS::Alias",
130
429
  },
131
- "topic69831491": {
132
- "Properties": {
133
- "KmsMasterKeyId": {
134
- "Fn::GetAtt": [
135
- "kmskey49FBC3B3",
136
- "Arn",
137
- ],
138
- },
139
- "TopicName": "serviceName",
140
- },
430
+ "sourcetopic7C3DC892": {
141
431
  "Type": "AWS::SNS::Topic",
142
432
  },
143
433
  "worker28EA3E30": {
@@ -155,6 +445,7 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
155
445
  },
156
446
  "S3Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.zip",
157
447
  },
448
+ "Description": "Updated at 1212-12-12T12:12:12.121Z",
158
449
  "Environment": {
159
450
  "Variables": {
160
451
  "NODE_ENV": "production",
@@ -163,13 +454,14 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
163
454
  },
164
455
  },
165
456
  "FunctionName": "serviceName",
166
- "Handler": "app.handler",
457
+ "Handler": "index.handler",
167
458
  "KmsKeyArn": {
168
459
  "Fn::GetAtt": [
169
460
  "kmskey49FBC3B3",
170
461
  "Arn",
171
462
  ],
172
463
  },
464
+ "ReservedConcurrentExecutions": 2,
173
465
  "Role": {
174
466
  "Fn::GetAtt": [
175
467
  "workerServiceRole2130CC7F",
@@ -177,9 +469,85 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
177
469
  ],
178
470
  },
179
471
  "Runtime": "nodejs20.x",
472
+ "Timeout": 30,
180
473
  },
181
474
  "Type": "AWS::Lambda::Function",
182
475
  },
476
+ "workerAliaslive62FE5FAF": {
477
+ "Properties": {
478
+ "Description": "The Lambda version currently receiving traffic",
479
+ "FunctionName": {
480
+ "Ref": "worker28EA3E30",
481
+ },
482
+ "FunctionVersion": {
483
+ "Fn::GetAtt": [
484
+ "workerCurrentVersionFA5B4BF4c6e1b764a3a99fdb70911ac06ee9afd5",
485
+ "Version",
486
+ ],
487
+ },
488
+ "Name": "live",
489
+ },
490
+ "Type": "AWS::Lambda::Alias",
491
+ "UpdatePolicy": {
492
+ "CodeDeployLambdaAliasUpdate": {
493
+ "AfterAllowTrafficHook": {
494
+ "Ref": "workerposthook150842D6",
495
+ },
496
+ "ApplicationName": {
497
+ "Ref": "codedeployapplicationF49B9864",
498
+ },
499
+ "BeforeAllowTrafficHook": {
500
+ "Ref": "workerprehook415B13CE",
501
+ },
502
+ "DeploymentGroupName": {
503
+ "Ref": "codedeploygroup441B094B",
504
+ },
505
+ },
506
+ },
507
+ },
508
+ "workerAliasliveSqsEventSourceappStackworkerqueue8281B9F42DEDB47B": {
509
+ "Properties": {
510
+ "EventSourceArn": {
511
+ "Fn::GetAtt": [
512
+ "workerqueueA05CE5C6",
513
+ "Arn",
514
+ ],
515
+ },
516
+ "FunctionName": {
517
+ "Fn::Join": [
518
+ "",
519
+ [
520
+ {
521
+ "Fn::Select": [
522
+ 6,
523
+ {
524
+ "Fn::Split": [
525
+ ":",
526
+ {
527
+ "Ref": "workerAliaslive62FE5FAF",
528
+ },
529
+ ],
530
+ },
531
+ ],
532
+ },
533
+ ":live",
534
+ ],
535
+ ],
536
+ },
537
+ "ScalingConfig": {
538
+ "MaximumConcurrency": 2,
539
+ },
540
+ },
541
+ "Type": "AWS::Lambda::EventSourceMapping",
542
+ },
543
+ "workerCurrentVersionFA5B4BF4c6e1b764a3a99fdb70911ac06ee9afd5": {
544
+ "Properties": {
545
+ "FunctionName": {
546
+ "Ref": "worker28EA3E30",
547
+ },
548
+ },
549
+ "Type": "AWS::Lambda::Version",
550
+ },
183
551
  "workerServiceRole2130CC7F": {
184
552
  "Properties": {
185
553
  "AssumeRolePolicyDocument": {
@@ -253,56 +621,342 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
253
621
  },
254
622
  "Type": "AWS::IAM::Policy",
255
623
  },
256
- "workerSqsEventSourceappStackworkerqueue8281B9F47B9F582B": {
624
+ "workerposthook150842D6": {
625
+ "DependsOn": [
626
+ "workerposthookServiceRoleDefaultPolicy6A92F69C",
627
+ "workerposthookServiceRole25452300",
628
+ ],
257
629
  "Properties": {
258
- "EventSourceArn": {
259
- "Fn::GetAtt": [
260
- "workerqueueA05CE5C6",
261
- "Arn",
262
- ],
630
+ "Architectures": [
631
+ "arm64",
632
+ ],
633
+ "Code": {
634
+ "S3Bucket": {
635
+ "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}",
636
+ },
637
+ "S3Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.zip",
263
638
  },
264
- "FunctionName": {
265
- "Ref": "worker28EA3E30",
639
+ "Environment": {
640
+ "Variables": {
641
+ "FUNCTION_NAME_TO_PRUNE": {
642
+ "Ref": "worker28EA3E30",
643
+ },
644
+ "NODE_ENV": "production",
645
+ "NODE_OPTIONS": "--enable-source-maps",
646
+ "SOMETHING": "dev",
647
+ },
266
648
  },
267
- },
268
- "Type": "AWS::Lambda::EventSourceMapping",
269
- },
270
- "workerqueueA05CE5C6": {
271
- "DeletionPolicy": "Delete",
272
- "Properties": {
273
- "KmsMasterKeyId": {
649
+ "FunctionName": "serviceName-post-hook",
650
+ "Handler": "index.handler",
651
+ "KmsKeyArn": {
274
652
  "Fn::GetAtt": [
275
653
  "kmskey49FBC3B3",
276
654
  "Arn",
277
655
  ],
278
656
  },
279
- "QueueName": "serviceName",
280
- "RedrivePolicy": {
281
- "deadLetterTargetArn": {
282
- "Fn::GetAtt": [
283
- "workerqueuedlq42262778",
284
- "Arn",
285
- ],
286
- },
287
- "maxReceiveCount": 3,
657
+ "Role": {
658
+ "Fn::GetAtt": [
659
+ "workerposthookServiceRole25452300",
660
+ "Arn",
661
+ ],
288
662
  },
663
+ "Runtime": "nodejs20.x",
664
+ "Timeout": 30,
289
665
  },
290
- "Type": "AWS::SQS::Queue",
291
- "UpdateReplacePolicy": "Delete",
666
+ "Type": "AWS::Lambda::Function",
292
667
  },
293
- "workerqueuePolicy97054CB4": {
668
+ "workerposthookServiceRole25452300": {
294
669
  "Properties": {
295
- "PolicyDocument": {
670
+ "AssumeRolePolicyDocument": {
296
671
  "Statement": [
297
672
  {
298
- "Action": "sqs:SendMessage",
299
- "Condition": {
300
- "ArnEquals": {
301
- "aws:SourceArn": {
302
- "Ref": "topic69831491",
303
- },
304
- },
305
- },
673
+ "Action": "sts:AssumeRole",
674
+ "Effect": "Allow",
675
+ "Principal": {
676
+ "Service": "lambda.amazonaws.com",
677
+ },
678
+ },
679
+ ],
680
+ "Version": "2012-10-17",
681
+ },
682
+ "ManagedPolicyArns": [
683
+ {
684
+ "Fn::Join": [
685
+ "",
686
+ [
687
+ "arn:",
688
+ {
689
+ "Ref": "AWS::Partition",
690
+ },
691
+ ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
692
+ ],
693
+ ],
694
+ },
695
+ ],
696
+ },
697
+ "Type": "AWS::IAM::Role",
698
+ },
699
+ "workerposthookServiceRoleDefaultPolicy6A92F69C": {
700
+ "Properties": {
701
+ "PolicyDocument": {
702
+ "Statement": [
703
+ {
704
+ "Action": [
705
+ "lambda:ListAliases",
706
+ "lambda:ListVersionsByFunction",
707
+ "lambda:DeleteFunction",
708
+ ],
709
+ "Effect": "Allow",
710
+ "Resource": [
711
+ {
712
+ "Fn::GetAtt": [
713
+ "worker28EA3E30",
714
+ "Arn",
715
+ ],
716
+ },
717
+ {
718
+ "Fn::Join": [
719
+ "",
720
+ [
721
+ {
722
+ "Fn::GetAtt": [
723
+ "worker28EA3E30",
724
+ "Arn",
725
+ ],
726
+ },
727
+ ":*",
728
+ ],
729
+ ],
730
+ },
731
+ ],
732
+ },
733
+ {
734
+ "Action": "codedeploy:PutLifecycleEventHookExecutionStatus",
735
+ "Effect": "Allow",
736
+ "Resource": {
737
+ "Fn::Join": [
738
+ "",
739
+ [
740
+ "arn:",
741
+ {
742
+ "Ref": "AWS::Partition",
743
+ },
744
+ ":codedeploy:",
745
+ {
746
+ "Ref": "AWS::Region",
747
+ },
748
+ ":",
749
+ {
750
+ "Ref": "AWS::AccountId",
751
+ },
752
+ ":deploymentgroup:",
753
+ {
754
+ "Ref": "codedeployapplicationF49B9864",
755
+ },
756
+ "/",
757
+ {
758
+ "Ref": "codedeploygroup441B094B",
759
+ },
760
+ ],
761
+ ],
762
+ },
763
+ },
764
+ ],
765
+ "Version": "2012-10-17",
766
+ },
767
+ "PolicyName": "workerposthookServiceRoleDefaultPolicy6A92F69C",
768
+ "Roles": [
769
+ {
770
+ "Ref": "workerposthookServiceRole25452300",
771
+ },
772
+ ],
773
+ },
774
+ "Type": "AWS::IAM::Policy",
775
+ },
776
+ "workerprehook415B13CE": {
777
+ "DependsOn": [
778
+ "workerprehookServiceRoleDefaultPolicy991A21B9",
779
+ "workerprehookServiceRole8F8D9379",
780
+ ],
781
+ "Properties": {
782
+ "Architectures": [
783
+ "arm64",
784
+ ],
785
+ "Code": {
786
+ "S3Bucket": {
787
+ "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}",
788
+ },
789
+ "S3Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.zip",
790
+ },
791
+ "Environment": {
792
+ "Variables": {
793
+ "FUNCTION_NAME_TO_INVOKE": {
794
+ "Ref": "worker28EA3E30",
795
+ },
796
+ "NODE_ENV": "production",
797
+ "NODE_OPTIONS": "--enable-source-maps",
798
+ "SOMETHING": "dev",
799
+ },
800
+ },
801
+ "FunctionName": "serviceName-pre-hook",
802
+ "Handler": "index.handler",
803
+ "KmsKeyArn": {
804
+ "Fn::GetAtt": [
805
+ "kmskey49FBC3B3",
806
+ "Arn",
807
+ ],
808
+ },
809
+ "Role": {
810
+ "Fn::GetAtt": [
811
+ "workerprehookServiceRole8F8D9379",
812
+ "Arn",
813
+ ],
814
+ },
815
+ "Runtime": "nodejs20.x",
816
+ "Timeout": 120,
817
+ },
818
+ "Type": "AWS::Lambda::Function",
819
+ },
820
+ "workerprehookServiceRole8F8D9379": {
821
+ "Properties": {
822
+ "AssumeRolePolicyDocument": {
823
+ "Statement": [
824
+ {
825
+ "Action": "sts:AssumeRole",
826
+ "Effect": "Allow",
827
+ "Principal": {
828
+ "Service": "lambda.amazonaws.com",
829
+ },
830
+ },
831
+ ],
832
+ "Version": "2012-10-17",
833
+ },
834
+ "ManagedPolicyArns": [
835
+ {
836
+ "Fn::Join": [
837
+ "",
838
+ [
839
+ "arn:",
840
+ {
841
+ "Ref": "AWS::Partition",
842
+ },
843
+ ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
844
+ ],
845
+ ],
846
+ },
847
+ ],
848
+ },
849
+ "Type": "AWS::IAM::Role",
850
+ },
851
+ "workerprehookServiceRoleDefaultPolicy991A21B9": {
852
+ "Properties": {
853
+ "PolicyDocument": {
854
+ "Statement": [
855
+ {
856
+ "Action": "lambda:InvokeFunction",
857
+ "Effect": "Allow",
858
+ "Resource": [
859
+ {
860
+ "Fn::GetAtt": [
861
+ "worker28EA3E30",
862
+ "Arn",
863
+ ],
864
+ },
865
+ {
866
+ "Fn::Join": [
867
+ "",
868
+ [
869
+ {
870
+ "Fn::GetAtt": [
871
+ "worker28EA3E30",
872
+ "Arn",
873
+ ],
874
+ },
875
+ ":*",
876
+ ],
877
+ ],
878
+ },
879
+ ],
880
+ },
881
+ {
882
+ "Action": "codedeploy:PutLifecycleEventHookExecutionStatus",
883
+ "Effect": "Allow",
884
+ "Resource": {
885
+ "Fn::Join": [
886
+ "",
887
+ [
888
+ "arn:",
889
+ {
890
+ "Ref": "AWS::Partition",
891
+ },
892
+ ":codedeploy:",
893
+ {
894
+ "Ref": "AWS::Region",
895
+ },
896
+ ":",
897
+ {
898
+ "Ref": "AWS::AccountId",
899
+ },
900
+ ":deploymentgroup:",
901
+ {
902
+ "Ref": "codedeployapplicationF49B9864",
903
+ },
904
+ "/",
905
+ {
906
+ "Ref": "codedeploygroup441B094B",
907
+ },
908
+ ],
909
+ ],
910
+ },
911
+ },
912
+ ],
913
+ "Version": "2012-10-17",
914
+ },
915
+ "PolicyName": "workerprehookServiceRoleDefaultPolicy991A21B9",
916
+ "Roles": [
917
+ {
918
+ "Ref": "workerprehookServiceRole8F8D9379",
919
+ },
920
+ ],
921
+ },
922
+ "Type": "AWS::IAM::Policy",
923
+ },
924
+ "workerqueueA05CE5C6": {
925
+ "DeletionPolicy": "Delete",
926
+ "Properties": {
927
+ "KmsMasterKeyId": {
928
+ "Fn::GetAtt": [
929
+ "kmskey49FBC3B3",
930
+ "Arn",
931
+ ],
932
+ },
933
+ "QueueName": "serviceName",
934
+ "RedrivePolicy": {
935
+ "deadLetterTargetArn": {
936
+ "Fn::GetAtt": [
937
+ "workerqueuedlq42262778",
938
+ "Arn",
939
+ ],
940
+ },
941
+ "maxReceiveCount": 3,
942
+ },
943
+ },
944
+ "Type": "AWS::SQS::Queue",
945
+ "UpdateReplacePolicy": "Delete",
946
+ },
947
+ "workerqueuePolicy97054CB4": {
948
+ "Properties": {
949
+ "PolicyDocument": {
950
+ "Statement": [
951
+ {
952
+ "Action": "sqs:SendMessage",
953
+ "Condition": {
954
+ "ArnEquals": {
955
+ "aws:SourceArn": {
956
+ "Ref": "sourcetopic7C3DC892",
957
+ },
958
+ },
959
+ },
306
960
  "Effect": "Allow",
307
961
  "Principal": {
308
962
  "Service": "sns.amazonaws.com",
@@ -319,192 +973,852 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
319
973
  },
320
974
  "Queues": [
321
975
  {
322
- "Ref": "workerqueueA05CE5C6",
976
+ "Ref": "workerqueueA05CE5C6",
977
+ },
978
+ ],
979
+ },
980
+ "Type": "AWS::SQS::QueuePolicy",
981
+ },
982
+ "workerqueueappStacksourcetopic613C6BDBD2F224F5": {
983
+ "DependsOn": [
984
+ "workerqueuePolicy97054CB4",
985
+ ],
986
+ "Properties": {
987
+ "Endpoint": {
988
+ "Fn::GetAtt": [
989
+ "workerqueueA05CE5C6",
990
+ "Arn",
991
+ ],
992
+ },
993
+ "Protocol": "sqs",
994
+ "TopicArn": {
995
+ "Ref": "sourcetopic7C3DC892",
996
+ },
997
+ },
998
+ "Type": "AWS::SNS::Subscription",
999
+ },
1000
+ "workerqueuedlq42262778": {
1001
+ "DeletionPolicy": "Delete",
1002
+ "Properties": {
1003
+ "KmsMasterKeyId": {
1004
+ "Fn::GetAtt": [
1005
+ "kmskey49FBC3B3",
1006
+ "Arn",
1007
+ ],
1008
+ },
1009
+ "QueueName": "serviceName-dlq",
1010
+ },
1011
+ "Type": "AWS::SQS::Queue",
1012
+ "UpdateReplacePolicy": "Delete",
1013
+ },
1014
+ },
1015
+ "Rules": {
1016
+ "CheckBootstrapVersion": {
1017
+ "Assertions": [
1018
+ {
1019
+ "Assert": {
1020
+ "Fn::Not": [
1021
+ {
1022
+ "Fn::Contains": [
1023
+ [
1024
+ "1",
1025
+ "2",
1026
+ "3",
1027
+ "4",
1028
+ "5",
1029
+ ],
1030
+ {
1031
+ "Ref": "BootstrapVersion",
1032
+ },
1033
+ ],
1034
+ },
1035
+ ],
1036
+ },
1037
+ "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI.",
1038
+ },
1039
+ ],
1040
+ },
1041
+ },
1042
+ }
1043
+ `;
1044
+
1045
+ exports[`returns expected CloudFormation stack for prod 1`] = `
1046
+ {
1047
+ "Mappings": {
1048
+ "ServiceprincipalMap": {
1049
+ "af-south-1": {
1050
+ "codedeploy": "codedeploy.af-south-1.amazonaws.com",
1051
+ },
1052
+ "ap-east-1": {
1053
+ "codedeploy": "codedeploy.ap-east-1.amazonaws.com",
1054
+ },
1055
+ "ap-northeast-1": {
1056
+ "codedeploy": "codedeploy.ap-northeast-1.amazonaws.com",
1057
+ },
1058
+ "ap-northeast-2": {
1059
+ "codedeploy": "codedeploy.ap-northeast-2.amazonaws.com",
1060
+ },
1061
+ "ap-northeast-3": {
1062
+ "codedeploy": "codedeploy.ap-northeast-3.amazonaws.com",
1063
+ },
1064
+ "ap-south-1": {
1065
+ "codedeploy": "codedeploy.ap-south-1.amazonaws.com",
1066
+ },
1067
+ "ap-south-2": {
1068
+ "codedeploy": "codedeploy.ap-south-2.amazonaws.com",
1069
+ },
1070
+ "ap-southeast-1": {
1071
+ "codedeploy": "codedeploy.ap-southeast-1.amazonaws.com",
1072
+ },
1073
+ "ap-southeast-2": {
1074
+ "codedeploy": "codedeploy.ap-southeast-2.amazonaws.com",
1075
+ },
1076
+ "ap-southeast-3": {
1077
+ "codedeploy": "codedeploy.ap-southeast-3.amazonaws.com",
1078
+ },
1079
+ "ap-southeast-4": {
1080
+ "codedeploy": "codedeploy.ap-southeast-4.amazonaws.com",
1081
+ },
1082
+ "ca-central-1": {
1083
+ "codedeploy": "codedeploy.ca-central-1.amazonaws.com",
1084
+ },
1085
+ "cn-north-1": {
1086
+ "codedeploy": "codedeploy.cn-north-1.amazonaws.com.cn",
1087
+ },
1088
+ "cn-northwest-1": {
1089
+ "codedeploy": "codedeploy.cn-northwest-1.amazonaws.com.cn",
1090
+ },
1091
+ "eu-central-1": {
1092
+ "codedeploy": "codedeploy.eu-central-1.amazonaws.com",
1093
+ },
1094
+ "eu-central-2": {
1095
+ "codedeploy": "codedeploy.eu-central-2.amazonaws.com",
1096
+ },
1097
+ "eu-north-1": {
1098
+ "codedeploy": "codedeploy.eu-north-1.amazonaws.com",
1099
+ },
1100
+ "eu-south-1": {
1101
+ "codedeploy": "codedeploy.eu-south-1.amazonaws.com",
1102
+ },
1103
+ "eu-south-2": {
1104
+ "codedeploy": "codedeploy.eu-south-2.amazonaws.com",
1105
+ },
1106
+ "eu-west-1": {
1107
+ "codedeploy": "codedeploy.eu-west-1.amazonaws.com",
1108
+ },
1109
+ "eu-west-2": {
1110
+ "codedeploy": "codedeploy.eu-west-2.amazonaws.com",
1111
+ },
1112
+ "eu-west-3": {
1113
+ "codedeploy": "codedeploy.eu-west-3.amazonaws.com",
1114
+ },
1115
+ "il-central-1": {
1116
+ "codedeploy": "codedeploy.il-central-1.amazonaws.com",
1117
+ },
1118
+ "me-central-1": {
1119
+ "codedeploy": "codedeploy.me-central-1.amazonaws.com",
1120
+ },
1121
+ "me-south-1": {
1122
+ "codedeploy": "codedeploy.me-south-1.amazonaws.com",
1123
+ },
1124
+ "sa-east-1": {
1125
+ "codedeploy": "codedeploy.sa-east-1.amazonaws.com",
1126
+ },
1127
+ "us-east-1": {
1128
+ "codedeploy": "codedeploy.us-east-1.amazonaws.com",
1129
+ },
1130
+ "us-east-2": {
1131
+ "codedeploy": "codedeploy.us-east-2.amazonaws.com",
1132
+ },
1133
+ "us-gov-east-1": {
1134
+ "codedeploy": "codedeploy.us-gov-east-1.amazonaws.com",
1135
+ },
1136
+ "us-gov-west-1": {
1137
+ "codedeploy": "codedeploy.us-gov-west-1.amazonaws.com",
1138
+ },
1139
+ "us-iso-east-1": {
1140
+ "codedeploy": "codedeploy.amazonaws.com",
1141
+ },
1142
+ "us-iso-west-1": {
1143
+ "codedeploy": "codedeploy.amazonaws.com",
1144
+ },
1145
+ "us-isob-east-1": {
1146
+ "codedeploy": "codedeploy.amazonaws.com",
1147
+ },
1148
+ "us-west-1": {
1149
+ "codedeploy": "codedeploy.us-west-1.amazonaws.com",
1150
+ },
1151
+ "us-west-2": {
1152
+ "codedeploy": "codedeploy.us-west-2.amazonaws.com",
1153
+ },
1154
+ },
1155
+ },
1156
+ "Parameters": {
1157
+ "BootstrapVersion": {
1158
+ "Default": "/cdk-bootstrap/hnb659fds/version",
1159
+ "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]",
1160
+ "Type": "AWS::SSM::Parameter::Value<String>",
1161
+ },
1162
+ },
1163
+ "Resources": {
1164
+ "codedeployalarm9F48D05F": {
1165
+ "Properties": {
1166
+ "ComparisonOperator": "GreaterThanOrEqualToThreshold",
1167
+ "Dimensions": [
1168
+ {
1169
+ "Name": "FunctionName",
1170
+ "Value": {
1171
+ "Ref": "worker28EA3E30",
1172
+ },
1173
+ },
1174
+ {
1175
+ "Name": "Resource",
1176
+ "Value": {
1177
+ "Fn::Join": [
1178
+ "",
1179
+ [
1180
+ {
1181
+ "Ref": "worker28EA3E30",
1182
+ },
1183
+ ":live",
1184
+ ],
1185
+ ],
1186
+ },
1187
+ },
1188
+ ],
1189
+ "EvaluationPeriods": 1,
1190
+ "MetricName": "Errors",
1191
+ "Namespace": "AWS/Lambda",
1192
+ "Period": 60,
1193
+ "Statistic": "Sum",
1194
+ "Threshold": 1,
1195
+ },
1196
+ "Type": "AWS::CloudWatch::Alarm",
1197
+ },
1198
+ "codedeployapplicationF49B9864": {
1199
+ "Properties": {
1200
+ "ComputePlatform": "Lambda",
1201
+ },
1202
+ "Type": "AWS::CodeDeploy::Application",
1203
+ },
1204
+ "codedeploygroup441B094B": {
1205
+ "Properties": {
1206
+ "AlarmConfiguration": {
1207
+ "Alarms": [
1208
+ {
1209
+ "Name": {
1210
+ "Ref": "codedeployalarm9F48D05F",
1211
+ },
1212
+ },
1213
+ ],
1214
+ "Enabled": true,
1215
+ },
1216
+ "ApplicationName": {
1217
+ "Ref": "codedeployapplicationF49B9864",
1218
+ },
1219
+ "AutoRollbackConfiguration": {
1220
+ "Enabled": true,
1221
+ "Events": [
1222
+ "DEPLOYMENT_FAILURE",
1223
+ "DEPLOYMENT_STOP_ON_ALARM",
1224
+ ],
1225
+ },
1226
+ "DeploymentConfigName": "CodeDeployDefault.LambdaAllAtOnce",
1227
+ "DeploymentStyle": {
1228
+ "DeploymentOption": "WITH_TRAFFIC_CONTROL",
1229
+ "DeploymentType": "BLUE_GREEN",
1230
+ },
1231
+ "ServiceRoleArn": {
1232
+ "Fn::GetAtt": [
1233
+ "codedeploygroupServiceRole1BD49E37",
1234
+ "Arn",
1235
+ ],
1236
+ },
1237
+ },
1238
+ "Type": "AWS::CodeDeploy::DeploymentGroup",
1239
+ },
1240
+ "codedeploygroupServiceRole1BD49E37": {
1241
+ "Properties": {
1242
+ "AssumeRolePolicyDocument": {
1243
+ "Statement": [
1244
+ {
1245
+ "Action": "sts:AssumeRole",
1246
+ "Effect": "Allow",
1247
+ "Principal": {
1248
+ "Service": {
1249
+ "Fn::FindInMap": [
1250
+ "ServiceprincipalMap",
1251
+ {
1252
+ "Ref": "AWS::Region",
1253
+ },
1254
+ "codedeploy",
1255
+ ],
1256
+ },
1257
+ },
1258
+ },
1259
+ ],
1260
+ "Version": "2012-10-17",
1261
+ },
1262
+ "ManagedPolicyArns": [
1263
+ {
1264
+ "Fn::Join": [
1265
+ "",
1266
+ [
1267
+ "arn:",
1268
+ {
1269
+ "Ref": "AWS::Partition",
1270
+ },
1271
+ ":iam::aws:policy/service-role/AWSCodeDeployRoleForLambdaLimited",
1272
+ ],
1273
+ ],
1274
+ },
1275
+ ],
1276
+ },
1277
+ "Type": "AWS::IAM::Role",
1278
+ },
1279
+ "codedeploygroupServiceRoleDefaultPolicy2027BC9A": {
1280
+ "Properties": {
1281
+ "PolicyDocument": {
1282
+ "Statement": [
1283
+ {
1284
+ "Action": "lambda:InvokeFunction",
1285
+ "Effect": "Allow",
1286
+ "Resource": [
1287
+ {
1288
+ "Fn::GetAtt": [
1289
+ "workerprehook415B13CE",
1290
+ "Arn",
1291
+ ],
1292
+ },
1293
+ {
1294
+ "Fn::Join": [
1295
+ "",
1296
+ [
1297
+ {
1298
+ "Fn::GetAtt": [
1299
+ "workerprehook415B13CE",
1300
+ "Arn",
1301
+ ],
1302
+ },
1303
+ ":*",
1304
+ ],
1305
+ ],
1306
+ },
1307
+ ],
1308
+ },
1309
+ {
1310
+ "Action": "lambda:InvokeFunction",
1311
+ "Effect": "Allow",
1312
+ "Resource": [
1313
+ {
1314
+ "Fn::GetAtt": [
1315
+ "workerposthook150842D6",
1316
+ "Arn",
1317
+ ],
1318
+ },
1319
+ {
1320
+ "Fn::Join": [
1321
+ "",
1322
+ [
1323
+ {
1324
+ "Fn::GetAtt": [
1325
+ "workerposthook150842D6",
1326
+ "Arn",
1327
+ ],
1328
+ },
1329
+ ":*",
1330
+ ],
1331
+ ],
1332
+ },
1333
+ ],
1334
+ },
1335
+ ],
1336
+ "Version": "2012-10-17",
1337
+ },
1338
+ "PolicyName": "codedeploygroupServiceRoleDefaultPolicy2027BC9A",
1339
+ "Roles": [
1340
+ {
1341
+ "Ref": "codedeploygroupServiceRole1BD49E37",
1342
+ },
1343
+ ],
1344
+ },
1345
+ "Type": "AWS::IAM::Policy",
1346
+ },
1347
+ "kmskey49FBC3B3": {
1348
+ "DeletionPolicy": "Retain",
1349
+ "Properties": {
1350
+ "Description": "serviceName",
1351
+ "EnableKeyRotation": true,
1352
+ "KeyPolicy": {
1353
+ "Statement": [
1354
+ {
1355
+ "Action": "kms:*",
1356
+ "Effect": "Allow",
1357
+ "Principal": {
1358
+ "AWS": {
1359
+ "Fn::Join": [
1360
+ "",
1361
+ [
1362
+ "arn:",
1363
+ {
1364
+ "Ref": "AWS::Partition",
1365
+ },
1366
+ ":iam::",
1367
+ {
1368
+ "Ref": "AWS::AccountId",
1369
+ },
1370
+ ":root",
1371
+ ],
1372
+ ],
1373
+ },
1374
+ },
1375
+ "Resource": "*",
1376
+ },
1377
+ {
1378
+ "Action": [
1379
+ "kms:Create*",
1380
+ "kms:Describe*",
1381
+ "kms:Enable*",
1382
+ "kms:List*",
1383
+ "kms:Put*",
1384
+ "kms:Update*",
1385
+ "kms:Revoke*",
1386
+ "kms:Disable*",
1387
+ "kms:Get*",
1388
+ "kms:Delete*",
1389
+ "kms:TagResource",
1390
+ "kms:UntagResource",
1391
+ "kms:ScheduleKeyDeletion",
1392
+ "kms:CancelKeyDeletion",
1393
+ ],
1394
+ "Effect": "Allow",
1395
+ "Principal": {
1396
+ "AWS": {
1397
+ "Fn::Join": [
1398
+ "",
1399
+ [
1400
+ "arn:",
1401
+ {
1402
+ "Ref": "AWS::Partition",
1403
+ },
1404
+ ":iam::",
1405
+ {
1406
+ "Ref": "AWS::AccountId",
1407
+ },
1408
+ ":root",
1409
+ ],
1410
+ ],
1411
+ },
1412
+ },
1413
+ "Resource": "*",
1414
+ },
1415
+ {
1416
+ "Action": [
1417
+ "kms:Encrypt",
1418
+ "kms:ReEncrypt*",
1419
+ "kms:GenerateDataKey*",
1420
+ ],
1421
+ "Effect": "Allow",
1422
+ "Principal": {
1423
+ "AWS": {
1424
+ "Fn::Join": [
1425
+ "",
1426
+ [
1427
+ "arn:",
1428
+ {
1429
+ "Ref": "AWS::Partition",
1430
+ },
1431
+ ":iam::",
1432
+ {
1433
+ "Ref": "AWS::AccountId",
1434
+ },
1435
+ ":root",
1436
+ ],
1437
+ ],
1438
+ },
1439
+ },
1440
+ "Resource": "*",
1441
+ },
1442
+ {
1443
+ "Action": [
1444
+ "kms:Decrypt",
1445
+ "kms:GenerateDataKey",
1446
+ ],
1447
+ "Effect": "Allow",
1448
+ "Principal": {
1449
+ "Service": "sns.amazonaws.com",
1450
+ },
1451
+ "Resource": "*",
1452
+ },
1453
+ ],
1454
+ "Version": "2012-10-17",
1455
+ },
1456
+ },
1457
+ "Type": "AWS::KMS::Key",
1458
+ "UpdateReplacePolicy": "Retain",
1459
+ },
1460
+ "kmskeyAlias39245779": {
1461
+ "Properties": {
1462
+ "AliasName": "alias/seek/self/serviceName",
1463
+ "TargetKeyId": {
1464
+ "Fn::GetAtt": [
1465
+ "kmskey49FBC3B3",
1466
+ "Arn",
1467
+ ],
1468
+ },
1469
+ },
1470
+ "Type": "AWS::KMS::Alias",
1471
+ },
1472
+ "sourcetopic7C3DC892": {
1473
+ "Type": "AWS::SNS::Topic",
1474
+ },
1475
+ "worker28EA3E30": {
1476
+ "DependsOn": [
1477
+ "workerServiceRoleDefaultPolicyBA498553",
1478
+ "workerServiceRole2130CC7F",
1479
+ ],
1480
+ "Properties": {
1481
+ "Architectures": [
1482
+ "arm64",
1483
+ ],
1484
+ "Code": {
1485
+ "S3Bucket": {
1486
+ "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}",
1487
+ },
1488
+ "S3Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.zip",
1489
+ },
1490
+ "Description": "Updated at 1212-12-12T12:12:12.121Z",
1491
+ "Environment": {
1492
+ "Variables": {
1493
+ "NODE_ENV": "production",
1494
+ "NODE_OPTIONS": "--enable-source-maps",
1495
+ "SOMETHING": "prod",
1496
+ },
1497
+ },
1498
+ "FunctionName": "serviceName",
1499
+ "Handler": "index.handler",
1500
+ "KmsKeyArn": {
1501
+ "Fn::GetAtt": [
1502
+ "kmskey49FBC3B3",
1503
+ "Arn",
1504
+ ],
1505
+ },
1506
+ "ReservedConcurrentExecutions": 20,
1507
+ "Role": {
1508
+ "Fn::GetAtt": [
1509
+ "workerServiceRole2130CC7F",
1510
+ "Arn",
1511
+ ],
1512
+ },
1513
+ "Runtime": "nodejs20.x",
1514
+ "Timeout": 30,
1515
+ },
1516
+ "Type": "AWS::Lambda::Function",
1517
+ },
1518
+ "workerAliaslive62FE5FAF": {
1519
+ "Properties": {
1520
+ "Description": "The Lambda version currently receiving traffic",
1521
+ "FunctionName": {
1522
+ "Ref": "worker28EA3E30",
1523
+ },
1524
+ "FunctionVersion": {
1525
+ "Fn::GetAtt": [
1526
+ "workerCurrentVersionFA5B4BF40f2ad063ab6223cdd6c6489f9188cf94",
1527
+ "Version",
1528
+ ],
1529
+ },
1530
+ "Name": "live",
1531
+ },
1532
+ "Type": "AWS::Lambda::Alias",
1533
+ "UpdatePolicy": {
1534
+ "CodeDeployLambdaAliasUpdate": {
1535
+ "AfterAllowTrafficHook": {
1536
+ "Ref": "workerposthook150842D6",
1537
+ },
1538
+ "ApplicationName": {
1539
+ "Ref": "codedeployapplicationF49B9864",
1540
+ },
1541
+ "BeforeAllowTrafficHook": {
1542
+ "Ref": "workerprehook415B13CE",
1543
+ },
1544
+ "DeploymentGroupName": {
1545
+ "Ref": "codedeploygroup441B094B",
1546
+ },
1547
+ },
1548
+ },
1549
+ },
1550
+ "workerAliasliveSqsEventSourceappStackworkerqueue8281B9F42DEDB47B": {
1551
+ "Properties": {
1552
+ "EventSourceArn": {
1553
+ "Fn::GetAtt": [
1554
+ "workerqueueA05CE5C6",
1555
+ "Arn",
1556
+ ],
1557
+ },
1558
+ "FunctionName": {
1559
+ "Fn::Join": [
1560
+ "",
1561
+ [
1562
+ {
1563
+ "Fn::Select": [
1564
+ 6,
1565
+ {
1566
+ "Fn::Split": [
1567
+ ":",
1568
+ {
1569
+ "Ref": "workerAliaslive62FE5FAF",
1570
+ },
1571
+ ],
1572
+ },
1573
+ ],
1574
+ },
1575
+ ":live",
1576
+ ],
1577
+ ],
1578
+ },
1579
+ "ScalingConfig": {
1580
+ "MaximumConcurrency": 20,
1581
+ },
1582
+ },
1583
+ "Type": "AWS::Lambda::EventSourceMapping",
1584
+ },
1585
+ "workerCurrentVersionFA5B4BF40f2ad063ab6223cdd6c6489f9188cf94": {
1586
+ "Properties": {
1587
+ "FunctionName": {
1588
+ "Ref": "worker28EA3E30",
1589
+ },
1590
+ },
1591
+ "Type": "AWS::Lambda::Version",
1592
+ },
1593
+ "workerServiceRole2130CC7F": {
1594
+ "Properties": {
1595
+ "AssumeRolePolicyDocument": {
1596
+ "Statement": [
1597
+ {
1598
+ "Action": "sts:AssumeRole",
1599
+ "Effect": "Allow",
1600
+ "Principal": {
1601
+ "Service": "lambda.amazonaws.com",
1602
+ },
1603
+ },
1604
+ ],
1605
+ "Version": "2012-10-17",
1606
+ },
1607
+ "ManagedPolicyArns": [
1608
+ {
1609
+ "Fn::Join": [
1610
+ "",
1611
+ [
1612
+ "arn:",
1613
+ {
1614
+ "Ref": "AWS::Partition",
1615
+ },
1616
+ ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
1617
+ ],
1618
+ ],
1619
+ },
1620
+ ],
1621
+ },
1622
+ "Type": "AWS::IAM::Role",
1623
+ },
1624
+ "workerServiceRoleDefaultPolicyBA498553": {
1625
+ "Properties": {
1626
+ "PolicyDocument": {
1627
+ "Statement": [
1628
+ {
1629
+ "Action": [
1630
+ "sqs:ReceiveMessage",
1631
+ "sqs:ChangeMessageVisibility",
1632
+ "sqs:GetQueueUrl",
1633
+ "sqs:DeleteMessage",
1634
+ "sqs:GetQueueAttributes",
1635
+ ],
1636
+ "Effect": "Allow",
1637
+ "Resource": {
1638
+ "Fn::GetAtt": [
1639
+ "workerqueueA05CE5C6",
1640
+ "Arn",
1641
+ ],
1642
+ },
1643
+ },
1644
+ {
1645
+ "Action": "kms:Decrypt",
1646
+ "Effect": "Allow",
1647
+ "Resource": {
1648
+ "Fn::GetAtt": [
1649
+ "kmskey49FBC3B3",
1650
+ "Arn",
1651
+ ],
1652
+ },
1653
+ },
1654
+ ],
1655
+ "Version": "2012-10-17",
1656
+ },
1657
+ "PolicyName": "workerServiceRoleDefaultPolicyBA498553",
1658
+ "Roles": [
1659
+ {
1660
+ "Ref": "workerServiceRole2130CC7F",
323
1661
  },
324
1662
  ],
325
1663
  },
326
- "Type": "AWS::SQS::QueuePolicy",
1664
+ "Type": "AWS::IAM::Policy",
327
1665
  },
328
- "workerqueueappStacktopic0CA45134AFB31FF4": {
1666
+ "workerposthook150842D6": {
329
1667
  "DependsOn": [
330
- "workerqueuePolicy97054CB4",
1668
+ "workerposthookServiceRoleDefaultPolicy6A92F69C",
1669
+ "workerposthookServiceRole25452300",
331
1670
  ],
332
1671
  "Properties": {
333
- "Endpoint": {
1672
+ "Architectures": [
1673
+ "arm64",
1674
+ ],
1675
+ "Code": {
1676
+ "S3Bucket": {
1677
+ "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}",
1678
+ },
1679
+ "S3Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.zip",
1680
+ },
1681
+ "Environment": {
1682
+ "Variables": {
1683
+ "FUNCTION_NAME_TO_PRUNE": {
1684
+ "Ref": "worker28EA3E30",
1685
+ },
1686
+ "NODE_ENV": "production",
1687
+ "NODE_OPTIONS": "--enable-source-maps",
1688
+ "SOMETHING": "prod",
1689
+ },
1690
+ },
1691
+ "FunctionName": "serviceName-post-hook",
1692
+ "Handler": "index.handler",
1693
+ "KmsKeyArn": {
334
1694
  "Fn::GetAtt": [
335
- "workerqueueA05CE5C6",
1695
+ "kmskey49FBC3B3",
336
1696
  "Arn",
337
1697
  ],
338
1698
  },
339
- "Protocol": "sqs",
340
- "TopicArn": {
341
- "Ref": "topic69831491",
342
- },
343
- },
344
- "Type": "AWS::SNS::Subscription",
345
- },
346
- "workerqueuedlq42262778": {
347
- "DeletionPolicy": "Delete",
348
- "Properties": {
349
- "KmsMasterKeyId": {
1699
+ "Role": {
350
1700
  "Fn::GetAtt": [
351
- "kmskey49FBC3B3",
1701
+ "workerposthookServiceRole25452300",
352
1702
  "Arn",
353
1703
  ],
354
1704
  },
355
- "QueueName": "serviceName-dlq",
1705
+ "Runtime": "nodejs20.x",
1706
+ "Timeout": 30,
356
1707
  },
357
- "Type": "AWS::SQS::Queue",
358
- "UpdateReplacePolicy": "Delete",
1708
+ "Type": "AWS::Lambda::Function",
359
1709
  },
360
- },
361
- }
362
- `;
363
-
364
- exports[`returns expected CloudFormation stack for prod 1`] = `
365
- {
366
- "Resources": {
367
- "kmskey49FBC3B3": {
368
- "DeletionPolicy": "Retain",
1710
+ "workerposthookServiceRole25452300": {
369
1711
  "Properties": {
370
- "Description": "serviceName",
371
- "EnableKeyRotation": true,
372
- "KeyPolicy": {
1712
+ "AssumeRolePolicyDocument": {
373
1713
  "Statement": [
374
1714
  {
375
- "Action": "kms:*",
1715
+ "Action": "sts:AssumeRole",
376
1716
  "Effect": "Allow",
377
1717
  "Principal": {
378
- "AWS": {
379
- "Fn::Join": [
380
- "",
381
- [
382
- "arn:",
383
- {
384
- "Ref": "AWS::Partition",
385
- },
386
- ":iam::",
387
- {
388
- "Ref": "AWS::AccountId",
389
- },
390
- ":root",
391
- ],
392
- ],
393
- },
1718
+ "Service": "lambda.amazonaws.com",
394
1719
  },
395
- "Resource": "*",
396
1720
  },
1721
+ ],
1722
+ "Version": "2012-10-17",
1723
+ },
1724
+ "ManagedPolicyArns": [
1725
+ {
1726
+ "Fn::Join": [
1727
+ "",
1728
+ [
1729
+ "arn:",
1730
+ {
1731
+ "Ref": "AWS::Partition",
1732
+ },
1733
+ ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
1734
+ ],
1735
+ ],
1736
+ },
1737
+ ],
1738
+ },
1739
+ "Type": "AWS::IAM::Role",
1740
+ },
1741
+ "workerposthookServiceRoleDefaultPolicy6A92F69C": {
1742
+ "Properties": {
1743
+ "PolicyDocument": {
1744
+ "Statement": [
397
1745
  {
398
1746
  "Action": [
399
- "kms:Create*",
400
- "kms:Describe*",
401
- "kms:Enable*",
402
- "kms:List*",
403
- "kms:Put*",
404
- "kms:Update*",
405
- "kms:Revoke*",
406
- "kms:Disable*",
407
- "kms:Get*",
408
- "kms:Delete*",
409
- "kms:TagResource",
410
- "kms:UntagResource",
411
- "kms:ScheduleKeyDeletion",
412
- "kms:CancelKeyDeletion",
1747
+ "lambda:ListAliases",
1748
+ "lambda:ListVersionsByFunction",
1749
+ "lambda:DeleteFunction",
413
1750
  ],
414
1751
  "Effect": "Allow",
415
- "Principal": {
416
- "AWS": {
417
- "Fn::Join": [
418
- "",
419
- [
420
- "arn:",
421
- {
422
- "Ref": "AWS::Partition",
423
- },
424
- ":iam::",
425
- {
426
- "Ref": "AWS::AccountId",
427
- },
428
- ":root",
429
- ],
1752
+ "Resource": [
1753
+ {
1754
+ "Fn::GetAtt": [
1755
+ "worker28EA3E30",
1756
+ "Arn",
430
1757
  ],
431
1758
  },
432
- },
433
- "Resource": "*",
434
- },
435
- {
436
- "Action": [
437
- "kms:Encrypt",
438
- "kms:ReEncrypt*",
439
- "kms:GenerateDataKey*",
440
- ],
441
- "Effect": "Allow",
442
- "Principal": {
443
- "AWS": {
1759
+ {
444
1760
  "Fn::Join": [
445
1761
  "",
446
1762
  [
447
- "arn:",
448
1763
  {
449
- "Ref": "AWS::Partition",
450
- },
451
- ":iam::",
452
- {
453
- "Ref": "AWS::AccountId",
1764
+ "Fn::GetAtt": [
1765
+ "worker28EA3E30",
1766
+ "Arn",
1767
+ ],
454
1768
  },
455
- ":root",
1769
+ ":*",
456
1770
  ],
457
1771
  ],
458
1772
  },
459
- },
460
- "Resource": "*",
1773
+ ],
461
1774
  },
462
1775
  {
463
- "Action": [
464
- "kms:Decrypt",
465
- "kms:GenerateDataKey",
466
- ],
1776
+ "Action": "codedeploy:PutLifecycleEventHookExecutionStatus",
467
1777
  "Effect": "Allow",
468
- "Principal": {
469
- "Service": "sns.amazonaws.com",
1778
+ "Resource": {
1779
+ "Fn::Join": [
1780
+ "",
1781
+ [
1782
+ "arn:",
1783
+ {
1784
+ "Ref": "AWS::Partition",
1785
+ },
1786
+ ":codedeploy:",
1787
+ {
1788
+ "Ref": "AWS::Region",
1789
+ },
1790
+ ":",
1791
+ {
1792
+ "Ref": "AWS::AccountId",
1793
+ },
1794
+ ":deploymentgroup:",
1795
+ {
1796
+ "Ref": "codedeployapplicationF49B9864",
1797
+ },
1798
+ "/",
1799
+ {
1800
+ "Ref": "codedeploygroup441B094B",
1801
+ },
1802
+ ],
1803
+ ],
470
1804
  },
471
- "Resource": "*",
472
1805
  },
473
1806
  ],
474
1807
  "Version": "2012-10-17",
475
1808
  },
1809
+ "PolicyName": "workerposthookServiceRoleDefaultPolicy6A92F69C",
1810
+ "Roles": [
1811
+ {
1812
+ "Ref": "workerposthookServiceRole25452300",
1813
+ },
1814
+ ],
476
1815
  },
477
- "Type": "AWS::KMS::Key",
478
- "UpdateReplacePolicy": "Retain",
479
- },
480
- "kmskeyAlias39245779": {
481
- "Properties": {
482
- "AliasName": "alias/seek/self/serviceName",
483
- "TargetKeyId": {
484
- "Fn::GetAtt": [
485
- "kmskey49FBC3B3",
486
- "Arn",
487
- ],
488
- },
489
- },
490
- "Type": "AWS::KMS::Alias",
491
- },
492
- "topic69831491": {
493
- "Properties": {
494
- "KmsMasterKeyId": {
495
- "Fn::GetAtt": [
496
- "kmskey49FBC3B3",
497
- "Arn",
498
- ],
499
- },
500
- "TopicName": "serviceName",
501
- },
502
- "Type": "AWS::SNS::Topic",
1816
+ "Type": "AWS::IAM::Policy",
503
1817
  },
504
- "worker28EA3E30": {
1818
+ "workerprehook415B13CE": {
505
1819
  "DependsOn": [
506
- "workerServiceRoleDefaultPolicyBA498553",
507
- "workerServiceRole2130CC7F",
1820
+ "workerprehookServiceRoleDefaultPolicy991A21B9",
1821
+ "workerprehookServiceRole8F8D9379",
508
1822
  ],
509
1823
  "Properties": {
510
1824
  "Architectures": [
@@ -518,13 +1832,16 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
518
1832
  },
519
1833
  "Environment": {
520
1834
  "Variables": {
1835
+ "FUNCTION_NAME_TO_INVOKE": {
1836
+ "Ref": "worker28EA3E30",
1837
+ },
521
1838
  "NODE_ENV": "production",
522
1839
  "NODE_OPTIONS": "--enable-source-maps",
523
1840
  "SOMETHING": "prod",
524
1841
  },
525
1842
  },
526
- "FunctionName": "serviceName",
527
- "Handler": "app.handler",
1843
+ "FunctionName": "serviceName-pre-hook",
1844
+ "Handler": "index.handler",
528
1845
  "KmsKeyArn": {
529
1846
  "Fn::GetAtt": [
530
1847
  "kmskey49FBC3B3",
@@ -533,15 +1850,16 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
533
1850
  },
534
1851
  "Role": {
535
1852
  "Fn::GetAtt": [
536
- "workerServiceRole2130CC7F",
1853
+ "workerprehookServiceRole8F8D9379",
537
1854
  "Arn",
538
1855
  ],
539
1856
  },
540
1857
  "Runtime": "nodejs20.x",
1858
+ "Timeout": 120,
541
1859
  },
542
1860
  "Type": "AWS::Lambda::Function",
543
1861
  },
544
- "workerServiceRole2130CC7F": {
1862
+ "workerprehookServiceRole8F8D9379": {
545
1863
  "Properties": {
546
1864
  "AssumeRolePolicyDocument": {
547
1865
  "Statement": [
@@ -572,62 +1890,79 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
572
1890
  },
573
1891
  "Type": "AWS::IAM::Role",
574
1892
  },
575
- "workerServiceRoleDefaultPolicyBA498553": {
1893
+ "workerprehookServiceRoleDefaultPolicy991A21B9": {
576
1894
  "Properties": {
577
1895
  "PolicyDocument": {
578
1896
  "Statement": [
579
1897
  {
580
- "Action": [
581
- "sqs:ReceiveMessage",
582
- "sqs:ChangeMessageVisibility",
583
- "sqs:GetQueueUrl",
584
- "sqs:DeleteMessage",
585
- "sqs:GetQueueAttributes",
586
- ],
1898
+ "Action": "lambda:InvokeFunction",
587
1899
  "Effect": "Allow",
588
- "Resource": {
589
- "Fn::GetAtt": [
590
- "workerqueueA05CE5C6",
591
- "Arn",
592
- ],
593
- },
1900
+ "Resource": [
1901
+ {
1902
+ "Fn::GetAtt": [
1903
+ "worker28EA3E30",
1904
+ "Arn",
1905
+ ],
1906
+ },
1907
+ {
1908
+ "Fn::Join": [
1909
+ "",
1910
+ [
1911
+ {
1912
+ "Fn::GetAtt": [
1913
+ "worker28EA3E30",
1914
+ "Arn",
1915
+ ],
1916
+ },
1917
+ ":*",
1918
+ ],
1919
+ ],
1920
+ },
1921
+ ],
594
1922
  },
595
1923
  {
596
- "Action": "kms:Decrypt",
1924
+ "Action": "codedeploy:PutLifecycleEventHookExecutionStatus",
597
1925
  "Effect": "Allow",
598
1926
  "Resource": {
599
- "Fn::GetAtt": [
600
- "kmskey49FBC3B3",
601
- "Arn",
1927
+ "Fn::Join": [
1928
+ "",
1929
+ [
1930
+ "arn:",
1931
+ {
1932
+ "Ref": "AWS::Partition",
1933
+ },
1934
+ ":codedeploy:",
1935
+ {
1936
+ "Ref": "AWS::Region",
1937
+ },
1938
+ ":",
1939
+ {
1940
+ "Ref": "AWS::AccountId",
1941
+ },
1942
+ ":deploymentgroup:",
1943
+ {
1944
+ "Ref": "codedeployapplicationF49B9864",
1945
+ },
1946
+ "/",
1947
+ {
1948
+ "Ref": "codedeploygroup441B094B",
1949
+ },
1950
+ ],
602
1951
  ],
603
1952
  },
604
1953
  },
605
1954
  ],
606
1955
  "Version": "2012-10-17",
607
1956
  },
608
- "PolicyName": "workerServiceRoleDefaultPolicyBA498553",
1957
+ "PolicyName": "workerprehookServiceRoleDefaultPolicy991A21B9",
609
1958
  "Roles": [
610
1959
  {
611
- "Ref": "workerServiceRole2130CC7F",
1960
+ "Ref": "workerprehookServiceRole8F8D9379",
612
1961
  },
613
1962
  ],
614
1963
  },
615
1964
  "Type": "AWS::IAM::Policy",
616
1965
  },
617
- "workerSqsEventSourceappStackworkerqueue8281B9F47B9F582B": {
618
- "Properties": {
619
- "EventSourceArn": {
620
- "Fn::GetAtt": [
621
- "workerqueueA05CE5C6",
622
- "Arn",
623
- ],
624
- },
625
- "FunctionName": {
626
- "Ref": "worker28EA3E30",
627
- },
628
- },
629
- "Type": "AWS::Lambda::EventSourceMapping",
630
- },
631
1966
  "workerqueueA05CE5C6": {
632
1967
  "DeletionPolicy": "Delete",
633
1968
  "Properties": {
@@ -660,7 +1995,7 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
660
1995
  "Condition": {
661
1996
  "ArnEquals": {
662
1997
  "aws:SourceArn": {
663
- "Ref": "topic69831491",
1998
+ "Ref": "sourcetopic7C3DC892",
664
1999
  },
665
2000
  },
666
2001
  },
@@ -686,7 +2021,7 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
686
2021
  },
687
2022
  "Type": "AWS::SQS::QueuePolicy",
688
2023
  },
689
- "workerqueueappStacktopic0CA45134AFB31FF4": {
2024
+ "workerqueueappStacksourcetopic613C6BDBD2F224F5": {
690
2025
  "DependsOn": [
691
2026
  "workerqueuePolicy97054CB4",
692
2027
  ],
@@ -699,7 +2034,7 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
699
2034
  },
700
2035
  "Protocol": "sqs",
701
2036
  "TopicArn": {
702
- "Ref": "topic69831491",
2037
+ "Ref": "sourcetopic7C3DC892",
703
2038
  },
704
2039
  },
705
2040
  "Type": "AWS::SNS::Subscription",
@@ -719,5 +2054,32 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
719
2054
  "UpdateReplacePolicy": "Delete",
720
2055
  },
721
2056
  },
2057
+ "Rules": {
2058
+ "CheckBootstrapVersion": {
2059
+ "Assertions": [
2060
+ {
2061
+ "Assert": {
2062
+ "Fn::Not": [
2063
+ {
2064
+ "Fn::Contains": [
2065
+ [
2066
+ "1",
2067
+ "2",
2068
+ "3",
2069
+ "4",
2070
+ "5",
2071
+ ],
2072
+ {
2073
+ "Ref": "BootstrapVersion",
2074
+ },
2075
+ ],
2076
+ },
2077
+ ],
2078
+ },
2079
+ "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI.",
2080
+ },
2081
+ ],
2082
+ },
2083
+ },
722
2084
  }
723
2085
  `;