Skip to content

Instantly share code, notes, and snippets.

@btower-labz
Last active July 26, 2020 16:10
Show Gist options
  • Save btower-labz/f9f60b8321307154c56dc75cb4c293f6 to your computer and use it in GitHub Desktop.
Save btower-labz/f9f60b8321307154c56dc75cb4c293f6 to your computer and use it in GitHub Desktop.
terraform-public-modules-scripts
echo 'Formatting go module ...\n' && docker run --rm \
-e HOME=${HOME} \
-v "${HOME}:${HOME}/" \
-v /etc/group:/etc/group:ro \
-v /etc/passwd:/etc/passwd:ro \
-u $(id -u ${USER}):$(id -g ${USER}) \
-w $(pwd) \
btowerlabz/docker-cloudbuild-terratest:latest go fmt "infra_test"
echo 'Init go module ...\n' && (test -f go.mod || \
docker run --rm \
-e HOME=${HOME} \
-v "${HOME}:${HOME}/" \
-v /etc/group:/etc/group:ro \
-v /etc/passwd:/etc/passwd:ro \
-u $(id -u ${USER}):$(id -g ${USER}) \
-w $(pwd) \
btowerlabz/docker-cloudbuild-terratest:latest go mod init "infra_test" \
)
echo 'Testing module ...' && docker run --rm \
-e HOME=${HOME} \
-e AWS_PROFILE=terraform-infra-test \
-e AWS_SDK_LOAD_CONFIG=1 \
-e GOMAXPROCS=5 \
-e GO111MODULE=on \
-e TERRATEST_REGION=us-east-1 \
-v "${HOME}:${HOME}/" \
-v /etc/group:/etc/group:ro \
-v /etc/passwd:/etc/passwd:ro \
-v $(which terraform):/usr/local/bin/terraform:ro \
-u $(id -u ${USER}):$(id -g ${USER}) \
-w $(pwd) \
btowerlabz/docker-cloudbuild-terratest:latest go test -v -timeout 30m -count=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment