1 class TerraformDocs < Formula
2 desc "Tool to generate documentation from Terraform modules"
3 homepage "https://github.com/terraform-docs/terraform-docs"
4 url "https://github.com/terraform-docs/terraform-docs/archive/refs/tags/v0.19.0.tar.gz"
5 sha256 "9341dadb3d45ab8e050d7209c5bd11090e0225b6fc4ea3383d767f08f7e86c6f"
9 sha256 cellar: :any_skip_relocation, arm64_sequoia: "c68bd7728ee70a52963bb4739ef5450c76f52b248349e0d6d368da9fdb8695d3"
10 sha256 cellar: :any_skip_relocation, arm64_sonoma: "bc91941af9163d757e1fa24f035ccfb06ac07da89c4b5aed4e1d520401c5b757"
11 sha256 cellar: :any_skip_relocation, arm64_ventura: "a62a06cb1d58ab43a03859af043a3a41fb2f4c4b8b230315903ef8643387166c"
12 sha256 cellar: :any_skip_relocation, sonoma: "c209d4e5d9ddb7ab31a472d3c4701942332242d29c2c3e30a1e6e0818983d802"
13 sha256 cellar: :any_skip_relocation, ventura: "9e4d6fb02987fe57a6972fcc81659b6a16f6b5418f406c848a14ee8d77e3c6c9"
14 sha256 cellar: :any_skip_relocation, x86_64_linux: "73916d978b414105ca9a9d3d264e064b91e90cd43180a6f391372275fa19d563"
17 depends_on "go" => :build
20 system "make", "build"
21 cpu = Hardware::CPU.intel? ? "amd64" : Hardware::CPU.arch.to_s
22 os = OS.kernel_name.downcase
24 bin.install "bin/#{os}-#{cpu}/terraform-docs"
26 generate_completions_from_executable(bin/"terraform-docs", "completion", shells: [:bash, :zsh])
30 (testpath/"main.tf").write <<~HCL
35 * source = "github.com/foo/baz"
36 * subnet_ids = "${join(",", subnet.*.id)}"
40 variable "subnet_ids" {
41 description = "a comma-separated list of subnet IDs"
44 variable "security_group_ids" {
45 default = "sg-a, sg-b"
50 "us-east-1" = "ami-8f7687e2"
51 "us-west-1" = "ami-bb473cdb"
52 "us-west-2" = "ami-84b44de4"
53 "eu-west-1" = "ami-4e6ffe3d"
54 "eu-central-1" = "ami-b0cc23df"
55 "ap-northeast-1" = "ami-095dbf68"
56 "ap-southeast-1" = "ami-cf03d2ac"
57 "ap-southeast-2" = "ami-697a540a"
63 value = "vpc-5c1f55fd"
66 system bin/"terraform-docs", "json", testpath