Created
April 28, 2016 22:31
-
-
Save zankich/06635e1ad9136d61a71960af68558795 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash -xu | |
export AWS_ACCESS_KEY_ID= | |
export AWS_SECRET_ACCESS_KEY= | |
export AWS_REGION=us-east-1 | |
function main() { | |
local times | |
times=0 | |
while true | |
do | |
times=$((times + 1)) | |
echo "Creating stack, time ${times}" | |
aws cloudformation create-stack --stack-name bug6 --template-body file:///Users/pivotal/go/src/github.com/pivotal-cf-experimental/bosh-bootloader/aws/cloudformation/templates/fixtures/cloudformation_with_concourse_elb.json --capabilities CAPABILITY_IAM | |
while true | |
do | |
local status | |
status=`aws cloudformation describe-stacks --stack-name bug6 | jq .Stacks[].StackStatus` | |
echo "stack status: ${status}" | |
if [ "$status" == "\"CREATE_COMPLETE\"" ] | |
then | |
echo "stack created successfully" | |
break | |
fi | |
done | |
aws cloudformation delete-stack --stack-name bug6 | |
local return_code | |
return_code=0 | |
while [ "${return_code}" -ne 255 ]; do | |
local output | |
output=`aws cloudformation describe-stacks --stack-name bug6` | |
return_code=$? | |
echo "${output}" | jq .Stacks[].StackStatus | |
done | |
echo "stack deleted successfully" | |
done | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment