Terraform provides a common configuration to launch infrastructure from physical and virtual servers to email and DNS providers. Once launched, Terraform safely and efficiently changes infrastructure as the configuration is evolved.
Simple file based configuration gives you a single view of your entire infrastructure.
This Docker image is based on the official Alpine 3.2 base image.
This container expects the user to mount in a directory, which will be mapped to the /data
directory inside the container. This is the directory from which Terraform is configured to read the configuration files referenced by the commands you call.
For most terraform commands, the run command is as simple as:
docker run -it --rm broadinstitute/terraform [--version] [--help] <command> [<args>]
Some, however, require higher network privileges and SSL certificates to function correctly, which need to be mapped into the /etc/ssl/certs
directory in the container, similar to:
docker run -it --rm -v /etc/ssl/certs:/etc/ssl/certs:ro --net=host broadinstitute/terraform [--version] [--help] <command> [<args>]
Therefore, the repository used to build this container also contains a usedful terraform.sh
script that will handle most of this so that the commands can be much shorter. All that is required is filling in a config.sh
script so that the script will know where the /data
directory is located as well as the path to the SSL certificates. The script will then determine whether each individual run requires the certificates as well as things like sudo
, etc. Therefore, for the commands below, you could substitute the terraform.sh
script for everything but the command and options. For example, if you have the config.sh
correctly configured, you could do the following to run the apply command:
./terraform.sh apply [options]
docker run -it --rm -v /data:/data -v /etc/ssl/certs:/etc/ssl/certs:ro --net=host broadinstitute/terraform apply [options]
docker run -it --rm -v /data:/data broadinstitute/terraform destroy [options] [DIR]
docker run -it --rm -v /data:/data broadinstitute/terraform get [options] PATH
docker run -it --rm -v /data:/data broadinstitute/terraform graph [options]
docker run -it --rm -v /data:/data broadinstitute/terraform init [options] SOURCE [PATH]
docker run -it --rm -v /data:/data broadinstitute/terraform output [options] NAME
docker run -it --rm -v /data:/data -v /etc/ssl/certs:/etc/ssl/certs:ro --net=host broadinstitute/terraform plan [options]
docker run -it --rm -v /data:/data -v /etc/ssl/certs:/etc/ssl/certs:ro --net=host broadinstitute/terraform push [options]
docker run -it --rm -v /data:/data -v /etc/ssl/certs:/etc/ssl/certs:ro --net=host broadinstitute/terraform refresh [options]
docker run -it --rm -v /data:/data -v /etc/ssl/certs:/etc/ssl/certs:ro --net=host broadinstitute/terraform remote [options]
docker run -it --rm -v /data:/data broadinstitute/terraform show terraform.tfstate [options]
docker run -it --rm -v /data:/data -v /etc/ssl/certs:/etc/ssl/certs:ro --net=host broadinstitute/terraform taint [options] name
docker run -it --rm broadinstitute/terraform version