Skip to content

Commit

Permalink
destroy script adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
David Surey committed Jun 15, 2023
1 parent 91ad285 commit 0b70d12
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions destroy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ echo "using AWS Profile $BBBPROFILE"
echo "##################################################"

# Empty the ECR Repository
BBBECRStack="${BBBSTACK}-registry"
ENVIRONMENTTYPE=$(jq -r ".Parameters.BBBEnvironmentType" bbb-on-aws-param.json)
if [ "$ENVIRONMENTTYPE" == 'scalable' ]
then
Expand Down Expand Up @@ -68,9 +69,7 @@ echo "deleting the Prerequisites stacks"
echo "##################################################"

BBBPREPSTACK="${BBBSTACK}-Sources"
SOURCE=`aws cloudformation describe-stacks --profile=$BBBPROFILE --query "Stacks[0].Outputs[0].OutputValue" --stack-name $BBBPREPSTACK`

SOURCE=`echo "${SOURCE//\"}"`
SOURCE=$(aws cloudformation describe-stack-resources --profile $BBBPROFILE --stack-name $BBBPREPSTACK --query "StackResources[?ResourceType=='AWS::S3::Bucket'].PhysicalResourceId" --output text)

echo "##################################################"
echo "Truncate the S3 Bucket"
Expand All @@ -94,6 +93,9 @@ aws s3api --profile=$BBBPROFILE list-object-versions \
done
done

aws cloudformation delete-stack --stack-name $BBBECRSTACK --profile=$BBBPROFILE
aws cloudformation wait stack-delete-complete --profile=$BBBPROFILE --stack-name $BBBECRStack

aws cloudformation delete-stack --stack-name $BBBPREPSTACK --profile=$BBBPROFILE
aws cloudformation wait stack-delete-complete --profile=$BBBPROFILE --stack-name $BBBPREPSTACK

Expand Down

0 comments on commit 0b70d12

Please sign in to comment.