custom-resources: Custom Resources Provider
using deprecated logRetention property
#28931
Labels
@aws-cdk/custom-resources
Related to AWS CDK Custom Resources
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
Describe the bug
Using a Custom Resource as defined using the
Provider
constructor is resulting in a synthesis warning:This API will be removed in the next major release.
new cr.Provider(this, 'someProvider', {
onEventHandler: new lambda.NodejsFunction(this, 'someLambda', {
entry: resolve(__dirname, './myLambda.ts'),
runtime: Runtime.NODEJS_18_X,
handler: 'handler',
timeout: Duration.minutes(10),
logGroup, // Existing log group created outside of this Provider
initialPolicy: [
new iam.PolicyStatement({
resources: [logGroup.logGroupArn],
actions: ['logs:CreateLogStream', 'logs:PutLogEvents'],
}),
],
bundling: {
minify: true,
},
}),
logRetention: RetentionDays.FIVE_DAYS, // This line causes the error
});
new AwsCustomResourceSingletonFunction(this, 'Provider', {
uuid: AwsCustomResource.PROVIDER_FUNCTION_UUID,
lambdaPurpose: 'AWS',
timeout: props.timeout || cdk.Duration.minutes(2),
role: props.role,
logRetention: props.logRetention,
functionName: props.functionName,
vpc: props.vpc,
vpcSubnets: props.vpcSubnets,
});
export class AwsCustomResourceSingletonFunction extends lambda.SingletonFunction {
public constructor(scope: Construct, id: string, props: AwsCustomResourceSingletonFunctionProps) {
super(scope, id, {
...props,
"code": lambda.Code.fromAsset(path.join(__dirname, 'aws-custom-resource-handler')),
"handler": "index.handler",
"runtime": lambda.Runtime.NODEJS_18_X
});
}
}
The text was updated successfully, but these errors were encountered: