terraform 0.11

- Also add alias for current version, terraform@0.12

Closes #40217.

Signed-off-by: Izaak Beekman <zbeekman@gmail.com>
This commit is contained in:
Jörg Eichhorn 2019-05-23 15:56:16 +02:00 committed by Izaak Beekman
parent d509969591
commit b7d709d18a
No known key found for this signature in database
GPG key ID: A93CE70D8021BD0F
2 changed files with 66 additions and 0 deletions

1
Aliases/terraform@0.12 Symbolic link
View file

@ -0,0 +1 @@
../Formula/terraform.rb

65
Formula/terraform@0.11.rb Normal file
View file

@ -0,0 +1,65 @@
class TerraformAT011 < Formula
desc "Tool to build, change, and version infrastructure"
homepage "https://www.terraform.io/"
url "https://github.com/hashicorp/terraform/archive/v0.11.14.tar.gz"
sha256 "50b75c94c4d3bfe44cfc12c740126747b6b34c014602777154356caa85a783f4"
keg_only :versioned_formula
depends_on "go" => :build
depends_on "gox" => :build
def install
ENV["GOPATH"] = buildpath
ENV.prepend_create_path "PATH", buildpath/"bin"
dir = buildpath/"src/github.com/hashicorp/terraform"
dir.install buildpath.children - [buildpath/".brew_home"]
cd dir do
# v0.6.12 - source contains tests which fail if these environment variables are set locally.
ENV.delete "AWS_ACCESS_KEY"
ENV.delete "AWS_SECRET_KEY"
ENV["XC_OS"] = "darwin"
ENV["XC_ARCH"] = "amd64"
system "make", "tools", "test", "bin"
bin.install "pkg/darwin_amd64/terraform"
prefix.install_metafiles
end
end
test do
minimal = testpath/"minimal.tf"
minimal.write <<~EOS
variable "aws_region" {
default = "us-west-2"
}
variable "aws_amis" {
default = {
eu-west-1 = "ami-b1cf19c6"
us-east-1 = "ami-de7ab6b6"
us-west-1 = "ami-3f75767a"
us-west-2 = "ami-21f78e11"
}
}
# Specify the provider and access details
provider "aws" {
access_key = "this_is_a_fake_access"
secret_key = "this_is_a_fake_secret"
region = "${var.aws_region}"
}
resource "aws_instance" "web" {
instance_type = "m1.small"
ami = "${lookup(var.aws_amis, var.aws_region)}"
count = 4
}
EOS
system "#{bin}/terraform", "init"
system "#{bin}/terraform", "graph"
end
end