Skip to content

Commit

Permalink
Add OpenTofu
Browse files Browse the repository at this point in the history
Signed-off-by: Rémy Garrigue <[email protected]>
  • Loading branch information
rgarrigue authored and alexellis committed Mar 15, 2024
1 parent bbcae81 commit acb1bd9
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@ There are 56 apps that you can install on your cluster.
| [task](https://github.com/go-task/task) | A simple task runner and build tool |
| [tctl](https://github.com/temporalio/tctl) | Temporal CLI. |
| [terraform](https://github.com/hashicorp/terraform) | Infrastructure as Code for major cloud providers. |
| [opentofu](https://github.com/opentofu/opentofu) | OpenTofu lets you declaratively manage your cloud infrastructure. |
| [terraform-docs](https://github.com/terraform-docs/terraform-docs) | Generate documentation from Terraform modules in various output formats. |
| [terragrunt](https://github.com/gruntwork-io/terragrunt) | Terragrunt is a thin wrapper for Terraform that provides extra tools for working with multiple Terraform modules |
| [terrascan](https://github.com/tenable/terrascan) | Detect compliance and security violations across Infrastructure as Code. |
Expand Down
54 changes: 54 additions & 0 deletions pkg/get/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4278,6 +4278,60 @@ func Test_DownloadTerraformDocs(t *testing.T) {
}
}

func Test_DownloadOpentofu(t *testing.T) {
tools := MakeTools()
name := "tofu"
version := "v1.6.2"

tool := getTool(name, tools)

tests := []test{
{
os: "darwin",
arch: arch64bit,
version: version,
url: `https://github.com/opentofu/opentofu/releases/download/v1.6.2/tofu_1.6.2_darwin_amd64.zip`,
},
{
os: "darwin",
arch: archDarwinARM64,
version: version,
url: `https://github.com/opentofu/opentofu/releases/download/v1.6.2/tofu_1.6.2_darwin_arm64.zip`,
},
{
os: "linux",
arch: arch64bit,
version: version,
url: `https://github.com/opentofu/opentofu/releases/download/v1.6.2/tofu_1.6.2_linux_amd64.zip`,
},
{
os: "linux",
arch: archARM64,
version: version,
url: `https://github.com/opentofu/opentofu/releases/download/v1.6.2/tofu_1.6.2_linux_arm64.zip`,
},
{
os: "ming",
arch: arch64bit,
version: version,
url: `https://github.com/opentofu/opentofu/releases/download/v1.6.2/tofu_1.6.2_windows_amd64.zip`,
},
}

for _, tc := range tests {
t.Run(tc.os+" "+tc.arch+" "+tc.version, func(r *testing.T) {

got, err := tool.GetURL(tc.os, tc.arch, tc.version, false)
if err != nil {
t.Fatal(err)
}
if got != tc.url {
t.Errorf("want: %s, got: %s", tc.url, got)
}
})
}
}

func Test_DownloadTerragrunt(t *testing.T) {
tools := MakeTools()
name := "terragrunt"
Expand Down
29 changes: 29 additions & 0 deletions pkg/get/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,35 @@ https://github.com/inlets/inletsctl/releases/download/{{.Version}}/{{$fileName}}
{{.Version}}/{{.Name}}_{{$osStr}}_{{$archStr}}{{$extStr}}`,
})

tools = append(tools,
Tool{
Owner: "opentofu",
Repo: "opentofu",
Name: "tofu",
Version: "v1.6.2",
Description: "OpenTofu lets you declaratively manage your cloud infrastructure",
BinaryTemplate: `
{{$extStr := ".zip"}}
{{$osStr := ""}}
{{ if HasPrefix .OS "ming" -}}
{{$osStr = "windows"}}
{{- else if eq .OS "linux" -}}
{{$osStr = "linux"}}
{{- else if eq .OS "darwin" -}}
{{$osStr = "darwin"}}
{{- end -}}
{{$archStr := .Arch}}
{{- if eq .Arch "x86_64" -}}
{{$archStr = "amd64"}}
{{- else if eq .Arch "aarch64" -}}
{{$archStr = "arm64"}}
{{- end -}}
{{.Version}}/{{.Name}}_{{.VersionNumber}}_{{$osStr}}_{{$archStr}}{{$extStr}}`,
})

tools = append(tools,
Tool{
Owner: "hashicorp",
Expand Down

0 comments on commit acb1bd9

Please sign in to comment.