Skip to content

Commit

Permalink
TF: build from tag
Browse files Browse the repository at this point in the history
Build TF inside container from the tag specified in the Dockerfile.
This way we can easily fast forward to yet unreleased master/tags,
which contain fixes/new features we need. Once these are released
as proper version, we can change the tag from commit to the version
number. TF uses v0.6.15 scheme.

The tag in this commit is for 0.6.15-dev version. Reflect this in
tests.
  • Loading branch information
mtekel committed Mar 23, 2016
1 parent 6cce7af commit 57cc1a9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 14 additions & 7 deletions terraform/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
FROM alpine:3.3
FROM golang:1.6-alpine

ENV PATH $PATH:/usr/local/bin
ENV TERRAFORM_VER 0.6.13
ENV TERRAFORM_ZIP terraform_${TERRAFORM_VER}_linux_amd64.zip
ENV TERRAFORM_TAG 9cb08cb229a821753bdba8a6fc8c010767dea6c1
ENV BINARY_WHITELIST \
terraform \
terraform-provider-aws \
Expand All @@ -14,8 +13,16 @@ ENV BINARY_WHITELIST \
terraform-provisioner-local-exec \
terraform-provisioner-remote-exec

RUN apk add --update openssl openssh-client ca-certificates && rm -rf /var/cache/apk/*
ENV PACKAGES "openssl openssh-client ca-certificates make bash git"

RUN set -ex \
&& wget https://releases.hashicorp.com/terraform/${TERRAFORM_VER}/${TERRAFORM_ZIP} -O /tmp/${TERRAFORM_ZIP} \
&& unzip /tmp/${TERRAFORM_ZIP} -d /usr/local/bin ${BINARY_WHITELIST} \
&& rm /tmp/${TERRAFORM_ZIP}
&& apk add --update $PACKAGES \
&& mkdir -p /go/src/github.com/hashicorp/ \
&& cd /go/src/github.com/hashicorp/ \
&& git clone https://github.com/hashicorp/terraform.git \
&& cd terraform \
&& git checkout $TERRAFORM_TAG \
&& make dev \
&& for file in $BINARY_WHITELIST ; do mv bin/$file /usr/local/bin ; done \
&& rm -rf /go \
&& rm -rf /var/cache/apk/*
2 changes: 1 addition & 1 deletion terraform/terraform_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
it "has the expected Terraform version" do
expect(
command("terraform version").stdout
).to include("Terraform v0.6.13")
).to include("Terraform v0.6.15-dev")
end

it "installs SSH" do
Expand Down

0 comments on commit 57cc1a9

Please sign in to comment.