-
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(toolkit): do not deploy empty stacks (#3144)
* fix(toolkit): do not deploy empty stacks * use warning * destroy empty stack if it exists * change mode to ForReading * force destroy * optional roleArn * remove 'skipping deployment' when destroying * set exclusively to true * make deployesque * add integ test
- Loading branch information
1 parent
e9eb183
commit 64ace90
Showing
5 changed files
with
147 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
scriptdir=$(cd $(dirname $0) && pwd) | ||
source ${scriptdir}/common.bash | ||
# ---------------------------------------------------------- | ||
|
||
setup | ||
|
||
# Deploy without resource | ||
NO_RESOURCE="TRUE" cdk deploy ${STACK_NAME_PREFIX}-conditional-resource | ||
|
||
# Verify that deploy has been skipped | ||
deployed=1 | ||
aws cloudformation describe-stacks --stack-name ${STACK_NAME_PREFIX}-conditional-resource > /dev/null 2>&1 || deployed=0 | ||
|
||
if [ $deployed -ne 0 ]; then | ||
fail 'Stack has been deployed' | ||
fi | ||
|
||
# Deploy the stack with resources | ||
cdk deploy ${STACK_NAME_PREFIX}-conditional-resource | ||
|
||
# Now, deploy the stack without resources | ||
NO_RESOURCE="TRUE" cdk deploy ${STACK_NAME_PREFIX}-conditional-resource | ||
|
||
# Verify that the stack has been destroyed | ||
destroyed=0 | ||
aws cloudformation describe-stacks --stack-name ${STACK_NAME_PREFIX}-conditional-resource > /dev/null 2>&1 || destroyed=1 | ||
|
||
if [ $destroyed -ne 1 ]; then | ||
fail 'Stack has not been destroyed' | ||
fi | ||
|
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