Docker Image: terraform

Docker image to use terraform from a container. The image contains other software which is needed by other Terraform provideres as well.

Github Badge Github Badge Github Badge

About this image

Run terraform commands without installing Terraform onto any machine. The only dependency is Docker. The image ships with some addtional software like the Bitwarden CLI which is needed for the Terraform Bitwarden Provider to work.

This project is used for my Global: Apply Github Configuration pipeline. The pipeline ensures a consistent Github configuration and all configuration for all repositories.

How to use this image

Use this command to run the image as a non-root user (pass the current user of the host into the container). This is tested on Ubuntu 22.04. This example needs three environment variables TV_VAR_bw_* for the Bitwarden CLI (which is used by the Terraform Bitwarden Provider) to work. The GITHUB_TOKEN environment variable is needed for the Terraform Github Provider. Adjust the environment variables according to your needs.

docker run --rm \
  --volume /etc/passwd:/etc/passwd:ro \
  --volume /etc/group:/etc/group:ro \
  --user "$(id -u):$(id -g)" \
  --volume /etc/timezone:/etc/timezone:ro \
  --volume /etc/localtime:/etc/localtime:ro \
  --volume "$(pwd):$(pwd)" \
  --workdir "$(pwd)" \
  --env "GITHUB_TOKEN=$TOKEN" \
  --env "TF_VAR_bw_client_id=$BW_CLIENT_ID" \
  --env "TF_VAR_bw_client_secret=$BW_CLIENT_SECRET" \
  --env "TF_VAR_bw_password=$BW_MASTER_PASS" \
  sommerfeldio/terraform:latest apply -auto-approve

Risks and Technical Debts

Scale for Probability and Impact: Low, Medium and High

# Title Description Probability Impact Response

1

-

-

-

-

-

Contact

Feel free to contact me via sebastian@sommerfeld.io or visit my website https://www.sommerfeld.io.