Created
January 6, 2017 09:53
-
-
Save svdgraaf/6c6ab9e9263e84b838234d910409b6b6 to your computer and use it in GitHub Desktop.
AWS CodePipeline CloudFormation template length workaround
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
version: 0.1 | |
phases: | |
pre_build: | |
commands: | |
- pip install awscli | |
build: | |
commands: | |
post_build: | |
commands: | |
- aws s3 cp ./cfn-ec2.json s3://attunuri/cfn-ec2.json | |
- aws cloudformation create-stack --stack-name <stack_name> --template-url https://s3.amazonaws.com/<bucket>/template.json --disable-rollback || aws cloudformation update-stack --stack-name cfn-ec2 --template-url https://s3.amazonaws.com/<bucket>/template.json |
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
# create stack cmd | |
exit_status=$? | |
if [ $exit_status -ne 0 ] | |
then | |
cmd_output="$(# update stack 2>&1)" | |
exit_status=$? | |
if [ $exit_status -ne 0 ] | |
then | |
echo "$cmd_output" | grep -q "No updates to be performed" | |
if [ $? -eq 0 ] | |
then | |
exit_status=0 | |
fi | |
fi | |
fi | |
exit $exit_status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment