Created
September 10, 2017 19:35
-
-
Save lestephane/495f35de9a398ad0f613458aaeb9db15 to your computer and use it in GitHub Desktop.
Dockerized terraform bundler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:alpine | |
RUN apk update && apk upgrade && \ | |
apk add --no-cache git zip | |
ARG TERRAFORM_VERSION | |
RUN git clone --single-branch --branch v${TERRAFORM_VERSION} https://github.com/hashicorp/terraform.git /go/src/github.com/hashicorp/terraform | |
RUN cd $GOPATH/src/github.com/hashicorp/terraform && echo $GOPATH && go install ./tools/terraform-bundle | |
ADD terraform-version.hcl / | |
ADD entrypoint.sh / | |
ENTRYPOINT [ "/entrypoint.sh" ] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
terraform-bundle package -os=linux -arch=amd64 /terraform-version.hcl | |
mv *.zip /output/terraform-bundle.zip | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
MYDIR=$(readlink -e $(dirname "$0")) | |
TERRAFORM_VERSION="${TERRAFORM_VERSION:-0.10.4}" | |
docker build -t terraform-bundle --build-arg "TERRAFORM_VERSION=${TERRAFORM_VERSION}" src/deps/terraform | |
docker run -v /tmp:/output --rm -it terraform-bundle "$@" | |
cp /tmp/terraform-bundle.zip "$(dirname "${MYDIR}")" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Configuration used by terraform-bundle to fetch all required plugins ONCE. | |
# | |
# (see https://github.com/hashicorp/terraform/tree/master/tools/terraform-bundle) | |
# (why https://github.com/hashicorp/terraform/issues/15801) | |
# | |
terraform { | |
version = "0.10.4" | |
} | |
providers { | |
aws = ["~> 0.1"] | |
external = ["~> 0.1"] | |
null = ["~> 0.1"] | |
template = ["~> 0.1"] | |
terraform = ["~> 0.1"] | |
tls = ["~> 0.1"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment