Skip to content

Commit

Permalink
Add tflint
Browse files Browse the repository at this point in the history
Signed-off-by: Christof Bruyland <christof@cyberox.be>
  • Loading branch information
cyberox authored and alexellis committed Feb 24, 2024
1 parent 61e655e commit 75b1a88
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,7 @@ There are 56 apps that you can install on your cluster.
| [terraform](https://github.com/hashicorp/terraform) | Infrastructure as Code for major cloud providers. |
| [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. |
| [tflint](https://github.com/terraform-linters/tflint) | A Pluggable Terraform Linter. |
| [tfsec](https://github.com/aquasecurity/tfsec) | Security scanner for your Terraform code |
| [tilt](https://github.com/tilt-dev/tilt) | A multi-service dev environment for teams on Kubernetes. |
| [timoni](https://github.com/stefanprodan/timoni) | A package manager for Kubernetes powered by CUE. |
Expand Down
53 changes: 53 additions & 0 deletions pkg/get/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3175,6 +3175,59 @@ func Test_DownloadRekorCli(t *testing.T) {

}

func Test_DownloadTflint(t *testing.T) {
tools := MakeTools()
name := "tflint"
version := "v0.50.1"

tool := getTool(name, tools)

tests := []test{
{
os: "darwin",
arch: arch64bit,
version: version,
url: `https://github.com/terraform-linters/tflint/releases/download/v0.50.1/tflint_darwin_amd64.zip`,
},
{
os: "darwin",
arch: archDarwinARM64,
version: version,
url: `https://github.com/terraform-linters/tflint/releases/download/v0.50.1/tflint_darwin_arm64.zip`,
},
{
os: "linux",
arch: arch64bit,
version: version,
url: `https://github.com/terraform-linters/tflint/releases/download/v0.50.1/tflint_linux_amd64.zip`,
},
{
os: "linux",
arch: archARM64,
version: version,
url: `https://github.com/terraform-linters/tflint/releases/download/v0.50.1/tflint_linux_arm64.zip`,
},
{
os: "ming",
arch: arch64bit,
version: version,
url: `https://github.com/terraform-linters/tflint/releases/download/v0.50.1/tflint_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_DownloadTFSecCli(t *testing.T) {
tools := MakeTools()
name := "tfsec"
Expand Down
29 changes: 29 additions & 0 deletions pkg/get/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -2054,6 +2054,35 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Repo}}
},
)

tools = append(tools,
Tool{
Owner: "terraform-linters",
Repo: "tflint",
Name: "tflint",
Description: "A Pluggable Terraform Linter.",
BinaryTemplate: `
{{ $ext := ".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 -}}
{{.Name}}_{{$osStr}}_{{$archStr}}{{$ext}}`,
},
)

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

0 comments on commit 75b1a88

Please sign in to comment.