This repository provides a minimal setup to run terraform from inside a Docker container.
Contents
Dockerfile: builds an image based onubuntu:latestwithterraforminstalled. The container copiesmain.tfandvariables.tfand runsterraform init,terraform planandterraform apply.terraform init:- download the right tools.
terraform plan:- says what it changes
terraform apply:- apply the configuration
Usage
- Build the Docker image:
docker build -t docker-terraform .- Run the container (you will be prompted for the SSH password):
docker run --rm -it \
-v "$PWD/main.tf:/terraform/main.tf:ro" \
-v "$PWD/variables.tf:/terrafrom/variables.tf:ro" \
docker-ansible