Skip to content

Commit 275738c

Browse files
committed
feat(core): add support for description parameter in the CustomResourceProvider construct
1 parent a9caa45 commit 275738c

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

packages/@aws-cdk/core/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ stack-unique identifier and returns the service token:
428428
const serviceToken = CustomResourceProvider.getOrCreate(this, 'Custom::MyCustomResourceType', {
429429
codeDirectory: `${__dirname}/my-handler`,
430430
runtime: CustomResourceProviderRuntime.NODEJS_12, // currently the only supported runtime
431+
description: "Lambda function created by the custom resource provider",
431432
});
432433

433434
new CustomResource(this, 'MyResource', {

packages/@aws-cdk/core/lib/custom-resource-provider/custom-resource-provider.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ export interface CustomResourceProviderProps {
6767
* @default - No environment variables.
6868
*/
6969
readonly environment?: { [key: string]: string };
70+
71+
/**
72+
* A description of the function.
73+
*
74+
* @default - No description.
75+
*/
76+
readonly description?: string;
7077
}
7178

7279
/**
@@ -205,6 +212,7 @@ export class CustomResourceProvider extends CoreConstruct {
205212
Role: role.getAtt('Arn'),
206213
Runtime: 'nodejs12.x',
207214
Environment: this.renderEnvironmentVariables(props.environment),
215+
Description: props.description ?? undefined,
208216
},
209217
});
210218

packages/@aws-cdk/core/test/custom-resource-provider/custom-resource-provider.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ nodeunitShim({
187187
test.done();
188188
},
189189

190-
'memorySize and timeout'(test: Test) {
190+
'memorySize, timeout and description'(test: Test) {
191191
// GIVEN
192192
const stack = new Stack();
193193

@@ -197,13 +197,15 @@ nodeunitShim({
197197
runtime: CustomResourceProviderRuntime.NODEJS_12,
198198
memorySize: Size.gibibytes(2),
199199
timeout: Duration.minutes(5),
200+
description: 'veni vidi vici',
200201
});
201202

202203
// THEN
203204
const template = toCloudFormation(stack);
204205
const lambda = template.Resources.CustomMyResourceTypeCustomResourceProviderHandler29FBDD2A;
205206
test.deepEqual(lambda.Properties.MemorySize, 2048);
206207
test.deepEqual(lambda.Properties.Timeout, 300);
208+
test.deepEqual(lambda.Properties.Description, 'veni vidi vici');
207209
test.done();
208210
},
209211

0 commit comments

Comments
 (0)