13 lines
620 B
Bash
13 lines
620 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
command -v terraform >/dev/null || { echo 'terraform is required'; exit 2; }
|
|
terraform -chdir="$root/terraform" fmt -check -recursive
|
|
terraform -chdir="$root/terraform" init -backend=false -input=false -no-color >/dev/null
|
|
terraform -chdir="$root/terraform" validate -no-color
|
|
if [[ "${RUN_PLAN:-false}" == "true" ]]; then
|
|
: "${TF_VAR_project_id:?Set TF_VAR_project_id for plan}"
|
|
terraform -chdir="$root/terraform" plan -refresh=false -lock=false -input=false -no-color
|
|
fi
|
|
python3 -m unittest discover -s "$root/tests" -v
|