skuba 8.2.0 → 9.0.0-main-20240918063050

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 (52) hide show
  1. package/lib/api/buildkite/annotate.d.ts +2 -0
  2. package/lib/api/buildkite/annotate.js +14 -1
  3. package/lib/api/buildkite/annotate.js.map +2 -2
  4. package/lib/cli/configure/analyseDependencies.js +0 -2
  5. package/lib/cli/configure/analyseDependencies.js.map +2 -2
  6. package/lib/cli/configure/analysis/package.d.ts +1 -2
  7. package/lib/cli/configure/analysis/package.js +0 -27
  8. package/lib/cli/configure/analysis/package.js.map +2 -2
  9. package/lib/cli/configure/dependencies/skubaDeps.js +4 -3
  10. package/lib/cli/configure/dependencies/skubaDeps.js.map +2 -2
  11. package/lib/cli/init/getConfig.d.ts +1 -1
  12. package/lib/cli/init/getConfig.js.map +2 -2
  13. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.d.ts +2 -0
  14. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +35 -0
  15. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +7 -0
  16. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.d.ts +2 -0
  17. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +99 -0
  18. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +7 -0
  19. package/lib/cli/node.d.ts +2 -1
  20. package/lib/cli/node.js +23 -18
  21. package/lib/cli/node.js.map +3 -3
  22. package/lib/cli/start.js +3 -3
  23. package/lib/cli/start.js.map +2 -2
  24. package/lib/utils/template.d.ts +4 -4
  25. package/package.json +14 -13
  26. package/template/express-rest-api/.buildkite/pipeline.yml +1 -2
  27. package/template/express-rest-api/Dockerfile.dev-deps +1 -1
  28. package/template/express-rest-api/package.json +2 -2
  29. package/template/greeter/.buildkite/pipeline.yml +1 -2
  30. package/template/greeter/Dockerfile +1 -1
  31. package/template/greeter/package.json +2 -2
  32. package/template/koa-rest-api/.buildkite/pipeline.yml +1 -2
  33. package/template/koa-rest-api/Dockerfile.dev-deps +1 -1
  34. package/template/koa-rest-api/package.json +6 -6
  35. package/template/koa-rest-api/src/framework/server.ts +3 -5
  36. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +3 -4
  37. package/template/lambda-sqs-worker/Dockerfile +1 -1
  38. package/template/lambda-sqs-worker/package.json +2 -2
  39. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +3 -22
  40. package/template/lambda-sqs-worker-cdk/Dockerfile +1 -1
  41. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +427 -1147
  42. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +4 -1
  43. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +5 -84
  44. package/template/lambda-sqs-worker-cdk/infra/config.ts +1 -1
  45. package/template/lambda-sqs-worker-cdk/infra/index.ts +20 -3
  46. package/template/lambda-sqs-worker-cdk/package.json +5 -4
  47. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  48. package/template/oss-npm-package/_package.json +1 -1
  49. package/template/private-npm-package/.buildkite/pipeline.yml +0 -1
  50. package/template/private-npm-package/_package.json +1 -1
  51. package/template/lambda-sqs-worker-cdk/src/postHook.ts +0 -154
  52. package/template/lambda-sqs-worker-cdk/src/preHook.ts +0 -95
@@ -2,130 +2,6 @@
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
- "ap-southeast-5": {
41
- "codedeploy": "codedeploy.ap-southeast-5.amazonaws.com",
42
- },
43
- "ap-southeast-7": {
44
- "codedeploy": "codedeploy.ap-southeast-7.amazonaws.com",
45
- },
46
- "ca-central-1": {
47
- "codedeploy": "codedeploy.ca-central-1.amazonaws.com",
48
- },
49
- "ca-west-1": {
50
- "codedeploy": "codedeploy.ca-west-1.amazonaws.com",
51
- },
52
- "cn-north-1": {
53
- "codedeploy": "codedeploy.cn-north-1.amazonaws.com.cn",
54
- },
55
- "cn-northwest-1": {
56
- "codedeploy": "codedeploy.cn-northwest-1.amazonaws.com.cn",
57
- },
58
- "eu-central-1": {
59
- "codedeploy": "codedeploy.eu-central-1.amazonaws.com",
60
- },
61
- "eu-central-2": {
62
- "codedeploy": "codedeploy.eu-central-2.amazonaws.com",
63
- },
64
- "eu-isoe-west-1": {
65
- "codedeploy": "codedeploy.eu-isoe-west-1.amazonaws.com",
66
- },
67
- "eu-north-1": {
68
- "codedeploy": "codedeploy.eu-north-1.amazonaws.com",
69
- },
70
- "eu-south-1": {
71
- "codedeploy": "codedeploy.eu-south-1.amazonaws.com",
72
- },
73
- "eu-south-2": {
74
- "codedeploy": "codedeploy.eu-south-2.amazonaws.com",
75
- },
76
- "eu-west-1": {
77
- "codedeploy": "codedeploy.eu-west-1.amazonaws.com",
78
- },
79
- "eu-west-2": {
80
- "codedeploy": "codedeploy.eu-west-2.amazonaws.com",
81
- },
82
- "eu-west-3": {
83
- "codedeploy": "codedeploy.eu-west-3.amazonaws.com",
84
- },
85
- "il-central-1": {
86
- "codedeploy": "codedeploy.il-central-1.amazonaws.com",
87
- },
88
- "me-central-1": {
89
- "codedeploy": "codedeploy.me-central-1.amazonaws.com",
90
- },
91
- "me-south-1": {
92
- "codedeploy": "codedeploy.me-south-1.amazonaws.com",
93
- },
94
- "mx-central-1": {
95
- "codedeploy": "codedeploy.mx-central-1.amazonaws.com",
96
- },
97
- "sa-east-1": {
98
- "codedeploy": "codedeploy.sa-east-1.amazonaws.com",
99
- },
100
- "us-east-1": {
101
- "codedeploy": "codedeploy.us-east-1.amazonaws.com",
102
- },
103
- "us-east-2": {
104
- "codedeploy": "codedeploy.us-east-2.amazonaws.com",
105
- },
106
- "us-gov-east-1": {
107
- "codedeploy": "codedeploy.us-gov-east-1.amazonaws.com",
108
- },
109
- "us-gov-west-1": {
110
- "codedeploy": "codedeploy.us-gov-west-1.amazonaws.com",
111
- },
112
- "us-iso-east-1": {
113
- "codedeploy": "codedeploy.amazonaws.com",
114
- },
115
- "us-iso-west-1": {
116
- "codedeploy": "codedeploy.amazonaws.com",
117
- },
118
- "us-isob-east-1": {
119
- "codedeploy": "codedeploy.amazonaws.com",
120
- },
121
- "us-west-1": {
122
- "codedeploy": "codedeploy.us-west-1.amazonaws.com",
123
- },
124
- "us-west-2": {
125
- "codedeploy": "codedeploy.us-west-2.amazonaws.com",
126
- },
127
- },
128
- },
129
5
  "Parameters": {
130
6
  "BootstrapVersion": {
131
7
  "Default": "/cdk-bootstrap/hnb659fds/version",
@@ -134,189 +10,6 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
134
10
  },
135
11
  },
136
12
  "Resources": {
137
- "codedeployalarm9F48D05F": {
138
- "Properties": {
139
- "ComparisonOperator": "GreaterThanOrEqualToThreshold",
140
- "Dimensions": [
141
- {
142
- "Name": "FunctionName",
143
- "Value": {
144
- "Ref": "worker28EA3E30",
145
- },
146
- },
147
- {
148
- "Name": "Resource",
149
- "Value": {
150
- "Fn::Join": [
151
- "",
152
- [
153
- {
154
- "Ref": "worker28EA3E30",
155
- },
156
- ":live",
157
- ],
158
- ],
159
- },
160
- },
161
- ],
162
- "EvaluationPeriods": 1,
163
- "MetricName": "Errors",
164
- "Namespace": "AWS/Lambda",
165
- "Period": 60,
166
- "Statistic": "Sum",
167
- "Threshold": 1,
168
- },
169
- "Type": "AWS::CloudWatch::Alarm",
170
- },
171
- "codedeployapplicationF49B9864": {
172
- "Properties": {
173
- "ComputePlatform": "Lambda",
174
- },
175
- "Type": "AWS::CodeDeploy::Application",
176
- },
177
- "codedeploygroup441B094B": {
178
- "Properties": {
179
- "AlarmConfiguration": {
180
- "Alarms": [
181
- {
182
- "Name": {
183
- "Ref": "codedeployalarm9F48D05F",
184
- },
185
- },
186
- ],
187
- "Enabled": true,
188
- },
189
- "ApplicationName": {
190
- "Ref": "codedeployapplicationF49B9864",
191
- },
192
- "AutoRollbackConfiguration": {
193
- "Enabled": true,
194
- "Events": [
195
- "DEPLOYMENT_FAILURE",
196
- "DEPLOYMENT_STOP_ON_ALARM",
197
- ],
198
- },
199
- "DeploymentConfigName": "CodeDeployDefault.LambdaAllAtOnce",
200
- "DeploymentStyle": {
201
- "DeploymentOption": "WITH_TRAFFIC_CONTROL",
202
- "DeploymentType": "BLUE_GREEN",
203
- },
204
- "ServiceRoleArn": {
205
- "Fn::GetAtt": [
206
- "codedeploygroupServiceRole1BD49E37",
207
- "Arn",
208
- ],
209
- },
210
- },
211
- "Type": "AWS::CodeDeploy::DeploymentGroup",
212
- },
213
- "codedeploygroupServiceRole1BD49E37": {
214
- "Properties": {
215
- "AssumeRolePolicyDocument": {
216
- "Statement": [
217
- {
218
- "Action": "sts:AssumeRole",
219
- "Effect": "Allow",
220
- "Principal": {
221
- "Service": {
222
- "Fn::FindInMap": [
223
- "ServiceprincipalMap",
224
- {
225
- "Ref": "AWS::Region",
226
- },
227
- "codedeploy",
228
- ],
229
- },
230
- },
231
- },
232
- ],
233
- "Version": "2012-10-17",
234
- },
235
- "ManagedPolicyArns": [
236
- {
237
- "Fn::Join": [
238
- "",
239
- [
240
- "arn:",
241
- {
242
- "Ref": "AWS::Partition",
243
- },
244
- ":iam::aws:policy/service-role/AWSCodeDeployRoleForLambdaLimited",
245
- ],
246
- ],
247
- },
248
- ],
249
- },
250
- "Type": "AWS::IAM::Role",
251
- },
252
- "codedeploygroupServiceRoleDefaultPolicy2027BC9A": {
253
- "Properties": {
254
- "PolicyDocument": {
255
- "Statement": [
256
- {
257
- "Action": "lambda:InvokeFunction",
258
- "Effect": "Allow",
259
- "Resource": [
260
- {
261
- "Fn::GetAtt": [
262
- "workerprehook415B13CE",
263
- "Arn",
264
- ],
265
- },
266
- {
267
- "Fn::Join": [
268
- "",
269
- [
270
- {
271
- "Fn::GetAtt": [
272
- "workerprehook415B13CE",
273
- "Arn",
274
- ],
275
- },
276
- ":*",
277
- ],
278
- ],
279
- },
280
- ],
281
- },
282
- {
283
- "Action": "lambda:InvokeFunction",
284
- "Effect": "Allow",
285
- "Resource": [
286
- {
287
- "Fn::GetAtt": [
288
- "workerposthook150842D6",
289
- "Arn",
290
- ],
291
- },
292
- {
293
- "Fn::Join": [
294
- "",
295
- [
296
- {
297
- "Fn::GetAtt": [
298
- "workerposthook150842D6",
299
- "Arn",
300
- ],
301
- },
302
- ":*",
303
- ],
304
- ],
305
- },
306
- ],
307
- },
308
- ],
309
- "Version": "2012-10-17",
310
- },
311
- "PolicyName": "codedeploygroupServiceRoleDefaultPolicy2027BC9A",
312
- "Roles": [
313
- {
314
- "Ref": "codedeploygroupServiceRole1BD49E37",
315
- },
316
- ],
317
- },
318
- "Type": "AWS::IAM::Policy",
319
- },
320
13
  "kmskey49FBC3B3": {
321
14
  "DeletionPolicy": "Retain",
322
15
  "Properties": {
@@ -486,11 +179,17 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
486
179
  ],
487
180
  },
488
181
  "Runtime": "nodejs20.x",
182
+ "Tags": [
183
+ {
184
+ "Key": "aws-codedeploy-hooks",
185
+ "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
186
+ },
187
+ ],
489
188
  "Timeout": 30,
490
189
  },
491
190
  "Type": "AWS::Lambda::Function",
492
191
  },
493
- "workerAliaslive62FE5FAF": {
192
+ "workerAliasLive4B82F015": {
494
193
  "Properties": {
495
194
  "Description": "The Lambda version currently receiving traffic",
496
195
  "FunctionName": {
@@ -502,27 +201,81 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
502
201
  "Version",
503
202
  ],
504
203
  },
505
- "Name": "live",
204
+ "Name": "Live",
506
205
  },
507
206
  "Type": "AWS::Lambda::Alias",
508
207
  "UpdatePolicy": {
509
208
  "CodeDeployLambdaAliasUpdate": {
510
209
  "AfterAllowTrafficHook": {
511
- "Ref": "workerposthook150842D6",
210
+ "Fn::Select": [
211
+ 6,
212
+ {
213
+ "Fn::Split": [
214
+ ":",
215
+ {
216
+ "Fn::Join": [
217
+ "",
218
+ [
219
+ "arn:",
220
+ {
221
+ "Ref": "AWS::Partition",
222
+ },
223
+ ":lambda:",
224
+ {
225
+ "Ref": "AWS::Region",
226
+ },
227
+ ":",
228
+ {
229
+ "Ref": "AWS::AccountId",
230
+ },
231
+ ":function:aws-codedeploy-hook-AfterAllowTraffic",
232
+ ],
233
+ ],
234
+ },
235
+ ],
236
+ },
237
+ ],
512
238
  },
513
239
  "ApplicationName": {
514
- "Ref": "codedeployapplicationF49B9864",
240
+ "Ref": "workerDeploymentCodeDeployLambdaApplication9974008D",
515
241
  },
516
242
  "BeforeAllowTrafficHook": {
517
- "Ref": "workerprehook415B13CE",
243
+ "Fn::Select": [
244
+ 6,
245
+ {
246
+ "Fn::Split": [
247
+ ":",
248
+ {
249
+ "Fn::Join": [
250
+ "",
251
+ [
252
+ "arn:",
253
+ {
254
+ "Ref": "AWS::Partition",
255
+ },
256
+ ":lambda:",
257
+ {
258
+ "Ref": "AWS::Region",
259
+ },
260
+ ":",
261
+ {
262
+ "Ref": "AWS::AccountId",
263
+ },
264
+ ":function:aws-codedeploy-hook-BeforeAllowTraffic",
265
+ ],
266
+ ],
267
+ },
268
+ ],
269
+ },
270
+ ],
518
271
  },
519
272
  "DeploymentGroupName": {
520
- "Ref": "codedeploygroup441B094B",
273
+ "Ref": "workerDeploymentCodeDeployLambdaDeploymentGroupF884ECDA",
521
274
  },
522
275
  },
523
276
  },
524
277
  },
525
- "workerAliasliveSqsEventSourceappStackworkerqueue8281B9F42DEDB47B": {
278
+ "workerAliasLiveSqsEventSourceappStackworkerqueue8281B9F443B0CF93": {
526
279
  "Properties": {
527
280
  "EventSourceArn": {
528
281
  "Fn::GetAtt": [
@@ -541,19 +294,16 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
541
294
  "Fn::Split": [
542
295
  ":",
543
296
  {
544
- "Ref": "workerAliaslive62FE5FAF",
297
+ "Ref": "workerAliasLive4B82F015",
545
298
  },
546
299
  ],
547
300
  },
548
301
  ],
549
302
  },
550
- ":live",
303
+ ":Live",
551
304
  ],
552
305
  ],
