21 lines
387 B
Bash
Executable File

#!/bin/bash
# Safe mode(when error,kill script)
set -euo pipefail
# 変数の設定({HOME}/hash.txt からハッシュ値を取得)
TF_DIR=${TF_DIR:-terraform}
ENV=${ENV:-dev}
cd "$TF_DIR"
if [ -f "${ENV}.tfvars" ]; then
terraform plan \
-out=tfplan \
-var-file="${ENV}.tfvars"
else
# error raise
echo "ERROR: ${ENV}.tfvars not found in $(pwd)" >&2
exit 1
fi