Skip to content

Instantly share code, notes, and snippets.

@klovanone
Created March 30, 2023 21:02
Show Gist options
  • Select an option

  • Save klovanone/f7f656fe1124ec72b6dc33fa9c0b0f92 to your computer and use it in GitHub Desktop.

Select an option

Save klovanone/f7f656fe1124ec72b6dc33fa9c0b0f92 to your computer and use it in GitHub Desktop.

Revisions

  1. klovanone created this gist Mar 30, 2023.
    30 changes: 30 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    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