Last active
March 31, 2020 12:59
-
-
Save sortega/6c99aac8b04a636032340e50c465e177 to your computer and use it in GitHub Desktop.
Place this in .git/hooks to avoid commiting malformed terraform sources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
MODULES=`find . -name '*.tf' -print0 | xargs -0 -n1 dirname | sort --unique | grep -v .terraform` | |
echo -n "fmt check" | |
for MODULE in $MODULES; do | |
(terraform fmt -check && echo -n ".") & | |
done | |
wait | |
echo " OK" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment