Skip to content

Instantly share code, notes, and snippets.

@wilsonkhlam
Created September 24, 2019 16:07
Show Gist options
  • Save wilsonkhlam/64435c465db498d77d64a26e9b41ec0a to your computer and use it in GitHub Desktop.
Save wilsonkhlam/64435c465db498d77d64a26e9b41ec0a to your computer and use it in GitHub Desktop.
Terraform in Docker
# build step to create a Terraform bundle per our included terraform-bundle.hcl
FROM golang:1.13.0-alpine3.10 AS bundler
RUN apk add --no-cache git unzip && \
go get -d -v github.com/hashicorp/terraform && \
git -C ./src/github.com/hashicorp/terraform checkout v0.12.9 && \
go install ./src/github.com/hashicorp/terraform/tools/terraform-bundle
COPY terraform-bundle.hcl .
RUN terraform-bundle package -os=linux -arch=amd64 terraform-bundle.hcl && \
mkdir -p terraform-bundle && \
unzip -d terraform-bundle terraform_*.zip
terraform {
# Version of Terraform to include in the bundle. An exact version number
# is required.
version = "0.12.9"
}
# Define which provider plugins are to be included
providers {
# Include the newest "azure" provider version in the 1.0 series.
azurerm = ["~> 1.0"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment