Updated scripts

This commit is contained in:
Anton Babenko 2018-01-24 13:34:34 +01:00
commit e220e169ca
3 changed files with 39 additions and 6 deletions

View file

@ -1,5 +1,16 @@
#!/usr/bin/env bash
set -e
for file in "$@"; do
terraform fmt "$file"
declare -a paths
index=0
for file_with_path in "$@"; do
paths[index]=$(dirname "$file_with_path")
let "index+=1"
done
for path_uniq in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
pushd "$path_uniq" > /dev/null
terraform fmt
popd > /dev/null
done

View file

@ -1,5 +1,16 @@
#!/usr/bin/env bash
set -e
for file in "$@"; do
terraform validate -check-variables=false "$file"
declare -a paths
index=0
for file_with_path in "$@"; do
paths[index]=$(dirname "$file_with_path")
let "index+=1"
done
for path_uniq in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
pushd "$path_uniq" > /dev/null
terraform validate -check-variables=false
popd > /dev/null
done

View file

@ -1,5 +1,16 @@
#!/usr/bin/env bash
set -e
for file in "$@"; do
terraform validate -check-variables=true "$file"
declare -a paths
index=0
for file_with_path in "$@"; do
paths[index]=$(dirname "$file_with_path")
let "index+=1"
done
for path_uniq in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
pushd "$path_uniq" > /dev/null
terraform validate -check-variables=true
popd > /dev/null
done