Git Product home page Git Product logo

docker-terraform's Introduction

Docker Terraform

Containerised Terraform CLI with Pythyon3, GCP, AWS sdks and GOSU installed.

Usage

The example using the terraform user inside the container. This is explained below in Configuration.

Docker

Run as a command:

docker run --rm -v ~/.aws:/home/terraform/.aws -v $(pwd):/opt/terraform sivakumarvunnam/terraform:0.15.5 --version

Bash

Can also set as a bash function and placed in your ~/.bashrc or equivalent for quick access, with correct mounting points:

function terraform() {
  docker run --rm -it -v ~/.aws:/home/terraform/.aws -v $(pwd):/opt/terraform sivakumarvunnam/terraform:0.15.5 "$@";
}

Then run terraform {params} {action} just like you are using your local terraform executable.

Configuration

There are some custom configurations that can be applied to prevent the container from running as root and owning all your files. gosu is utilised to set the UID and GID of the custom user inside the container to whatever /opt/terraform is mounted as from the host.

Environment Variables

Here are some quick optional environment variables to get you started:

  • TERRAFORM_UID - Custom UID to run terraform process as. Default will try to determine from host mount permissions (i.e. your user ID).
  • TERRAFORM_GID - Custom GID to run terraform process as. Default will try to determine from host mount permissions (i.e. your group ID).
  • TERRAFORM_USER - Custom user name to run terraform process as. Defaults to terraform
  • TERRAFORM_GROUP - Custom group name to run terraform process as. Defaults to terraform

Remember that these variables are completely optional and that the entrypoint.sh will do its best to determine UID and GID of the user that invokes the container from the host machine by whatever the mount point is.

Build

Update the TERRAFORM_VERSION in both Makefile and DockerFile. Then run:

make build

docker-terraform's People

Watchers

James Cloos avatar Sivakumar Vunnam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.