Skip to content

Commit 5146fe5

Browse files
authored
chore: set lambda runtime of all CDK-vended custom resources with CustomResourceConfig (#31173)
### Reason for this change CDK-vended custom resources lambda runtime are set at creation. Modify all CDK-vended custom resources with `CustomResourceConfig` and to modify lambda runtime with `addLambdaRuntime` method. The following example modifies custom resource lambda to `PYTHON_3_12` if in the same runtime family. `CustomResourceConfig.of(app).addLambdaRuntime(lambda.Runtime.PYTHON_3_12);` ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 5d9af0f commit 5146fe5

File tree

50 files changed

+7103
-9
lines changed

Some content is hidden

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

50 files changed

+7103
-9
lines changed

packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/custom-resource-config/integ.custom-resource-config-lambda-node-runtime.js.snapshot/MyStack.assets.json

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
{
2+
"Resources": {
3+
"TableCD117FA1": {
4+
"Type": "AWS::DynamoDB::Table",
5+
"Properties": {
6+
"AttributeDefinitions": [
7+
{
8+
"AttributeName": "id",
9+
"AttributeType": "S"
10+
}
11+
],
12+
"BillingMode": "PAY_PER_REQUEST",
13+
"KeySchema": [
14+
{
15+
"AttributeName": "id",
16+
"KeyType": "HASH"
17+
}
18+
],
19+
"StreamSpecification": {
20+
"StreamViewType": "NEW_AND_OLD_IMAGES"
21+
}
22+
},
23+
"UpdateReplacePolicy": "Retain",
24+
"DeletionPolicy": "Retain"
25+
},
26+
"TableSourceTableAttachedManagedPolicyMyStackawscdkawsdynamodbReplicaProviderOnEventHandlerServiceRoleD593864897023A5A": {
27+
"Type": "AWS::IAM::ManagedPolicy",
28+
"Properties": {
29+
"Description": {
30+
"Fn::Join": [
31+
"",
32+
[
33+
"DynamoDB replication managed policy for table ",
34+
{
35+
"Ref": "TableCD117FA1"
36+
}
37+
]
38+
]
39+
},
40+
"Path": "/",
41+
"PolicyDocument": {
42+
"Statement": [
43+
{
44+
"Action": "dynamodb:*",
45+
"Effect": "Allow",
46+
"Resource": [
47+
{
48+
"Fn::GetAtt": [
49+
"TableCD117FA1",
50+
"Arn"
51+
]
52+
},
53+
{
54+
"Fn::Join": [
55+
"",
56+
[
57+
"arn:",
58+
{
59+
"Ref": "AWS::Partition"
60+
},
61+
":dynamodb:us-east-2:",
62+
{
63+
"Ref": "AWS::AccountId"
64+
},
65+
":table/",
66+
{
67+
"Ref": "TableCD117FA1"
68+
}
69+
]
70+
]
71+
},
72+
{
73+
"Ref": "AWS::NoValue"
74+
}
75+
]
76+
}
77+
],
78+
"Version": "2012-10-17"
79+
},
80+
"Roles": [
81+
{
82+
"Fn::GetAtt": [
83+
"awscdkawsdynamodbReplicaProviderNestedStackawscdkawsdynamodbReplicaProviderNestedStackResource18E3F12D",
84+
"Outputs.MyStackawscdkawsdynamodbReplicaProviderOnEventHandlerServiceRole4467C87ARef"
85+
]
86+
}
87+
]
88+
}
89+
},
90+
"TableSourceTableAttachedManagedPolicyMyStackawscdkawsdynamodbReplicaProviderIsCompleteHandlerServiceRole16B7E1B480CD9B37": {
91+
"Type": "AWS::IAM::ManagedPolicy",
92+
"Properties": {
93+
"Description": {
94+
"Fn::Join": [
95+
"",
96+
[
97+
"DynamoDB replication managed policy for table ",
98+
{
99+
"Ref": "TableCD117FA1"
100+
}
101+
]
102+
]
103+
},
104+
"Path": "/",
105+
"PolicyDocument": {
106+
"Statement": [
107+
{
108+
"Action": "dynamodb:DescribeTable",
109+
"Effect": "Allow",
110+
"Resource": [
111+
{
112+
"Fn::GetAtt": [
113+
"TableCD117FA1",
114+
"Arn"
115+
]
116+
},
117+
{
118+
"Ref": "AWS::NoValue"
119+
}
120+
]
121+
}
122+
],
123+
"Version": "2012-10-17"
124+
},
125+
"Roles": [
126+
{
127+
"Fn::GetAtt": [
128+
"awscdkawsdynamodbReplicaProviderNestedStackawscdkawsdynamodbReplicaProviderNestedStackResource18E3F12D",
129+
"Outputs.MyStackawscdkawsdynamodbReplicaProviderIsCompleteHandlerServiceRoleE7639AB2Ref"
130+
]
131+
}
132+
]
133+
}
134+
},
135+
"TableReplicauseast28A15C236": {
136+
"Type": "Custom::DynamoDBReplica",
137+
"Properties": {
138+
"ServiceToken": {
139+
"Fn::GetAtt": [
140+
"awscdkawsdynamodbReplicaProviderNestedStackawscdkawsdynamodbReplicaProviderNestedStackResource18E3F12D",
141+
"Outputs.MyStackawscdkawsdynamodbReplicaProviderframeworkonEvent53643CD7Arn"
142+
]
143+
},
144+
"TableName": {
145+
"Ref": "TableCD117FA1"
146+
},
147+
"Region": "us-east-2"
148+
},
149+
"DependsOn": [
150+
"TableSourceTableAttachedManagedPolicyMyStackawscdkawsdynamodbReplicaProviderIsCompleteHandlerServiceRole16B7E1B480CD9B37",
151+
"TableSourceTableAttachedManagedPolicyMyStackawscdkawsdynamodbReplicaProviderOnEventHandlerServiceRoleD593864897023A5A"
152+
],
153+
"UpdateReplacePolicy": "Delete",
154+
"DeletionPolicy": "Delete",
155+
"Condition": "TableStackRegionNotEqualsuseast2D20A1E77"
156+
},
157+
"awscdkawsdynamodbReplicaProviderNestedStackawscdkawsdynamodbReplicaProviderNestedStackResource18E3F12D": {
158+
"Type": "AWS::CloudFormation::Stack",
159+
"Properties": {
160+
"Parameters": {
161+
"referencetoMyStackTableA7B7AF97Ref": {
162+
"Ref": "TableCD117FA1"
163+
}
164+
},
165+
"TemplateURL": {
166+
"Fn::Join": [
167+
"",
168+
[
169+
"https://s3.",
170+
{
171+
"Ref": "AWS::Region"
172+
},
173+
".",
174+
{
175+
"Ref": "AWS::URLSuffix"
176+
},
177+
"/",
178+
{
179+
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
180+
},
181+
"/0c3131b847d4db816ed04a49102018fd29194df41b6799fefafa137e44121d44.json"
182+
]
183+
]
184+
}
185+
},
186+
"UpdateReplacePolicy": "Delete",
187+
"DeletionPolicy": "Delete"
188+
},
189+
"nonCrLambdaServiceRole10AF9D14": {
190+
"Type": "AWS::IAM::Role",
191+
"Properties": {
192+
"AssumeRolePolicyDocument": {
193+
"Statement": [
194+
{
195+
"Action": "sts:AssumeRole",
196+
"Effect": "Allow",
197+
"Principal": {
198+
"Service": "lambda.amazonaws.com"
199+
}
200+
}
201+
],
202+
"Version": "2012-10-17"
203+
},
204+
"ManagedPolicyArns": [
205+
{
206+
"Fn::Join": [
207+
"",
208+
[
209+
"arn:",
210+
{
211+
"Ref": "AWS::Partition"
212+
},
213+
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
214+
]
215+
]
216+
}
217+
]
218+
}
219+
},
220+
"nonCrLambda31AAECAA": {
221+
"Type": "AWS::Lambda::Function",
222+
"Properties": {
223+
"Code": {
224+
"ZipFile": "helloWorld"
225+
},
226+
"Handler": "index.handler",
227+
"Role": {
228+
"Fn::GetAtt": [
229+
"nonCrLambdaServiceRole10AF9D14",
230+
"Arn"
231+
]
232+
},
233+
"Runtime": "nodejs20.x"
234+
},
235+
"DependsOn": [
236+
"nonCrLambdaServiceRole10AF9D14"
237+
]
238+
}
239+
},
240+
"Conditions": {
241+
"TableStackRegionNotEqualsuseast2D20A1E77": {
242+
"Fn::Not": [
243+
{
244+
"Fn::Equals": [
245+
"us-east-2",
246+
{
247+
"Ref": "AWS::Region"
248+
}
249+
]
250+
}
251+
]
252+
}
253+
},
254+
"Parameters": {
255+
"BootstrapVersion": {
256+
"Type": "AWS::SSM::Parameter::Value<String>",
257+
"Default": "/cdk-bootstrap/hnb659fds/version",
258+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
259+
}
260+
},
261+
"Rules": {
262+
"CheckBootstrapVersion": {
263+
"Assertions": [
264+
{
265+
"Assert": {
266+
"Fn::Not": [
267+
{
268+
"Fn::Contains": [
269+
[
270+
"1",
271+
"2",
272+
"3",
273+
"4",
274+
"5"
275+
],
276+
{
277+
"Ref": "BootstrapVersion"
278+
}
279+
]
280+
}
281+
]
282+
},
283+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
284+
}
285+
]
286+
}
287+
}
288+
}

0 commit comments

Comments
 (0)