Skip to content

Commit f19ecef

Browse files
authored
fix(lambda): function version ignores layer version changes (#20150)
Fixes #19098. This introduces two bug fixes that are hidden behind a feature flag to preserve the current hash: - lambda layer order is ignored by the hash now - lambda layer version is included in the hash (along with other lambda layer attributes) I also added a few more tests around this area to confirm the current behavior which should help demonstrate what the feature flag will change. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 68761dc commit f19ecef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+507
-86
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"17.0.0"}
1+
{"version":"20.0.0"}

packages/@aws-cdk/aws-cloudfront/test/distribution-lambda.integ.snapshot/integ-distribution-lambda.template.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"LambdaServiceRoleA8ED4D3B"
5454
]
5555
},
56-
"LambdaCurrentVersionDF706F6A9a632a294ae3a9cd4d550f1c4e26619d": {
56+
"LambdaCurrentVersionDF706F6A1ee13d0fa54e9f5621e8c7b616fc53fc": {
5757
"Type": "AWS::Lambda::Version",
5858
"Properties": {
5959
"FunctionName": {
@@ -72,7 +72,7 @@
7272
{
7373
"EventType": "origin-request",
7474
"LambdaFunctionARN": {
75-
"Ref": "LambdaCurrentVersionDF706F6A9a632a294ae3a9cd4d550f1c4e26619d"
75+
"Ref": "LambdaCurrentVersionDF706F6A1ee13d0fa54e9f5621e8c7b616fc53fc"
7676
}
7777
}
7878
],

packages/@aws-cdk/aws-cloudfront/test/distribution-lambda.integ.snapshot/integ.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"version": "18.0.0",
2+
"version": "20.0.0",
33
"testCases": {
4-
"aws-cloudfront/test/integ.distribution-lambda": {
4+
"integ.distribution-lambda": {
55
"stacks": [
66
"integ-distribution-lambda"
77
],

packages/@aws-cdk/aws-cloudfront/test/distribution-lambda.integ.snapshot/manifest.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "17.0.0",
2+
"version": "20.0.0",
33
"artifacts": {
44
"Tree": {
55
"type": "cdk:tree",
@@ -30,14 +30,23 @@
3030
"/integ-distribution-lambda/Lambda/CurrentVersion/Resource": [
3131
{
3232
"type": "aws:cdk:logicalId",
33-
"data": "LambdaCurrentVersionDF706F6A9a632a294ae3a9cd4d550f1c4e26619d"
33+
"data": "LambdaCurrentVersionDF706F6A1ee13d0fa54e9f5621e8c7b616fc53fc"
3434
}
3535
],
3636
"/integ-distribution-lambda/Dist/Resource": [
3737
{
3838
"type": "aws:cdk:logicalId",
3939
"data": "DistB3B78991"
4040
}
41+
],
42+
"LambdaCurrentVersionDF706F6A9a632a294ae3a9cd4d550f1c4e26619d": [
43+
{
44+
"type": "aws:cdk:logicalId",
45+
"data": "LambdaCurrentVersionDF706F6A9a632a294ae3a9cd4d550f1c4e26619d",
46+
"trace": [
47+
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
48+
]
49+
}
4150
]
4251
},
4352
"displayName": "integ-distribution-lambda"

packages/@aws-cdk/aws-cloudfront/test/distribution-lambda.integ.snapshot/tree.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
"lambdaFunctionAssociations": [
167167
{
168168
"lambdaFunctionArn": {
169-
"Ref": "LambdaCurrentVersionDF706F6A9a632a294ae3a9cd4d550f1c4e26619d"
169+
"Ref": "LambdaCurrentVersionDF706F6A1ee13d0fa54e9f5621e8c7b616fc53fc"
170170
},
171171
"eventType": "origin-request"
172172
}

packages/@aws-cdk/aws-codedeploy/test/lambda/deployment-group.integ.snapshot/aws-cdk-codedeploy-lambda.template.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"HandlerServiceRoleFCDC14AE"
8686
]
8787
},
88-
"HandlerCurrentVersion93FB80BFb2a9ce598bf2730613c07e406cddb6b6": {
88+
"HandlerCurrentVersion93FB80BFf2e6129c63154d1f37c0092df295ab51": {
8989
"Type": "AWS::Lambda::Version",
9090
"Properties": {
9191
"FunctionName": {
@@ -101,7 +101,7 @@
101101
},
102102
"FunctionVersion": {
103103
"Fn::GetAtt": [
104-
"HandlerCurrentVersion93FB80BFb2a9ce598bf2730613c07e406cddb6b6",
104+
"HandlerCurrentVersion93FB80BFf2e6129c63154d1f37c0092df295ab51",
105105
"Version"
106106
]
107107
},
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"17.0.0"}
1+
{"version":"20.0.0"}

packages/@aws-cdk/aws-codedeploy/test/lambda/deployment-group.integ.snapshot/integ.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"version": "18.0.0",
2+
"version": "20.0.0",
33
"testCases": {
4-
"aws-codedeploy/test/lambda/integ.deployment-group": {
4+
"lambda/integ.deployment-group": {
55
"stacks": [
66
"aws-cdk-codedeploy-lambda"
77
],

packages/@aws-cdk/aws-codedeploy/test/lambda/deployment-group.integ.snapshot/manifest.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "17.0.0",
2+
"version": "20.0.0",
33
"artifacts": {
44
"Tree": {
55
"type": "cdk:tree",
@@ -68,7 +68,7 @@
6868
"/aws-cdk-codedeploy-lambda/Handler/CurrentVersion/Resource": [
6969
{
7070
"type": "aws:cdk:logicalId",
71-
"data": "HandlerCurrentVersion93FB80BFb2a9ce598bf2730613c07e406cddb6b6"
71+
"data": "HandlerCurrentVersion93FB80BFf2e6129c63154d1f37c0092df295ab51"
7272
}
7373
],
7474
"/aws-cdk-codedeploy-lambda/AssetParameters/edb7466707eb899fbaee22c1e67f9443e9edcc2eeda0b58d8448f7c4157746b3/S3Bucket": [
@@ -202,6 +202,15 @@
202202
"type": "aws:cdk:logicalId",
203203
"data": "ServiceprincipalMap"
204204
}
205+
],
206+
"HandlerCurrentVersion93FB80BFb2a9ce598bf2730613c07e406cddb6b6": [
207+
{
208+
"type": "aws:cdk:logicalId",
209+
"data": "HandlerCurrentVersion93FB80BFb2a9ce598bf2730613c07e406cddb6b6",
210+
"trace": [
211+
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
212+
]
213+
}
205214
]
206215
},
207216
"displayName": "aws-cdk-codedeploy-lambda"

packages/@aws-cdk/aws-codedeploy/test/lambda/deployment-group.integ.snapshot/tree.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@
313313
},
314314
"functionVersion": {
315315
"Fn::GetAtt": [
316-
"HandlerCurrentVersion93FB80BFb2a9ce598bf2730613c07e406cddb6b6",
316+
"HandlerCurrentVersion93FB80BFf2e6129c63154d1f37c0092df295ab51",
317317
"Version"
318318
]
319319
},

0 commit comments

Comments
 (0)