pre-commit-opentofu/terraform_validate_no_variables.sh

22 lines
442 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2018-01-24 13:34:34 +01:00
set -e
2018-01-24 13:34:34 +01:00
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
2018-01-24 13:48:44 +01:00
2018-01-24 13:57:41 +01:00
if [[ "$?" -ne 0 ]]; then
2018-01-24 13:48:44 +01:00
echo
echo "Failed path: $path_uniq"
echo "================================"
fi
2018-01-24 13:34:34 +01:00
popd > /dev/null
done