Skip to content

Instantly share code, notes, and snippets.

@klovanone
Created March 30, 2023 21:02
Show Gist options
  • Save klovanone/f7f656fe1124ec72b6dc33fa9c0b0f92 to your computer and use it in GitHub Desktop.
Save klovanone/f7f656fe1124ec72b6dc33fa9c0b0f92 to your computer and use it in GitHub Desktop.
Terraform docker image docker-compose.yaml for dev CI/CID
Version: '3.8'
services:
terraform:
image: hashicorp/terraform:1.4.2
container_name: terraform-b
volumes:
- /home/ccc/b_cloud/terraform:/workspace
working_dir: /workspace
environment:
# see README.txt for info on how to export this token
JSON_TF_AUTH: ${JSON_TF_AUTH}
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
#command: /bin/sh -c "tail -f /dev/null"
command:
# tail -f stops the container from exiting if one wants to interactively connect to the container, comment out for non-interactive mode
# Notes:
# --
# 1. before running docker compose up remember to run the .sh script that temporarily populates ENV variables on the host
# 2.
# use program 'password-store' on host (dev env only) to store the API JSON key. (but use google auth provider for prod)
- /bin/sh
- -c
- |
mkdir ~/.terraform.d
echo $${JSON_TF_AUTH} > ~/.terraform.d/credentials.tfrc.json
tail -f /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment