Created
April 1, 2018 02:41
-
-
Save dejanvasic85/999811e5a837fe2f70e8dcbd9ae0b72a to your computer and use it in GitHub Desktop.
Deploy shell script
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
| #!/usr/bin/env bash | |
| set -ex | |
| BUILD_NUMBER=${TRAVIS_BUILD_NUMBER:-45} | |
| DEPLOY_ENV=${TRAVIS_DEPLOY_ENV:-staging} | |
| echo "Starting deployment using terraform, build number: $BUILD_NUMBER, environment: $DEPLOY_ENV" | |
| cd ./ops/terraform | |
| echo "Cleaning Terraform" | |
| rm -rf .terraform | |
| echo "Terraform version ..." | |
| terraform --version | |
| terraform init -input=false -backend-config "./env/$DEPLOY_ENV.backend.tfconfig" -var-file="./env/$DEPLOY_ENV.tfvars" | |
| terraform plan -input=false -var-file="./env/$DEPLOY_ENV.tfvars" -var app_version=$BUILD_NUMBER | |
| terraform apply -var-file="./env/$DEPLOY_ENV.tfvars" -input=false -auto-approve -var app_version=$BUILD_NUMBER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment