update tf to 0.10.2 and enable autodeploy on staging

parent f0147a53
...@@ -19,20 +19,14 @@ tf_validate: ...@@ -19,20 +19,14 @@ tf_validate:
TF_VERSION="$(cat "${env}/.terraform_version")" TF_VERSION="$(cat "${env}/.terraform_version")"
export TF_VERSION export TF_VERSION
make tfinstall make tfinstall
if echo "$TF_VERSION" | grep -q '\.9\.'; then tf_opts="-check-variables=false"
# terraform version 0.9.x doesn't support
# the check-variables options but will pass
# with unset vars
tf_opts=""
else
tf_opts="-check-variables=false"
fi
( (
/terraform init -backend=false /terraform init -backend=false
dirs_to_check=$(find modules "$env" -name "*.tf" -type f -exec dirname {} \; | sort | uniq) dirs_to_check=$(find modules "$env" -name "*.tf" -type f -exec dirname {} \; | sort | uniq)
/bin/sh -e -c 'for d in $1; do echo "Checking $d for $0" && /terraform validate $2 "$d"; done' "$env" "$dirs_to_check" "$tf_opts" /bin/sh -e -c 'for d in $1; do echo "Checking $d for $0" && /terraform validate $2 "$d"; done' "$env" "$dirs_to_check" "$tf_opts"
) )
done done
staging_tf_plan: staging_tf_plan:
stage: planning stage: planning
environment: environment:
...@@ -43,12 +37,12 @@ staging_tf_plan: ...@@ -43,12 +37,12 @@ staging_tf_plan:
except: except:
- master - master
#staging_tf_apply: staging_tf_apply:
# stage: deployment stage: deployment
# environment: environment:
# name: staging name: staging
# script: script:
# - TF_VERSION="$(cat environments/staging/.terraform_version)" make tfinstall - TF_VERSION="$(cat environments/staging/.terraform_version)" make tfinstall
# - cd environments/staging && /terraform init -input=false -backend-config="bucket=${STATE_S3_BUCKET}" -backend-config="key=${STATE_S3_KEY}" -backend-config="region=${STATE_S3_REGION}" && /terraform apply -input=false - cd environments/staging && /terraform init -input=false -backend-config="bucket=${STATE_S3_BUCKET}" -backend-config="key=${STATE_S3_KEY}" -backend-config="region=${STATE_S3_REGION}" && /terraform apply -input=false
# only: only:
# - master - master
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment