If you are using terratest from Gruntwork.io, you can use this container to run your tests in your machine or in a CI/CD tool. Just use the following command:
docker run -e AWS_ACCESS_KEY_ID=$$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$$AWS_SECRET_ACCESS_KEY -v $$PWD:/go/src/app/ igordcsouza/terratest
This container expects to find your tests in a folder called test on the root of your project.
FROM golang:latest
RUN apt-get update
RUN apt-get install unzip
RUN wget https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip
RUN unzip terraform_0.11.13_linux_amd64.zip
RUN rm terraform_0.11.13_linux_amd64.zip
RUN mv terraform /usr/local/go/bin/terraform
RUN apt-get install git bash openssl
RUN go get github.com/gruntwork-io/terratest/modules/terraform
RUN go get -u github.com/golang/dep/cmd/dep
WORKDIR $GOPATH/src/github.com/gruntwork-io/terratest/modules/terraform
RUN go install
WORKDIR $GOPATH/src/app/test/
ENTRYPOINT ["sh", "-c", "dep ensure -v && go test -v"]
Content type
Image
Digest
Size
403.3 MB
Last updated
over 7 years ago
docker pull igordcsouza/terratest