67 lines
1.9 KiB
Ruby
67 lines
1.9 KiB
Ruby
class TerraformDocs < Formula
|
|
desc "Tool to generate documentation from Terraform modules"
|
|
homepage "https://github.com/segmentio/terraform-docs"
|
|
url "https://github.com/segmentio/terraform-docs/archive/v0.4.5.tar.gz"
|
|
sha256 "78b75d3ba2525b272ae93036465bf3a5137bb259d7f7c106d026529492df2e29"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "5b266a379750c6c1bf8c7f73a22837f0f5e36ffbb89736724c9270be941ad626" => :mojave
|
|
sha256 "d5c45f5158c4305be7f558ce277bd8be710a4b92fce50494e9d257a7cb8442a4" => :high_sierra
|
|
sha256 "30a7ca059b696bd3d52f79ee56c0def0d5cdd0f40405b2be9d49efa966864243" => :sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
dir = buildpath/"src/github.com/segmentio/terraform-docs"
|
|
dir.install buildpath.children
|
|
|
|
cd dir do
|
|
system "make", "build-darwin-amd64"
|
|
bin.install "bin/darwin-amd64/terraform-docs"
|
|
prefix.install_metafiles
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"main.tf").write <<~EOS
|
|
/**
|
|
* Module usage:
|
|
*
|
|
* module "foo" {
|
|
* source = "github.com/foo/baz"
|
|
* subnet_ids = "${join(",", subnet.*.id)}"
|
|
* }
|
|
*/
|
|
|
|
variable "subnet_ids" {
|
|
description = "a comma-separated list of subnet IDs"
|
|
}
|
|
|
|
variable "security_group_ids" {
|
|
default = "sg-a, sg-b"
|
|
}
|
|
|
|
variable "amis" {
|
|
default = {
|
|
"us-east-1" = "ami-8f7687e2"
|
|
"us-west-1" = "ami-bb473cdb"
|
|
"us-west-2" = "ami-84b44de4"
|
|
"eu-west-1" = "ami-4e6ffe3d"
|
|
"eu-central-1" = "ami-b0cc23df"
|
|
"ap-northeast-1" = "ami-095dbf68"
|
|
"ap-southeast-1" = "ami-cf03d2ac"
|
|
"ap-southeast-2" = "ami-697a540a"
|
|
}
|
|
}
|
|
|
|
// The VPC ID.
|
|
output "vpc_id" {
|
|
value = "vpc-5c1f55fd"
|
|
}
|
|
EOS
|
|
system "#{bin}/terraform-docs", "json", testpath
|
|
end
|
|
end
|