Skip to content

Commit

Permalink
Update destroy.sh (#1496)
Browse files Browse the repository at this point in the history
  • Loading branch information
bflynn-cms authored Aug 23, 2024
1 parent ec6965d commit 7854195
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions destroy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@ do
echo `aws s3api delete-objects --bucket $x --delete "$(aws s3api list-object-versions --bucket $x --query='{Objects: DeleteMarkers[].{Key:Key,VersionId:VersionId}}')"`
#delete any unversioned files
echo `aws s3 rm s3://$x/ --recursive`
#turn off writes to bucket
echo `aws s3api put-bucket-policy --bucket $x --policy '{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Principal": "*",
"Action": [
"s3:PutObject"
],
"Resource": "arn:aws:s3:::'"$x"'/*"
}
]
}'`
#force delete the bucket
echo `aws s3api rb s3://$x --force`
done
echo 'deleting stack: ' $i
echo `aws cloudformation delete-stack --stack-name $i`
Expand Down

0 comments on commit 7854195

Please sign in to comment.