To run TF code, put the Dockerfile into the same folder that has your TF file(s) in it, and run (from inside the folder):
docker build --pull -t tf_docker .
docker run -i --rm tf_docker
# Use the light version of the image that contains just the latest binary | |
FROM hashicorp/terraform:light | |
# The app folder will contain all our files | |
WORKDIR /app | |
# Put all your configration files in the same folder as the Dockerfile | |
COPY . /app | |
# Initalize terraform with local settings and data | |
RUN ["terraform", "init"] | |
# Plan and execute the configurations | |
CMD [ "apply"] |