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

Another take on the whole thing.

parent 25518211
No related branches found
No related tags found
No related merge requests found
Pipeline #1594 passed
...@@ -12,24 +12,21 @@ command -v terraform >/dev/null || { echo "Can't find the terraform binary, abor ...@@ -12,24 +12,21 @@ 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'
version="$(terraform version | sed --silent 's/Terraform v\([0-9]*\)\.\([0-9]*\)\.[0-9]*$/\1.\2/p')" #version="$(terraform version | sed --silent 's/Terraform v\([0-9]*\)\.\([0-9]*\)\.[0-9]*$/\1.\2/p')"
major="$(echo "$version" | cut -d '.' -f 1)" #major="$(echo "$version" | cut -d '.' -f 1)"
minor="$(echo "$version" | cut -d '.' -f 2)" #minor="$(echo "$version" | cut -d '.' -f 2)"
if [ "$major" -gt '0' ] || [ "$minor" -gt '14' ] #if [ "$major" -gt '0' ] || [ "$minor" -gt '14' ]
then #then
post0_14='1' # post0_14='1'
fi #fi
original_pwd="$(pwd)"
for i in "$@" for i in "$@"
do do
if [ -n "${post0_14:-}" ] cd "$(dirname "$i")"
then terraform init -backend=false || { code='1'; continue; }
terraform -chdir="$(dirname "$i")" init -backend=false || { code='1'; continue; } terraform validate || code='1'
terraform -chdir="$(dirname "$i")" validate || code='1' cd "$original_pwd"
else
terraform init -backend=false "$(dirname "$i")" || { code='1'; continue; }
terraform validate "$(dirname "$i")" || code='1'
fi
done done
exit "${code:-0}" exit "${code:-0}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment