Formatter for Terragrunt HCL files (#60)

* Formatter for Terragrunt HCL files

* Adding Terragrunt documentation
This commit is contained in:
Scott Crooks 2019-08-20 20:38:40 +02:00 committed by Anton Babenko
commit d8dfc2c034
3 changed files with 32 additions and 0 deletions

23
terragrunt_fmt.sh Executable file
View file

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