Run terratest inside a docker container
10K+
This repo contains a docker image used to test Terraform resources with Terratest. The container is run with the user terratest, uid = 1000 so that any terraform related files are not created as root.
Terraform Version: Same as the docker tag
GoLang Version (1.12.x): 1.24
GoLang Version (1.5.x - 1.11.x): 1.22
GoLang Version (1.2.3 - 1.4.x): 1.18
GoLang Version (1.0.x - 1.2.2): 1.16
Checkout the repository.
git clone [email protected]:austincloudguru/docker-terratest
Build the Docker Image:
docker build -t austincloud/terratest .
You will need to pass the terraform directory to the container as well as AWS credentials. By default, the container assumes that tests are in the test directory. If your tests are in a different directory, you can add the -w /go/src/app/$TEST_DIR to your docker command.
Running it with AWS environmental variables
docker run --rm -it \
-v $PWD:/go/src/app \
--env-file <(env | grep "^AWS") \
austincloud/terratest go test -v
Running it using AWS credential files
docker run --rm -it \
-v $PWD:/go/src/app \
-v $(cd ~ && pwd)/.aws:/terratest/.aws \
-e AWS_PROFILE=dev \
austincloud/terratest go test -v
Module is maintained by Mark Honomichl.
MIT Licensed. See LICENSE for full details
Content type
Image
Digest
sha256:058a1fa41…
Size
391.6 MB
Last updated
over 1 year ago
docker pull austincloud/terratest