Created
July 14, 2020 07:17
-
-
Save ringanta/f33833b090d5102ad6730a574d9537b9 to your computer and use it in GitHub Desktop.
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
set -e | |
TEMP_SETUP_DIR=$(mktemp -d) | |
TF_PROJECT=.deployment/terraform/trident/ap-southeast-1/${ENVIRONMENT}-${MODE} | |
function cleanup { | |
rm -fr $TEMP_SETUP_DIR tfplan.out | |
} | |
trap cleanup EXIT | |
apt-get update && apt-get -y install git curl | |
pushd $TEMP_SETUP_DIR | |
# Setup tfenv to install terraform version based on required_version setting in tf script | |
git clone https://github.com/tfutils/tfenv.git . | |
export PATH=$TEMP_SETUP_DIR/bin:$PATH | |
popd | |
pushd $TF_PROJECT | |
rm -rf .terraform | |
tfenv install min-required | |
tfenv use min-required | |
terraform init | |
terraform plan -out=tfplan.out | |
terraform apply tfplan.out | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment