Skip to content
Snippets Groups Projects
Commit eadb49b7 authored by nimrod's avatar nimrod
Browse files

Terraform 0.15.

Terraform 0.15 removed the option to specify the directory as an
argument. Instead it offers a new optional parameter. Instead of dealing
with different versions in specific ways, just cd to that directory.
parent 58225fae
No related branches found
No related tags found
No related merge requests found
Pipeline #1606 passed
...@@ -3,7 +3,10 @@ set -eu ...@@ -3,7 +3,10 @@ set -eu
command -v terraform >/dev/null || { echo "Can't find the terraform binary, aborting." >&2; exit 1; } command -v terraform >/dev/null || { echo "Can't find the terraform binary, aborting." >&2; exit 1; }
original_pwd="$PWD"
for i in "$@" for i in "$@"
do do
terraform fmt "$(dirname "$i")" || true cd "$(dirname "$i")"
terraform fmt || true
cd "$original_pwd"
done done
...@@ -6,10 +6,13 @@ command -v terraform >/dev/null || { echo "Can't find the terraform binary, abor ...@@ -6,10 +6,13 @@ command -v terraform >/dev/null || { echo "Can't find the terraform binary, abor
export TF_INPUT='0' export TF_INPUT='0'
export TF_IN_AUTOMATION='1' export TF_IN_AUTOMATION='1'
original_pwd="$PWD"
for i in "$@" for i in "$@"
do do
terraform init -backend=false "$(dirname "$i")" || { code='1'; continue; } cd "$(dirname "$i")"
terraform validate "$(dirname "$i")" || code='1' terraform init -backend=false || { code='1'; continue; }
terraform validate || code='1'
cd "$original_pwd"
done done
exit "${code:-0}" exit "${code:-0}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment