-
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(cli): parameter values with multiple
=
symbols get truncated (#…
…7226) Using `cdk-deploy` with `--parameters` flag loses part of parameter string if it contains more than one `=` symbol Why? Because current code splits parameter string on "=" and only adds the 1st element to parameterMap as a value Fixes #7246
- Loading branch information
1 parent
7695f2b
commit b7ddf5b
Showing
5 changed files
with
65 additions
and
4 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
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
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
41 changes: 41 additions & 0 deletions
41
packages/aws-cdk/test/integ/cli/test-cdk-deploy-with-parameters-multi.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,41 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
scriptdir=$(cd $(dirname $0) && pwd) | ||
source ${scriptdir}/common.bash | ||
# ---------------------------------------------------------- | ||
|
||
setup | ||
|
||
paramVal1="${STACK_NAME_PREFIX}bazinga" | ||
paramVal2="${STACK_NAME_PREFIX}=jagshemash" | ||
|
||
stack_arn=$(cdk deploy -v ${STACK_NAME_PREFIX}-param-test-3 --parameters "TopicNameParam=${paramVal1}" --parameters "OtherTopicNameParam=${paramVal2}") | ||
echo "Stack deployed successfully" | ||
|
||
# verify that we only deployed a single stack (there's a single ARN in the output) | ||
assert_lines "${stack_arn}" 1 | ||
|
||
# verify the number of resources in the stack | ||
response_json=$(mktemp).json | ||
aws cloudformation describe-stack-resources --stack-name ${stack_arn} > ${response_json} | ||
resource_count=$(node -e "console.log(require('${response_json}').StackResources.length)") | ||
|
||
# verify whether the stack has the same parameter values as we passed in cli | ||
for (( i=0; i<$resource_count; i++ )); do | ||
passedParameterVal=$(node -e "console.log(require('${response_json}').StackResources[$i].PhysicalResourceId.split(':').reverse()[0])") | ||
|
||
if ! [[ "${passedParameterVal}" =~ ^(${paramVal1}|{$paramVal2})$ ]]; then | ||
fail "expected stack to have parameter: ${passedParameterVal}" | ||
fi | ||
done; | ||
|
||
# verify the number of resources in the stack | ||
if [ "${resource_count}" -ne 2 ]; then | ||
fail "stack has ${resource_count} resources, and we expected two" | ||
fi | ||
|
||
# destroy | ||
cdk destroy -f ${STACK_NAME_PREFIX}-param-test-3 | ||
|
||
|
||
echo "✅ success" |