553
306
  },
554
- "ScalingConfig": {
555
- "MaximumConcurrency": 2,
556
- },
557
307
  },
558
308
  "Type": "AWS::Lambda::EventSourceMapping",
559
309
  },
@@ -565,7 +315,50 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
565
315
  },
566
316
  "Type": "AWS::Lambda::Version",
567
317
  },
568
- "workerServiceRole2130CC7F": {
318
+ "workerDeploymentCodeDeployLambdaApplication9974008D": {
319
+ "Properties": {
320
+ "ComputePlatform": "Lambda",
321
+ "Tags": [
322
+ {
323
+ "Key": "aws-codedeploy-hooks",
324
+ "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
325
+ },
326
+ ],
327
+ },
328
+ "Type": "AWS::CodeDeploy::Application",
329
+ },
330
+ "workerDeploymentCodeDeployLambdaDeploymentGroupF884ECDA": {
331
+ "Properties": {
332
+ "ApplicationName": {
333
+ "Ref": "workerDeploymentCodeDeployLambdaApplication9974008D",
334
+ },
335
+ "AutoRollbackConfiguration": {
336
+ "Enabled": true,
337
+ "Events": [
338
+ "DEPLOYMENT_FAILURE",
339
+ ],
340
+ },
341
+ "DeploymentConfigName": "CodeDeployDefault.LambdaAllAtOnce",
342
+ "DeploymentStyle": {
343
+ "DeploymentOption": "WITH_TRAFFIC_CONTROL",
344
+ "DeploymentType": "BLUE_GREEN",
345
+ },
346
+ "ServiceRoleArn": {
347
+ "Fn::GetAtt": [
348
+ "workerDeploymentCodeDeployLambdaDeploymentGroupServiceRole351C6FAE",
349
+ "Arn",
350
+ ],
351
+ },
352
+ "Tags": [
353
+ {
354
+ "Key": "aws-codedeploy-hooks",
355
+ "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
356
+ },
357
+ ],
358
+ },
359
+ "Type": "AWS::CodeDeploy::DeploymentGroup",
360
+ },
361
+ "workerDeploymentCodeDeployLambdaDeploymentGroupServiceRole351C6FAE": {
569
362
  "Properties": {
570
363
  "AssumeRolePolicyDocument": {
571
364
  "Statement": [
@@ -573,7 +366,7 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
573
366
  "Action": "sts:AssumeRole",
574
367
  "Effect": "Allow",
575
368
  "Principal": {
576
- "Service": "lambda.amazonaws.com",
369
+ "Service": "codedeploy.amazonaws.com",
577
370
  },
578
371
  },
579
372
  ],
@@ -588,257 +381,129 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
588
381
  {
589
382
  "Ref": "AWS::Partition",
590
383
  },
591
- ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
384
+ ":iam::aws:policy/service-role/AWSCodeDeployRoleForLambdaLimited",
592
385
  ],
593
386
  ],
594
387
  },
595
388
  ],
389
+ "Tags": [
390
+ {
391
+ "Key": "aws-codedeploy-hooks",
392
+ "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
393
+ },
394
+ ],
596
395
  },
597
396
  "Type": "AWS::IAM::Role",
598
397
  },
599
- "workerServiceRoleDefaultPolicyBA498553": {
398
+ "workerDeploymentCodeDeployLambdaDeploymentGroupServiceRoleDefaultPolicy30B750B5": {
600
399
  "Properties": {
601
400
  "PolicyDocument": {
602
401
  "Statement": [
603
402
  {
604
- "Action": [
605
- "sqs:ReceiveMessage",
606
- "sqs:ChangeMessageVisibility",
607
- "sqs:GetQueueUrl",
608
- "sqs:DeleteMessage",
609
- "sqs:GetQueueAttributes",
610
- ],
611
- "Effect": "Allow",
612
- "Resource": {
613
- "Fn::GetAtt": [
614
- "workerqueueA05CE5C6",
615
- "Arn",
616
- ],
617
- },
618
- },
619
- {
620
- "Action": "kms:Decrypt",
403
+ "Action": "lambda:InvokeFunction",
621
404
  "Effect": "Allow",
622
- "Resource": {
623
- "Fn::GetAtt": [
624
- "kmskey49FBC3B3",
625
- "Arn",
626
- ],
627
- },
628
- },
629
- ],
630
- "Version": "2012-10-17",
631
- },
632
- "PolicyName": "workerServiceRoleDefaultPolicyBA498553",
633
- "Roles": [
634
- {
635
- "Ref": "workerServiceRole2130CC7F",
636
- },
637
- ],
638
- },
639
- "Type": "AWS::IAM::Policy",
640
- },
641
- "workerposthook150842D6": {
642
- "DependsOn": [
643
- "workerposthookServiceRoleDefaultPolicy6A92F69C",
644
- "workerposthookServiceRole25452300",
645
- ],
646
- "Properties": {
647
- "Architectures": [
648
- "arm64",
649
- ],
650
- "Code": {
651
- "S3Bucket": {
652
- "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}",
653
- },
654
- "S3Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.zip",
655
- },
656
- "Environment": {
657
- "Variables": {
658
- "ENVIRONMENT": "dev",
659
- "FUNCTION_NAME_TO_PRUNE": {
660
- "Ref": "worker28EA3E30",
661
- },
662
- "NODE_ENV": "production",
663
- "NODE_OPTIONS": "--enable-source-maps",
664
- "SERVICE": "serviceName",
665
- "VERSION": "local",
666
- },
667
- },
668
- "FunctionName": "serviceName-post-hook",
669
- "Handler": "index.handler",
670
- "KmsKeyArn": {
671
- "Fn::GetAtt": [
672
- "kmskey49FBC3B3",
673
- "Arn",
674
- ],
675
- },
676
- "Role": {
677
- "Fn::GetAtt": [
678
- "workerposthookServiceRole25452300",
679
- "Arn",
680
- ],
681
- },
682
- "Runtime": "nodejs20.x",
683
- "Timeout": 30,
684
- },
685
- "Type": "AWS::Lambda::Function",
686
- },
687
- "workerposthookServiceRole25452300": {
688
- "Properties": {
689
- "AssumeRolePolicyDocument": {
690
- "Statement": [
691
- {
692
- "Action": "sts:AssumeRole",
693
- "Effect": "Allow",
694
- "Principal": {
695
- "Service": "lambda.amazonaws.com",
696
- },
697
- },
698
- ],
699
- "Version": "2012-10-17",
700
- },
701
- "ManagedPolicyArns": [
702
- {
703
- "Fn::Join": [
704
- "",
705
- [
706
- "arn:",
405
+ "Resource": [
707
406
  {
708
- "Ref": "AWS::Partition",
407
+ "Fn::Join": [
408
+ "",
409
+ [
410
+ "arn:",
411
+ {
412
+ "Ref": "AWS::Partition",
413
+ },
414
+ ":lambda:",
415
+ {
416
+ "Ref": "AWS::Region",
417
+ },
418
+ ":",
419
+ {
420
+ "Ref": "AWS::AccountId",
421
+ },
422
+ ":function:aws-codedeploy-hook-BeforeAllowTraffic",
423
+ ],
424
+ ],
425
+ },
426
+ {
427
+ "Fn::Join": [
428
+ "",
429
+ [
430
+ "arn:",
431
+ {
432
+ "Ref": "AWS::Partition",
433
+ },
434
+ ":lambda:",
435
+ {
436
+ "Ref": "AWS::Region",
437
+ },
438
+ ":",
439
+ {
440
+ "Ref": "AWS::AccountId",
441
+ },
442
+ ":function:aws-codedeploy-hook-BeforeAllowTraffic:*",
443
+ ],
444
+ ],
709
445
  },
710
- ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
711
446
  ],
712
- ],
713
- },
714
- ],
715
- },
716
- "Type": "AWS::IAM::Role",
717
- },
718
- "workerposthookServiceRoleDefaultPolicy6A92F69C": {
719
- "Properties": {
720
- "PolicyDocument": {
721
- "Statement": [
447
+ },
722
448
  {
723
- "Action": [
724
- "lambda:ListAliases",
725
- "lambda:ListVersionsByFunction",
726
- "lambda:DeleteFunction",
727
- ],
449
+ "Action": "lambda:InvokeFunction",
728
450
  "Effect": "Allow",
729
451
  "Resource": [
730
452
  {
731
- "Fn::GetAtt": [
732
- "worker28EA3E30",
733
- "Arn",
453
+ "Fn::Join": [
454
+ "",
455
+ [
456
+ "arn:",
457
+ {
458
+ "Ref": "AWS::Partition",
459
+ },
460
+ ":lambda:",
461
+ {
462
+ "Ref": "AWS::Region",
463
+ },
464
+ ":",
465
+ {
466
+ "Ref": "AWS::AccountId",
467
+ },
468
+ ":function:aws-codedeploy-hook-AfterAllowTraffic",
469
+ ],
734
470
  ],
735
471
  },
736
472
  {
737
473
  "Fn::Join": [
738
474
  "",
739
475
  [
476
+ "arn:",
477
+ {
478
+ "Ref": "AWS::Partition",
479
+ },
480
+ ":lambda:",
481
+ {
482
+ "Ref": "AWS::Region",
483
+ },
484
+ ":",
740
485
  {
741
- "Fn::GetAtt": [
742
- "worker28EA3E30",
743
- "Arn",
744
- ],
486
+ "Ref": "AWS::AccountId",
745
487
  },
746
- ":*",
488
+ ":function:aws-codedeploy-hook-AfterAllowTraffic:*",
747
489
  ],
748
490
  ],
749
491
  },
750
492
  ],
751
493
  },
752
- {
753
- "Action": "codedeploy:PutLifecycleEventHookExecutionStatus",
754
- "Effect": "Allow",
755
- "Resource": {
756
- "Fn::Join": [
757
- "",
758
- [
759
- "arn:",
760
- {
761
- "Ref": "AWS::Partition",
762
- },
763
- ":codedeploy:",
764
- {
765
- "Ref": "AWS::Region",
766
- },
767
- ":",
768
- {
769
- "Ref": "AWS::AccountId",
770
- },
771
- ":deploymentgroup:",
772
- {
773
- "Ref": "codedeployapplicationF49B9864",
774
- },
775
- "/",
776
- {
777
- "Ref": "codedeploygroup441B094B",
778
- },
779
- ],
780
- ],
781
- },
782
- },
783
494
  ],
784
495
  "Version": "2012-10-17",
785
496
  },
786
- "PolicyName": "workerposthookServiceRoleDefaultPolicy6A92F69C",
497
+ "PolicyName": "workerDeploymentCodeDeployLambdaDeploymentGroupServiceRoleDefaultPolicy30B750B5",
787
498
  "Roles": [
788
499
  {
789
- "Ref": "workerposthookServiceRole25452300",
500
+ "Ref": "workerDeploymentCodeDeployLambdaDeploymentGroupServiceRole351C6FAE",
790
501
  },
791
502
  ],
792
503
  },
793
504
  "Type": "AWS::IAM::Policy",
794
505
  },
795
- "workerprehook415B13CE": {
796
- "DependsOn": [
797
- "workerprehookServiceRoleDefaultPolicy991A21B9",
798
- "workerprehookServiceRole8F8D9379",
799
- ],
800
- "Properties": {
801
- "Architectures": [
802
- "arm64",
803
- ],
804
- "Code": {
805
- "S3Bucket": {
806
- "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}",
807
- },
808
- "S3Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.zip",
809
- },
810
- "Environment": {
811
- "Variables": {
812
- "ENVIRONMENT": "dev",
813
- "FUNCTION_NAME_TO_INVOKE": {
814
- "Ref": "worker28EA3E30",
815
- },
816
- "NODE_ENV": "production",
817
- "NODE_OPTIONS": "--enable-source-maps",
818
- "SERVICE": "serviceName",
819
- "VERSION": "local",
820
- },
821
- },
822
- "FunctionName": "serviceName-pre-hook",
823
- "Handler": "index.handler",
824
- "KmsKeyArn": {
825
- "Fn::GetAtt": [
826
- "kmskey49FBC3B3",
827
- "Arn",
828
- ],
829
- },
830
- "Role": {
831
- "Fn::GetAtt": [
832
- "workerprehookServiceRole8F8D9379",
833
- "Arn",
834
- ],
835
- },
836
- "Runtime": "nodejs20.x",
837
- "Timeout": 120,
838
- },
839
- "Type": "AWS::Lambda::Function",
840
- },
841
- "workerprehookServiceRole8F8D9379": {
506
+ "workerServiceRole2130CC7F": {
842
507
  "Properties": {
843
508
  "AssumeRolePolicyDocument": {
844
509
  "Statement": [
@@ -866,77 +531,52 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
866
531
  ],
867
532
  },
868
533
  ],
534
+ "Tags": [
535
+ {
536
+ "Key": "aws-codedeploy-hooks",
537
+ "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
538
+ },
539
+ ],
869
540
  },
870
541
  "Type": "AWS::IAM::Role",
871
542
  },
872
- "workerprehookServiceRoleDefaultPolicy991A21B9": {
543
+ "workerServiceRoleDefaultPolicyBA498553": {
873
544
  "Properties": {
874
545
  "PolicyDocument": {
875
546
  "Statement": [
876
547
  {
877
- "Action": "lambda:InvokeFunction",
878
- "Effect": "Allow",
879
- "Resource": [
880
- {
881
- "Fn::GetAtt": [
882
- "worker28EA3E30",
883
- "Arn",
884
- ],
885
- },
886
- {
887
- "Fn::Join": [
888
- "",
889
- [
890
- {
891
- "Fn::GetAtt": [
892
- "worker28EA3E30",
893
- "Arn",
894
- ],
895
- },
896
- ":*",
897
- ],
898
- ],
899
- },
548
+ "Action": [
549
+ "sqs:ReceiveMessage",
550
+ "sqs:ChangeMessageVisibility",
551
+ "sqs:GetQueueUrl",
552
+ "sqs:DeleteMessage",
553
+ "sqs:GetQueueAttributes",
900
554
  ],
555
+ "Effect": "Allow",
556
+ "Resource": {
557
+ "Fn::GetAtt": [
558
+ "workerqueueA05CE5C6",
559
+ "Arn",
560
+ ],
561
+ },
901
562
  },
902
563
  {
903
- "Action": "codedeploy:PutLifecycleEventHookExecutionStatus",
564
+ "Action": "kms:Decrypt",
904
565
  "Effect": "Allow",
905
566
  "Resource": {
906
- "Fn::Join": [
907
- "",
908
- [
909
- "arn:",
910
- {
911
- "Ref": "AWS::Partition",
912
- },
913
- ":codedeploy:",
914
- {
915
- "Ref": "AWS::Region",
916
- },
917
- ":",
918
- {
919
- "Ref": "AWS::AccountId",
920
- },
921
- ":deploymentgroup:",
922
- {
923
- "Ref": "codedeployapplicationF49B9864",
924
- },
925
- "/",
926
- {
927
- "Ref": "codedeploygroup441B094B",
928
- },
929
- ],
567
+ "Fn::GetAtt": [
568
+ "kmskey49FBC3B3",
569
+ "Arn",
930
570
  ],
931
571
  },
932
572
  },
933
573
  ],
934
574
  "Version": "2012-10-17",
935
575
  },
936
- "PolicyName": "workerprehookServiceRoleDefaultPolicy991A21B9",
576
+ "PolicyName": "workerServiceRoleDefaultPolicyBA498553",
937
577
  "Roles": [
938
578
  {
939
- "Ref": "workerprehookServiceRole8F8D9379",
579
+ "Ref": "workerServiceRole2130CC7F",
940
580
  },
941
581
  ],
942
582
  },
@@ -1065,130 +705,6 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
1065
705
 
1066
706
  exports[`returns expected CloudFormation stack for prod 1`] = `
1067
707
  {
1068
- "Mappings": {
1069
- "ServiceprincipalMap": {
1070
- "af-south-1": {
1071
- "codedeploy": "codedeploy.af-south-1.amazonaws.com",
1072
- },
1073
- "ap-east-1": {
1074
- "codedeploy": "codedeploy.ap-east-1.amazonaws.com",
1075
- },
1076
- "ap-northeast-1": {
1077
- "codedeploy": "codedeploy.ap-northeast-1.amazonaws.com",
1078
- },
1079
- "ap-northeast-2": {
1080
- "codedeploy": "codedeploy.ap-northeast-2.amazonaws.com",
1081
- },
1082
- "ap-northeast-3": {
1083
- "codedeploy": "codedeploy.ap-northeast-3.amazonaws.com",
1084
- },
1085
- "ap-south-1": {
1086
- "codedeploy": "codedeploy.ap-south-1.amazonaws.com",
1087
- },
1088
- "ap-south-2": {
1089
- "codedeploy": "codedeploy.ap-south-2.amazonaws.com",
1090
- },
1091
- "ap-southeast-1": {
1092
- "codedeploy": "codedeploy.ap-southeast-1.amazonaws.com",
1093
- },
1094
- "ap-southeast-2": {
1095
- "codedeploy": "codedeploy.ap-southeast-2.amazonaws.com",
1096
- },
1097
- "ap-southeast-3": {
1098
- "codedeploy": "codedeploy.ap-southeast-3.amazonaws.com",
1099
- },
1100
- "ap-southeast-4": {
1101
- "codedeploy": "codedeploy.ap-southeast-4.amazonaws.com",
1102
- },
1103
- "ap-southeast-5": {
1104
- "codedeploy": "codedeploy.ap-southeast-5.amazonaws.com",
1105
- },
1106
- "ap-southeast-7": {
1107
- "codedeploy": "codedeploy.ap-southeast-7.amazonaws.com",
1108
- },
1109
- "ca-central-1": {
1110
- "codedeploy": "codedeploy.ca-central-1.amazonaws.com",
1111
- },
1112
- "ca-west-1": {
1113
- "codedeploy": "codedeploy.ca-west-1.amazonaws.com",
1114
- },
1115
- "cn-north-1": {
1116
- "codedeploy": "codedeploy.cn-north-1.amazonaws.com.cn",
1117
- },
1118
- "cn-northwest-1": {
1119
- "codedeploy": "codedeploy.cn-northwest-1.amazonaws.com.cn",
1120
- },
1121
- "eu-central-1": {
1122
- "codedeploy": "codedeploy.eu-central-1.amazonaws.com",
1123
- },
1124
- "eu-central-2": {
1125
- "codedeploy": "codedeploy.eu-central-2.amazonaws.com",
1126
- },
1127
- "eu-isoe-west-1": {
1128
- "codedeploy": "codedeploy.eu-isoe-west-1.amazonaws.com",
1129
- },
1130
- "eu-north-1": {
1131
- "codedeploy": "codedeploy.eu-north-1.amazonaws.com",
1132
- },
1133
- "eu-south-1": {
1134
- "codedeploy": "codedeploy.eu-south-1.amazonaws.com",
1135
- },
1136
- "eu-south-2": {
1137
- "codedeploy": "codedeploy.eu-south-2.amazonaws.com",
1138
- },
1139
- "eu-west-1": {
1140
- "codedeploy": "codedeploy.eu-west-1.amazonaws.com",
1141
- },
1142
- "eu-west-2": {
1143
- "codedeploy": "codedeploy.eu-west-2.amazonaws.com",
1144
- },
1145
- "eu-west-3": {
1146
- "codedeploy": "codedeploy.eu-west-3.amazonaws.com",
1147
- },
1148
- "il-central-1": {
1149
- "codedeploy": "codedeploy.il-central-1.amazonaws.com",
1150
- },
1151
- "me-central-1": {
1152
- "codedeploy": "codedeploy.me-central-1.amazonaws.com",
1153
- },
1154
- "me-south-1": {
1155
- "codedeploy": "codedeploy.me-south-1.amazonaws.com",
1156
- },
1157
- "mx-central-1": {
1158
- "codedeploy": "codedeploy.mx-central-1.amazonaws.com",
1159
- },
1160
- "sa-east-1": {
1161
- "codedeploy": "codedeploy.sa-east-1.amazonaws.com",
1162
- },
1163
- "us-east-1": {
1164
- "codedeploy": "codedeploy.us-east-1.amazonaws.com",
1165
- },
1166
- "us-east-2": {
1167
- "codedeploy": "codedeploy.us-east-2.amazonaws.com",
1168
- },
1169
- "us-gov-east-1": {
1170
- "codedeploy": "codedeploy.us-gov-east-1.amazonaws.com",
1171
- },
1172
- "us-gov-west-1": {
1173
- "codedeploy": "codedeploy.us-gov-west-1.amazonaws.com",
1174
- },
1175
- "us-iso-east-1": {
1176
- "codedeploy": "codedeploy.amazonaws.com",
1177
- },
1178
- "us-iso-west-1": {
1179
- "codedeploy": "codedeploy.amazonaws.com",
1180
- },
1181
- "us-isob-east-1": {
1182
- "codedeploy": "codedeploy.amazonaws.com",
1183
- },
1184
- "us-west-1": {
1185
- "codedeploy": "codedeploy.us-west-1.amazonaws.com",
1186
- },
1187
- "us-west-2": {
1188
- "codedeploy": "codedeploy.us-west-2.amazonaws.com",
1189
- },
1190
- },
1191
- },
1192
708
  "Parameters": {
1193
709
  "BootstrapVersion": {
1194
710
  "Default": "/cdk-bootstrap/hnb659fds/version",
@@ -1197,189 +713,6 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
1197
713
  },
1198
714
  },
1199
715
  "Resources": {
1200
- "codedeployalarm9F48D05F": {
1201
- "Properties": {
1202
- "ComparisonOperator": "GreaterThanOrEqualToThreshold",
1203
- "Dimensions": [
1204
- {
1205
- "Name": "FunctionName",
1206
- "Value": {
1207
- "Ref": "worker28EA3E30",
1208
- },
1209
- },
1210
- {
1211
- "Name": "Resource",
1212
- "Value": {
1213
- "Fn::Join": [
1214
- "",
1215
- [
1216
- {
1217
- "Ref": "worker28EA3E30",
1218
- },
1219
- ":live",
1220
- ],
1221
- ],
1222
- },
1223
- },
1224
- ],
1225
- "EvaluationPeriods": 1,
1226
- "MetricName": "Errors",
1227
- "Namespace": "AWS/Lambda",
1228
- "Period": 60,
1229
- "Statistic": "Sum",
1230
- "Threshold": 1,
1231
- },
1232
- "Type": "AWS::CloudWatch::Alarm",
1233
- },
1234
- "codedeployapplicationF49B9864": {
1235
- "Properties": {
1236
- "ComputePlatform": "Lambda",
1237
- },
1238
- "Type": "AWS::CodeDeploy::Application",
1239
- },
1240
- "codedeploygroup441B094B": {
1241
- "Properties": {
1242
- "AlarmConfiguration": {
1243
- "Alarms": [
1244
- {
1245
- "Name": {
1246
- "Ref": "codedeployalarm9F48D05F",
1247
- },
1248
- },
1249
- ],
1250
- "Enabled": true,
1251
- },
1252
- "ApplicationName": {
1253
- "Ref": "codedeployapplicationF49B9864",
1254
- },
1255
- "AutoRollbackConfiguration": {
1256
- "Enabled": true,
1257
- "Events": [
1258
- "DEPLOYMENT_FAILURE",
1259
- "DEPLOYMENT_STOP_ON_ALARM",
1260
- ],
1261
- },
1262
- "DeploymentConfigName": "CodeDeployDefault.LambdaAllAtOnce",
1263
- "DeploymentStyle": {
1264
- "DeploymentOption": "WITH_TRAFFIC_CONTROL",
1265
- "DeploymentType": "BLUE_GREEN",
1266
- },
1267
- "ServiceRoleArn": {
1268
- "Fn::GetAtt": [
1269
- "codedeploygroupServiceRole1BD49E37",
1270
- "Arn",
1271
- ],
1272
- },
1273
- },
1274
- "Type": "AWS::CodeDeploy::DeploymentGroup",
1275
- },
1276
- "codedeploygroupServiceRole1BD49E37": {
1277
- "Properties": {
1278
- "AssumeRolePolicyDocument": {
1279
- "Statement": [
1280
- {
1281
- "Action": "sts:AssumeRole",
1282
- "Effect": "Allow",
1283
- "Principal": {
1284
- "Service": {
1285
- "Fn::FindInMap": [
1286
- "ServiceprincipalMap",
1287
- {
1288
- "Ref": "AWS::Region",
1289
- },
1290
- "codedeploy",
1291
- ],
1292
- },
1293
- },
1294
- },
1295
- ],
1296
- "Version": "2012-10-17",
1297
- },
1298
- "ManagedPolicyArns": [
1299
- {
1300
- "Fn::Join": [
1301
- "",
1302
- [
1303
- "arn:",
1304
- {
1305
- "Ref": "AWS::Partition",
1306
- },
1307
- ":iam::aws:policy/service-role/AWSCodeDeployRoleForLambdaLimited",
1308
- ],
1309
- ],
1310
- },
1311
- ],
1312
- },
1313
- "Type": "AWS::IAM::Role",
1314
- },
1315
- "codedeploygroupServiceRoleDefaultPolicy2027BC9A": {
1316
- "Properties": {
1317
- "PolicyDocument": {
1318
- "Statement": [
1319
- {
1320
- "Action": "lambda:InvokeFunction",
1321
- "Effect": "Allow",
1322
- "Resource": [
1323
- {
1324
- "Fn::GetAtt": [
1325
- "workerprehook415B13CE",
1326
- "Arn",
1327
- ],
1328
- },
1329
- {
1330
- "Fn::Join": [
1331
- "",
1332
- [
1333
- {
1334
- "Fn::GetAtt": [
1335
- "workerprehook415B13CE",
1336
- "Arn",
1337
- ],
1338
- },
1339
- ":*",
1340
- ],
1341
- ],
1342
- },
1343
- ],
1344
- },
1345
- {
1346
- "Action": "lambda:InvokeFunction",
1347
- "Effect": "Allow",
1348
- "Resource": [
1349
- {
1350
- "Fn::GetAtt": [
1351
- "workerposthook150842D6",
1352
- "Arn",
1353
- ],
1354
- },
1355
- {
1356
- "Fn::Join": [
1357
- "",
1358
- [
1359
- {
1360
- "Fn::GetAtt": [
1361
- "workerposthook150842D6",
1362
- "Arn",
1363
- ],
1364
- },
1365
- ":*",
1366
- ],
1367
- ],
1368
- },
1369
- ],
1370
- },
1371
- ],
1372
- "Version": "2012-10-17",
1373
- },
1374
- "PolicyName": "codedeploygroupServiceRoleDefaultPolicy2027BC9A",
1375
- "Roles": [
1376
- {
1377
- "Ref": "codedeploygroupServiceRole1BD49E37",
1378
- },
1379
- ],
1380
- },
1381
- "Type": "AWS::IAM::Policy",
1382
- },
1383
716
  "kmskey49FBC3B3": {
1384
717
  "DeletionPolicy": "Retain",
1385
718
  "Properties": {
@@ -1549,11 +882,17 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
1549
882
  ],
1550
883
  },
1551
884
  "Runtime": "nodejs20.x",
885
+ "Tags": [
886
+ {
887
+ "Key": "aws-codedeploy-hooks",
888
+ "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
889
+ },
890
+ ],
1552
891
  "Timeout": 30,
1553
892
  },
1554
893
  "Type": "AWS::Lambda::Function",
1555
894
  },
1556
- "workerAliaslive62FE5FAF": {
895
+ "workerAliasLive4B82F015": {
1557
896
  "Properties": {
1558
897
  "Description": "The Lambda version currently receiving traffic",
1559
898
  "FunctionName": {
@@ -1565,27 +904,81 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
1565
904
  "Version",
1566
905
  ],
1567
906
  },
1568
- "Name": "live",
907
+ "Name": "Live",
1569
908
  },
1570
909
  "Type": "AWS::Lambda::Alias",
1571
910
  "UpdatePolicy": {
1572
911
  "CodeDeployLambdaAliasUpdate": {
1573
912
  "AfterAllowTrafficHook": {
1574
- "Ref": "workerposthook150842D6",
913
+ "Fn::Select": [
914
+ 6,
915
+ {
916
+ "Fn::Split": [
917
+ ":",
918
+ {
919
+ "Fn::Join": [
920
+ "",
921
+ [
922
+ "arn:",
923
+ {
924
+ "Ref": "AWS::Partition",
925
+ },
926
+ ":lambda:",
927
+ {
928
+ "Ref": "AWS::Region",
929
+ },
930
+ ":",
931
+ {
932
+ "Ref": "AWS::AccountId",
933
+ },
934
+ ":function:aws-codedeploy-hook-AfterAllowTraffic",
935
+ ],
936
+ ],
937
+ },
938
+ ],
939
+ },
940
+ ],
1575
941
  },
1576
942
  "ApplicationName": {
1577
- "Ref": "codedeployapplicationF49B9864",
943
+ "Ref": "workerDeploymentCodeDeployLambdaApplication9974008D",
1578
944
  },
1579
945
  "BeforeAllowTrafficHook": {
1580
- "Ref": "workerprehook415B13CE",
946
+ "Fn::Select": [
947
+ 6,
948
+ {
949
+ "Fn::Split": [
950
+ ":",
951
+ {
952
+ "Fn::Join": [
953
+ "",
954
+ [
955
+ "arn:",
956
+ {
957
+ "Ref": "AWS::Partition",
958
+ },
959
+ ":lambda:",
960
+ {
961
+ "Ref": "AWS::Region",
962
+ },
963
+ ":",
964
+ {
965
+ "Ref": "AWS::AccountId",
966
+ },
967
+ ":function:aws-codedeploy-hook-BeforeAllowTraffic",
968
+ ],
969
+ ],
970
+ },
971
+ ],
972
+ },
973
+ ],
1581
974
  },
1582
975
  "DeploymentGroupName": {
1583
- "Ref": "codedeploygroup441B094B",
976
+ "Ref": "workerDeploymentCodeDeployLambdaDeploymentGroupF884ECDA",
1584
977
  },
1585
978
  },
1586
979
  },
1587
980
  },
1588
- "workerAliasliveSqsEventSourceappStackworkerqueue8281B9F42DEDB47B": {
981
+ "workerAliasLiveSqsEventSourceappStackworkerqueue8281B9F443B0CF93": {
1589
982
  "Properties": {
1590
983
  "EventSourceArn": {
1591
984
  "Fn::GetAtt": [
@@ -1604,19 +997,16 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
1604
997
  "Fn::Split": [
1605
998
  ":",
1606
999
  {
1607
- "Ref": "workerAliaslive62FE5FAF",
1000
+ "Ref": "workerAliasLive4B82F015",
1608
1001
  },
1609
1002
  ],
1610
1003
  },
1611
1004
  ],
1612
1005
  },
1613
- ":live",
1006
+ ":Live",
1614
1007
  ],
1615
1008
  ],
1616
1009
  },
1617
- "ScalingConfig": {
1618
- "MaximumConcurrency": 20,
1619
- },
1620
1010
  },
1621
1011
  "Type": "AWS::Lambda::EventSourceMapping",
1622
1012
  },
@@ -1628,126 +1018,50 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
1628
1018
  },
1629
1019
  "Type": "AWS::Lambda::Version",
1630
1020
  },
1631
- "workerServiceRole2130CC7F": {
1632
- "Properties": {
1633
- "AssumeRolePolicyDocument": {
1634
- "Statement": [
1635
- {
1636
- "Action": "sts:AssumeRole",
1637
- "Effect": "Allow",
1638
- "Principal": {
1639
- "Service": "lambda.amazonaws.com",
1640
- },
1641
- },
1642
- ],
1643
- "Version": "2012-10-17",
1644
- },
1645
- "ManagedPolicyArns": [
1646
- {
1647
- "Fn::Join": [
1648
- "",
1649
- [
1650
- "arn:",
1651
- {
1652
- "Ref": "AWS::Partition",
1653
- },
1654
- ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
1655
- ],
1656
- ],
1657
- },
1658
- ],
1659
- },
1660
- "Type": "AWS::IAM::Role",
1661
- },
1662
- "workerServiceRoleDefaultPolicyBA498553": {
1021
+ "workerDeploymentCodeDeployLambdaApplication9974008D": {
1663
1022
  "Properties": {
1664
- "PolicyDocument": {
1665
- "Statement": [
1666
- {
1667
- "Action": [
1668
- "sqs:ReceiveMessage",
1669
- "sqs:ChangeMessageVisibility",
1670
- "sqs:GetQueueUrl",
1671
- "sqs:DeleteMessage",
1672
- "sqs:GetQueueAttributes",
1673
- ],
1674
- "Effect": "Allow",
1675
- "Resource": {
1676
- "Fn::GetAtt": [
1677
- "workerqueueA05CE5C6",
1678
- "Arn",
1679
- ],
1680
- },
1681
- },
1682
- {
1683
- "Action": "kms:Decrypt",
1684
- "Effect": "Allow",
1685
- "Resource": {
1686
- "Fn::GetAtt": [
1687
- "kmskey49FBC3B3",
1688
- "Arn",
1689
- ],
1690
- },
1691
- },
1692
- ],
1693
- "Version": "2012-10-17",
1694
- },
1695
- "PolicyName": "workerServiceRoleDefaultPolicyBA498553",
1696
- "Roles": [
1023
+ "ComputePlatform": "Lambda",
1024
+ "Tags": [
1697
1025
  {
1698
- "Ref": "workerServiceRole2130CC7F",
1026
+ "Key": "aws-codedeploy-hooks",
1027
+ "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
1699
1028
  },
1700
1029
  ],
1701
1030
  },
1702
- "Type": "AWS::IAM::Policy",
1031
+ "Type": "AWS::CodeDeploy::Application",
1703
1032
  },
1704
- "workerposthook150842D6": {
1705
- "DependsOn": [
1706
- "workerposthookServiceRoleDefaultPolicy6A92F69C",
1707
- "workerposthookServiceRole25452300",
1708
- ],
1033
+ "workerDeploymentCodeDeployLambdaDeploymentGroupF884ECDA": {
1709
1034
  "Properties": {
1710
- "Architectures": [
1711
- "arm64",
1712
- ],
1713
- "Code": {
1714
- "S3Bucket": {
1715
- "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}",
1716
- },
1717
- "S3Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.zip",
1718
- },
1719
- "Environment": {
1720
- "Variables": {
1721
- "ENVIRONMENT": "prod",
1722
- "FUNCTION_NAME_TO_PRUNE": {
1723
- "Ref": "worker28EA3E30",
1724
- },
1725
- "NODE_ENV": "production",
1726
- "NODE_OPTIONS": "--enable-source-maps",
1727
- "SERVICE": "serviceName",
1728
- "VERSION": "local",
1729
- },
1035
+ "ApplicationName": {
1036
+ "Ref": "workerDeploymentCodeDeployLambdaApplication9974008D",
1730
1037
  },
1731
- "FunctionName": "serviceName-post-hook",
1732
- "Handler": "index.handler",
1733
- "KmsKeyArn": {
1734
- "Fn::GetAtt": [
1735
- "kmskey49FBC3B3",
1736
- "Arn",
1038
+ "AutoRollbackConfiguration": {
1039
+ "Enabled": true,
1040
+ "Events": [
1041
+ "DEPLOYMENT_FAILURE",
1737
1042
  ],
1738
1043
  },
1739
- "Role": {
1044
+ "DeploymentConfigName": "CodeDeployDefault.LambdaAllAtOnce",
1045
+ "DeploymentStyle": {
1046
+ "DeploymentOption": "WITH_TRAFFIC_CONTROL",
1047
+ "DeploymentType": "BLUE_GREEN",
1048
+ },
1049
+ "ServiceRoleArn": {
1740
1050
  "Fn::GetAtt": [
1741
- "workerposthookServiceRole25452300",
1051
+ "workerDeploymentCodeDeployLambdaDeploymentGroupServiceRole351C6FAE",
1742
1052
  "Arn",
1743
1053
  ],
1744
1054
  },
1745
- "Runtime": "nodejs20.x",
1746
- "Timeout": 30,
1055
+ "Tags": [
1056
+ {
1057
+ "Key": "aws-codedeploy-hooks",
1058
+ "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
1059
+ },
1060
+ ],
1747
1061
  },
1748
- "Type": "AWS::Lambda::Function",
1062
+ "Type": "AWS::CodeDeploy::DeploymentGroup",
1749
1063
  },
1750
- "workerposthookServiceRole25452300": {
1064
+ "workerDeploymentCodeDeployLambdaDeploymentGroupServiceRole351C6FAE": {
1751
1065
  "Properties": {
1752
1066
  "AssumeRolePolicyDocument": {
1753
1067
  "Statement": [
@@ -1755,7 +1069,7 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
1755
1069
  "Action": "sts:AssumeRole",
1756
1070
  "Effect": "Allow",
1757
1071
  "Principal": {
1758
- "Service": "lambda.amazonaws.com",
1072
+ "Service": "codedeploy.amazonaws.com",
1759
1073
  },
1760
1074
  },
1761
1075
  ],
@@ -1770,138 +1084,129 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
1770
1084
  {
1771
1085
  "Ref": "AWS::Partition",
1772
1086
  },
1773
- ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
1087
+ ":iam::aws:policy/service-role/AWSCodeDeployRoleForLambdaLimited",
1774
1088
  ],
1775
1089
  ],
1776
1090
  },
1777
1091
  ],
1092
+ "Tags": [
1093
+ {
1094
+ "Key": "aws-codedeploy-hooks",
1095
+ "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
1096
+ },
1097
+ ],
1778
1098
  },
1779
1099
  "Type": "AWS::IAM::Role",
1780
1100
  },
1781
- "workerposthookServiceRoleDefaultPolicy6A92F69C": {
1101
+ "workerDeploymentCodeDeployLambdaDeploymentGroupServiceRoleDefaultPolicy30B750B5": {
1782
1102
  "Properties": {
1783
1103
  "PolicyDocument": {
1784
1104
  "Statement": [
1785
1105
  {
1786
- "Action": [
1787
- "lambda:ListAliases",
1788
- "lambda:ListVersionsByFunction",
1789
- "lambda:DeleteFunction",
1790
- ],
1106
+ "Action": "lambda:InvokeFunction",
1791
1107
  "Effect": "Allow",
1792
1108
  "Resource": [
1793
1109
  {
1794
- "Fn::GetAtt": [
1795
- "worker28EA3E30",
1796
- "Arn",
1110
+ "Fn::Join": [
1111
+ "",
1112
+ [
1113
+ "arn:",
1114
+ {
1115
+ "Ref": "AWS::Partition",
1116
+ },
1117
+ ":lambda:",
1118
+ {
1119
+ "Ref": "AWS::Region",
1120
+ },
1121
+ ":",
1122
+ {
1123
+ "Ref": "AWS::AccountId",
1124
+ },
1125
+ ":function:aws-codedeploy-hook-BeforeAllowTraffic",
1126
+ ],
1797
1127
  ],
1798
1128
  },
1799
1129
  {
1800
1130
  "Fn::Join": [
1801
1131
  "",
1802
1132
  [
1133
+ "arn:",
1134
+ {
1135
+ "Ref": "AWS::Partition",
1136
+ },
1137
+ ":lambda:",
1803
1138
  {
1804
- "Fn::GetAtt": [
1805
- "worker28EA3E30",
1806
- "Arn",
1807
- ],
1139
+ "Ref": "AWS::Region",
1808
1140
  },
1809
- ":*",
1141
+ ":",
1142
+ {
1143
+ "Ref": "AWS::AccountId",
1144
+ },
1145
+ ":function:aws-codedeploy-hook-BeforeAllowTraffic:*",
1810
1146
  ],
1811
1147
  ],
1812
1148
  },
1813
1149
  ],
1814
1150
  },
1815
1151
  {
1816
- "Action": "codedeploy:PutLifecycleEventHookExecutionStatus",
1152
+ "Action": "lambda:InvokeFunction",
1817
1153
  "Effect": "Allow",
1818
- "Resource": {
1819
- "Fn::Join": [
1820
- "",
1821
- [
1822
- "arn:",
1823
- {
1824
- "Ref": "AWS::Partition",
1825
- },
1826
- ":codedeploy:",
1827
- {
1828
- "Ref": "AWS::Region",
1829
- },
1830
- ":",
1831
- {
1832
- "Ref": "AWS::AccountId",
1833
- },
1834
- ":deploymentgroup:",
1835
- {
1836
- "Ref": "codedeployapplicationF49B9864",
1837
- },
1838
- "/",
1839
- {
1840
- "Ref": "codedeploygroup441B094B",
1841
- },
1154
+ "Resource": [
1155
+ {
1156
+ "Fn::Join": [
1157
+ "",
1158
+ [
1159
+ "arn:",
1160
+ {
1161
+ "Ref": "AWS::Partition",
1162
+ },
1163
+ ":lambda:",
1164
+ {
1165
+ "Ref": "AWS::Region",
1166
+ },
1167
+ ":",
1168
+ {
1169
+ "Ref": "AWS::AccountId",
1170
+ },
1171
+ ":function:aws-codedeploy-hook-AfterAllowTraffic",
1172
+ ],
1842
1173
  ],
1843
- ],
1844
- },
1174
+ },
1175
+ {
1176
+ "Fn::Join": [
1177
+ "",
1178
+ [
1179
+ "arn:",
1180
+ {
1181
+ "Ref": "AWS::Partition",
1182
+ },
1183
+ ":lambda:",
1184
+ {
1185
+ "Ref": "AWS::Region",
1186
+ },
1187
+ ":",
1188
+ {
1189
+ "Ref": "AWS::AccountId",
1190
+ },
1191
+ ":function:aws-codedeploy-hook-AfterAllowTraffic:*",
1192
+ ],
1193
+ ],
1194
+ },
1195
+ ],
1845
1196
  },
1846
1197
  ],
1847
1198
  "Version": "2012-10-17",
1848
1199
  },
1849
- "PolicyName": "workerposthookServiceRoleDefaultPolicy6A92F69C",
1200
+ "PolicyName": "workerDeploymentCodeDeployLambdaDeploymentGroupServiceRoleDefaultPolicy30B750B5",
1850
1201
  "Roles": [
1851
1202
  {
1852
- "Ref": "workerposthookServiceRole25452300",
1203
+ "Ref": "workerDeploymentCodeDeployLambdaDeploymentGroupServiceRole351C6FAE",
1853
1204
  },
1854
1205
  ],
1855
1206
  },
1856
1207
  "Type": "AWS::IAM::Policy",
1857
1208
  },
1858
- "workerprehook415B13CE": {
1859
- "DependsOn": [
1860
- "workerprehookServiceRoleDefaultPolicy991A21B9",
1861
- "workerprehookServiceRole8F8D9379",
1862
- ],
1863
- "Properties": {
1864
- "Architectures": [
1865
- "arm64",
1866
- ],
1867
- "Code": {
1868
- "S3Bucket": {
1869
- "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}",
1870
- },
1871
- "S3Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.zip",
1872
- },
1873
- "Environment": {
1874
- "Variables": {
1875
- "ENVIRONMENT": "prod",
1876
- "FUNCTION_NAME_TO_INVOKE": {
1877
- "Ref": "worker28EA3E30",
1878
- },
1879
- "NODE_ENV": "production",
1880
- "NODE_OPTIONS": "--enable-source-maps",
1881
- "SERVICE": "serviceName",
1882
- "VERSION": "local",
1883
- },
1884
- },
1885
- "FunctionName": "serviceName-pre-hook",
1886
- "Handler": "index.handler",
1887
- "KmsKeyArn": {
1888
- "Fn::GetAtt": [
1889
- "kmskey49FBC3B3",
1890
- "Arn",
1891
- ],
1892
- },
1893
- "Role": {
1894
- "Fn::GetAtt": [
1895
- "workerprehookServiceRole8F8D9379",
1896
- "Arn",
1897
- ],
1898
- },
1899
- "Runtime": "nodejs20.x",
1900
- "Timeout": 120,
1901
- },
1902
- "Type": "AWS::Lambda::Function",
1903
- },
1904
- "workerprehookServiceRole8F8D9379": {
1209
+ "workerServiceRole2130CC7F": {
1905
1210
  "Properties": {
1906
1211
  "AssumeRolePolicyDocument": {
1907
1212
  "Statement": [
@@ -1929,77 +1234,52 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
1929
1234
  ],
1930
1235
  },
1931
1236
  ],
1237
+ "Tags": [
1238
+ {
1239
+ "Key": "aws-codedeploy-hooks",
1240
+ "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
1241
+ },
1242
+ ],
1932
1243
  },
1933
1244
  "Type": "AWS::IAM::Role",
1934
1245
  },
1935
- "workerprehookServiceRoleDefaultPolicy991A21B9": {
1246
+ "workerServiceRoleDefaultPolicyBA498553": {
1936
1247
  "Properties": {
1937
1248
  "PolicyDocument": {
1938
1249
  "Statement": [
1939
1250
  {
1940
- "Action": "lambda:InvokeFunction",
1941
- "Effect": "Allow",
1942
- "Resource": [
1943
- {
1944
- "Fn::GetAtt": [
1945
- "worker28EA3E30",
1946
- "Arn",
1947
- ],
1948
- },
1949
- {
1950
- "Fn::Join": [
1951
- "",
1952
- [
1953
- {
1954
- "Fn::GetAtt": [
1955
- "worker28EA3E30",
1956
- "Arn",
1957
- ],
1958
- },
1959
- ":*",
1960
- ],
1961
- ],
1962
- },
1251
+ "Action": [
1252
+ "sqs:ReceiveMessage",
1253
+ "sqs:ChangeMessageVisibility",
1254
+ "sqs:GetQueueUrl",
1255
+ "sqs:DeleteMessage",
1256
+ "sqs:GetQueueAttributes",
1963
1257
  ],
1258
+ "Effect": "Allow",
1259
+ "Resource": {
1260
+ "Fn::GetAtt": [
1261
+ "workerqueueA05CE5C6",
1262
+ "Arn",
1263
+ ],
1264
+ },
1964
1265
  },
1965
1266
  {
1966
- "Action": "codedeploy:PutLifecycleEventHookExecutionStatus",
1267
+ "Action": "kms:Decrypt",
1967
1268
  "Effect": "Allow",
1968
1269
  "Resource": {
1969
- "Fn::Join": [
1970
- "",
1971
- [
1972
- "arn:",
1973
- {
1974
- "Ref": "AWS::Partition",
1975
- },
1976
- ":codedeploy:",
1977
- {
1978
- "Ref": "AWS::Region",
1979
- },
1980
- ":",
1981
- {
1982
- "Ref": "AWS::AccountId",
1983
- },
1984
- ":deploymentgroup:",
1985
- {
1986
- "Ref": "codedeployapplicationF49B9864",
1987
- },
1988
- "/",
1989
- {
1990
- "Ref": "codedeploygroup441B094B",
1991
- },
1992
- ],
1270
+ "Fn::GetAtt": [
1271
+ "kmskey49FBC3B3",
1272
+ "Arn",
1993
1273
  ],
1994
1274
  },
1995
1275
  },
1996
1276
  ],
1997
1277
  "Version": "2012-10-17",
1998
1278
  },
1999
- "PolicyName": "workerprehookServiceRoleDefaultPolicy991A21B9",
1279
+ "PolicyName": "workerServiceRoleDefaultPolicyBA498553",
2000
1280
  "Roles": [
2001
1281
  {
2002
- "Ref": "workerprehookServiceRole8F8D9379",
1282
+ "Ref": "workerServiceRole2130CC7F",
2003
1283
  },
2004
1284
  ],
2005
1285
  },