Skip to content

Instantly share code, notes, and snippets.

@rk295
Created October 15, 2018 18:25
Show Gist options
  • Save rk295/36b99bc61a7c675a864d886c908da445 to your computer and use it in GitHub Desktop.
Save rk295/36b99bc61a7c675a864d886c908da445 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -eEo pipefail
baseDir="$PWD/"
modules="$(find . -maxdepth 1 -type d \! -name .git -a \! -name .)"
for module in $modules; do
echo "Checking $module"
cd "${baseDir}${module}" || exit 1
echo "Running terraform init"
terraform init
echo "Validating $module"
terraform validate -check-variables=false
echo "Style checking $module"
terraform fmt --diff=true --write=false --check=true
echo "Cleaning up"
rm -rf "${baseDir}${module}/.terraform"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment