├── Dockerfile ├── LICENSE.txt ├── .circleci └── config.yml └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.10 2 | 3 | ENV TERRAFORM_VERSION 0.12.16 4 | 5 | RUN apk add --update wget ca-certificates unzip git bash && \ 6 | wget -q -O /terraform.zip "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" && \ 7 | unzip /terraform.zip -d /bin && \ 8 | apk del --purge wget ca-certificates unzip && \ 9 | rm -rf /var/cache/apk/* /terraform.zip 10 | 11 | VOLUME ["/data"] 12 | WORKDIR /data 13 | 14 | ENTRYPOINT ["/bin/terraform"] 15 | 16 | CMD ["--help"] 17 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2016 Shuji Yamada 2 | All Rights Reserved. 3 | 4 | MIT LICENSE 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | jobs: 4 | build: 5 | docker: 6 | - image: golang:1.6.4 7 | working_directory: /go/src/github.com/CircleCI-Public/circleci-demo-docker 8 | steps: 9 | - checkout 10 | - setup_remote_docker 11 | - run: 12 | name: Install Docker client 13 | command: | 14 | set -x 15 | VER="17.05.0-ce" 16 | curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz 17 | tar -xz -C /tmp -f /tmp/docker-$VER.tgz 18 | mv /tmp/docker/* /usr/bin 19 | - restore_cache: 20 | key: dependency-cache 21 | - run: 22 | name: docker build test 23 | command: | 24 | docker build -t uzyexe/terraform . 25 | - run: 26 | name: Make ~/docker directory 27 | command: | 28 | mkdir -p ~/docker 29 | - run: 30 | name: Save New uzyexe/terraform docker image 31 | command: | 32 | docker save uzyexe/terraform > ~/docker/image.tar 33 | - save_cache: 34 | key: dependency-cache 35 | paths: 36 | - "~/docker" 37 | - run: 38 | name: Show Terraform version 39 | command: | 40 | docker run uzyexe/terraform version 41 | - deploy: 42 | name: Deploy Master to Docker Hub 43 | command: | 44 | if [ "${CIRCLE_BRANCH}" == "master" ]; then 45 | docker login -u $DOCKER_USER -p $DOCKER_PASS 46 | docker push uzyexe/terraform 47 | fi 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![](https://badge.imagelayers.io/uzyexe/terraform:latest.svg)](https://imagelayers.io/?images=uzyexe/terraform:latest 'Get your own badge on imagelayers.io') 2 | 3 | # uzyexe/terraform [![Circle CI](https://circleci.com/gh/uzyexe/dockerfile-terraform.svg?style=svg)](https://circleci.com/gh/uzyexe/dockerfile-terraform) 4 | 5 | ## What is terraform 6 | 7 | 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. 8 | 9 | Simple file based configuration gives you a single view of your entire infrastructure. 10 | 11 | [https://www.terraform.io/](https://www.terraform.io/) 12 | 13 | ## Dockerfile 14 | 15 | [**Trusted Build**](https://hub.docker.com/r/uzyexe/terraform/) 16 | 17 | This Docker image is based on the official [alpine:3.4](https://hub.docker.com/_/alpine/) base image. 18 | 19 | ## How to use this image 20 | 21 | ``` 22 | docker run uzyexe/terraform [--version] [--help] [] 23 | 24 | ``` 25 | 26 | ## Using 27 | 28 | **Please note: Create by your Terraform configuration files (.tf) is `/data` directory** 29 | 30 | ### terraform apply 31 | 32 | ``` 33 | docker run --rm -it -v /data:/data uzyexe/terraform apply [options] 34 | ``` 35 | 36 | ### terraform destroy 37 | 38 | ``` 39 | docker run --rm -it -v /data:/data uzyexe/terraform destroy [options] [DIR] 40 | ``` 41 | 42 | ### terraform fmt 43 | 44 | ``` 45 | docker run --rm -it -v /data:/data uzyexe/terraform fmt [options] [DIR] 46 | ``` 47 | 48 | ### terraform force-unlock 49 | 50 | ``` 51 | docker run --rm -it -v /data:/data uzyexe/terraform force-unlock LOCK_ID [DIR] 52 | ``` 53 | 54 | ### terraform get 55 | 56 | ``` 57 | docker run --rm -it -v /data:/data uzyexe/terraform get [options] PATH 58 | ``` 59 | 60 | ### terraform graph 61 | 62 | ``` 63 | docker run --rm -it -v /data:/data uzyexe/terraform graph [options] 64 | ``` 65 | 66 | ### terraform import 67 | 68 | ``` 69 | docker run --rm -it -v /data:/data uzyexe/terraform [options] ADDR ID 70 | ``` 71 | 72 | ### terraform init 73 | 74 | ``` 75 | docker run --rm -it -v /data:/data uzyexe/terraform init [options] SOURCE [PATH] 76 | ``` 77 | 78 | ### terraform output 79 | 80 | ``` 81 | docker run --rm -it -v /data:/data uzyexe/terraform output [options] NAME 82 | ``` 83 | 84 | ### terraform plan 85 | 86 | ``` 87 | docker run --rm -it -v /data:/data uzyexe/terraform plan [options] 88 | ``` 89 | 90 | ### terraform providers 91 | 92 | ``` 93 | docker run --rm -it -v /data:/data uzyexe/terraform providers [config-path] 94 | ``` 95 | 96 | ### terraform push 97 | 98 | ``` 99 | docker run --rm -it -v /data:/data uzyexe/terraform push [options] 100 | ``` 101 | 102 | ### terraform refresh 103 | 104 | ``` 105 | docker run --rm -it -v /data:/data uzyexe/terraform refresh [options] 106 | ``` 107 | 108 | ### terraform show 109 | 110 | ``` 111 | docker run --rm -it -v /data:/data uzyexe/terraform show terraform.tfstate [options] 112 | ``` 113 | 114 | ### terraform state [options] [args] 115 | 116 | ``` 117 | docker run --rm -it -v /data:/data uzyexe/terraform state [options] [args] 118 | ``` 119 | 120 | ### terraform taint 121 | 122 | ``` 123 | docker run --rm -it -v /data:/data uzyexe/terraform taint [options] name 124 | ``` 125 | 126 | ### terraform untaint 127 | 128 | ``` 129 | docker run --rm -it -v /data:/data uzyexe/terraform untaint [options] name 130 | ``` 131 | 132 | ### terraform validate 133 | 134 | ``` 135 | docker run --rm -it -v /data:/data uzyexe/terraform validate 136 | ``` 137 | 138 | ### terraform version 139 | 140 | ``` 141 | docker run --rm -it uzyexe/terraform version 142 | ``` 143 | 144 | ### terraform workspace 145 | 146 | ``` 147 | docker run --rm -it uzyexe/terraform workspace [options] [args] 148 | ``` 149 | 150 | # Authors 151 | 152 | * Shuji Yamada () 153 | 154 | ## License 155 | 156 | This project is licensed under the terms of the MIT license. 157 | 158 | --------------------------------------------------------------------------------