From 9028eeb36c0af219b947e98230e6865ef13de85b Mon Sep 17 00:00:00 2001 From: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com> Date: Tue, 12 Sep 2023 04:17:01 -0400 Subject: [PATCH] chore(aws-cdk-lib): airlift stable custom resource handlers only (#27101) Experimental custom resource handlers should be airlifted to their experimental modules only. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../custom-resource-handlers/README.md | 21 ++++++++++++++++++- .../airlift-custom-resource-handlers.sh | 6 +++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/custom-resource-handlers/README.md b/packages/@aws-cdk/custom-resource-handlers/README.md index af95011c5eeeb..a4beb0b3f433e 100644 --- a/packages/@aws-cdk/custom-resource-handlers/README.md +++ b/packages/@aws-cdk/custom-resource-handlers/README.md @@ -2,14 +2,33 @@ This package contains the following custom resource handlers: +Stable: + - aws-s3/auto-delete-objects-handler - aws-ecr/auto-delete-images-handler +- aws-events-targets/aws-api-handler +- custom-resources/aws-custom-resource-handler + +These handlers are copied into `aws-cdk-lib/custom-resource-handlers` at build time +and included as part of the `aws-cdk-lib` package. + +Experimental: + - aws-synthetics-alpha/auto-delete-underlying-resources-handler -In addition, it includes `nodejs-entrypoint.ts`, which is a wrapper that talks to +These handlers are excluded from `aws-cdk-lib/custom-resource-handlers` and are individually +copied into their respective `-alpha` packages at build time. When an `-alpha` package is +stabilized, part of the stabilization process **must** be to remove `-alpha` from the folder +name, so that it is included in `aws-cdk-lib`. + +## Nodejs Entrypoint + +This package also includes `nodejs-entrypoint.ts`, which is a wrapper that talks to CloudFormation for you. At build time, `nodejs-entrypoint.js` is bundled into the `.js` file of the custom resource handler, creating one `index.js` file. This file is then either copied into a CDK asset or copied as inline code directly in the CloudFormation template. +## Future Work + In the future this package will contain all custom resources and their tests. diff --git a/packages/aws-cdk-lib/scripts/airlift-custom-resource-handlers.sh b/packages/aws-cdk-lib/scripts/airlift-custom-resource-handlers.sh index 066e38a17a4a8..1ec9c46f376f3 100755 --- a/packages/aws-cdk-lib/scripts/airlift-custom-resource-handlers.sh +++ b/packages/aws-cdk-lib/scripts/airlift-custom-resource-handlers.sh @@ -4,13 +4,13 @@ scriptdir=$(cd $(dirname $0) && pwd) customresourcedir=$(node -p "path.dirname(require.resolve('@aws-cdk/custom-resource-handlers/package.json'))") awscdklibdir=${scriptdir}/.. -list_custom_resources() { - for file in $customresourcedir/dist/*/*/index.js; do +list_stable_custom_resources() { + for file in $customresourcedir/dist/*[^-alpha]/*/index.js; do echo $file | rev | cut -d "/" -f 2-4 | rev done } -customresources=$(list_custom_resources) +customresources=$(list_stable_custom_resources) echo $customresources