-
-
Save cejkyle/e013b757bca86657200c3c18d5c54650 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pull the base terraform execution environment image from the Azure container registry. | |
FROM iacrepo.azurecr.io/terraform-exec-env | |
# setup argument which is used to pass and customise Terraform execution command | |
ARG terraform_cmd | |
# make folder where source code will be injected into | |
RUN mkdir -p /home/repo/ | |
# set the working directly to this location | |
WORKDIR "/home/repo/" | |
# inject source code into container during build | |
COPY ./ /home/repo/ | |
# initialise Terraform using a remote backend. | |
# Azure connection details for test subscription are stored in uat.tfvars | |
RUN /go/terraform-bundle/terraform init -backend-config uat.tfvars && \ | |
/go/terraform-bundle/terraform validate | |
# set container to automatically run terraform when the container is run | |
ENTRYPOINT [ "/go/terraform-bundle/terraform"] | |
# allow custom arguments to be passed to terraform such as plan or apply | |
CMD [$terraform_cmd] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment