apk add bash curl curl-dev unzip
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
tflint --init
find . -name \*.tf -not -path '*.terraform*' -exec dirname {} \; | sort -u | circleci tests split > /tmp/tests_to_run
xargs -n1 sh -c 'echo "${0}" ; cd "${0}" && terraform init -backend=false -input=false' < /tmp/tests_to_run
xargs -n1 sh -c 'echo "${0}" ; cd "${0}" && terraform validate' < /tmp/tests_to_run
xargs -n1 sh -c 'echo "${0}" ; cd "${0}" && tflint --disable-rule=terraform_module_version --module' < /tmp/tests_to_run