-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(redshift): enableRebootForParameterChanges fails synth with "cann…
…ot find entry file…" (#28760) Error: ``` Error: Cannot find entry file at /node_modules/@aws-cdk/custom-resource-handlers/dist/ aws-redshift-alpha/asset-deployment-handler/index.js ``` This PR fixes the same issue detailed in #28658 but for `aws-redshift-alpha` as both modules have the same issue with accessing `custom-resource-handlers`. This PR uses the same airlift mechanism as `aws-cdk-lib` to move the necessary files into the `aws-redshift-alpha` package so its structure now looks like this: ``` |-- @aws-cdk |-- aws-redshift-alpha |-- custom-resource-handlers/dist/aws-redshift-alpha // airlifted in via this PR |-- custom-resource-handlers/dist |-- aws-redshift-alpha ``` The airlift script only moves the `index.js` file and not the `*/generated.ts` files because imports in alpha module `*/generated.ts` files do not currently work since the import paths were written to only support stable modules in `aws-cdk-lib`. I've tested the `aws-redshift-alpha` package locally on a local CDK app and confirmed the necessary structure exists in the packaged module. The local app calls the `cluster.enableRebootForParameterChanges()` method which creates the custom resource and I was able to verify that the cluster deploys properly and is rebootable. Related to #28633 but this is the fix for `aws-redshift-alpha` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
6 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,6 @@ junit.xml | |
test/ | ||
!*.lit.ts | ||
**/*.snapshot | ||
|
||
# include custom-resource-handlers | ||
!custom-resource-handlers/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/@aws-cdk/aws-redshift-alpha/scripts/airlift-custom-resource-handlers.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
scriptdir=$(cd $(dirname $0) && pwd) | ||
customresourcedir=$(node -p "path.dirname(require.resolve('@aws-cdk/custom-resource-handlers/package.json'))") | ||
awscdklibdir=${scriptdir}/.. | ||
|
||
function airlift() { | ||
if [[ $1 != dist/core/nodejs-entrypoint-handler && ($1 = dist/core || $1 = dist/core/*) ]]; | ||
then | ||
mkdir -p $awscdklibdir/core/lib/$1 | ||
cp $customresourcedir/$2 $awscdklibdir/core/lib/$1 | ||
else | ||
mkdir -p $awscdklibdir/custom-resource-handlers/$1 | ||
cp $customresourcedir/$2 $awscdklibdir/custom-resource-handlers/$1 | ||
fi | ||
} | ||
|
||
recurse() { | ||
local dir=$1 | ||
|
||
for file in $dir/*; do | ||
if [ -f $file ]; then | ||
case $file in | ||
$customresourcedir/dist/aws-redshift-alpha/*/index.*) | ||
cr=$(echo $file | rev | cut -d "/" -f 2-4 | rev) | ||
airlift $cr $cr/index.* | ||
;; | ||
esac | ||
fi | ||
|
||
if [ -d $file ]; then | ||
recurse $file | ||
fi | ||
done | ||
} | ||
|
||
recurse $customresourcedir/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters