Skip to content

Commit 541469a

Browse files
committed
Initial commit
0 parents  commit 541469a

17 files changed

+980
-0
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: weekly

.github/workflows/build.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: "0 0 * * *"
12+
13+
jobs:
14+
test:
15+
name: ${{ matrix.os }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
os: [ubuntu-latest, windows-latest]
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
- name: Set up Go
24+
uses: actions/setup-go@v3
25+
with:
26+
go-version: 1.18
27+
- name: Run tests
28+
run: make test
29+
- name: Run build
30+
run: make build

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- '!*'
7+
tags:
8+
- v*.*.*
9+
10+
jobs:
11+
goreleaser:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Set up Go
17+
uses: actions/setup-go@v3
18+
with:
19+
go-version: 1.18
20+
- name: Import GPG key
21+
id: import_gpg
22+
uses: crazy-max/ghaction-import-gpg@v5
23+
with:
24+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
25+
passphrase: ${{ secrets.PASSPHRASE }}
26+
- name: Run GoReleaser
27+
uses: goreleaser/goreleaser-action@v3
28+
with:
29+
version: latest
30+
args: release --rm-dist
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.goreleaser.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This is an example goreleaser.yaml file with some sane defaults.
2+
# Make sure to check the documentation at http://goreleaser.com
3+
env:
4+
- CGO_ENABLED=0
5+
builds:
6+
- targets:
7+
- darwin_amd64
8+
- darwin_arm64
9+
- linux_386
10+
- linux_amd64
11+
- linux_arm
12+
- linux_arm64
13+
- windows_386
14+
- windows_amd64
15+
archives:
16+
- id: zip
17+
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
18+
format: zip
19+
files:
20+
- none*
21+
checksum:
22+
name_template: 'checksums.txt'
23+
signs:
24+
- artifacts: checksum
25+
args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
default: build
2+
3+
test:
4+
go test ./...
5+
6+
build:
7+
go build
8+
9+
install: build
10+
mkdir -p ~/.tflint.d/plugins
11+
mv ./tflint-ruleset-template ~/.tflint.d/plugins

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# TFLint Ruleset Template
2+
[![Build Status](https://github.com/terraform-linters/tflint-ruleset-template/workflows/build/badge.svg?branch=main)](https://github.com/terraform-linters/tflint-ruleset-template/actions)
3+
4+
This is a template repository for building a custom ruleset. You can create a plugin repository from "Use this template". See also [Writing Plugins](https://github.com/terraform-linters/tflint/blob/master/docs/developer-guide/plugins.md).
5+
6+
## Requirements
7+
8+
- TFLint v0.35+
9+
- Go v1.18
10+
11+
## Installation
12+
13+
You can install the plugin with `tflint --init`. Declare a config in `.tflint.hcl` as follows:
14+
15+
```hcl
16+
plugin "template" {
17+
enabled = true
18+
19+
version = "0.1.0"
20+
source = "github.com/terraform-linters/tflint-ruleset-template"
21+
22+
signing_key = <<-KEY
23+
-----BEGIN PGP PUBLIC KEY BLOCK-----
24+
mQINBGCqS2YBEADJ7gHktSV5NgUe08hD/uWWPwY07d5WZ1+F9I9SoiK/mtcNGz4P
25+
JLrYAIUTMBvrxk3I+kuwhp7MCk7CD/tRVkPRIklONgtKsp8jCke7FB3PuFlP/ptL
26+
SlbaXx53FCZSOzCJo9puZajVWydoGfnZi5apddd11Zw1FuJma3YElHZ1A1D2YvrF
27+
...
28+
KEY
29+
}
30+
```
31+
32+
## Rules
33+
34+
|Name|Description|Severity|Enabled|Link|
35+
| --- | --- | --- | --- | --- |
36+
|aws_instance_example_type|Example rule for accessing and evaluating top-level attributes|ERROR|||
37+
|aws_s3_bucket_example_lifecycle_rule|Example rule for accessing top-level/nested blocks and attributes under the blocks|ERROR|||
38+
|google_compute_ssl_policy|Example rule with a custom rule config|WARNING|||
39+
|terraform_backend_type|Example rule for accessing other than resources|ERROR|||
40+
41+
## Building the plugin
42+
43+
Clone the repository locally and run the following command:
44+
45+
```
46+
$ make
47+
```
48+
49+
You can easily install the built plugin with the following:
50+
51+
```
52+
$ make install
53+
```

go.mod

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module github.com/terraform-linters/tflint-ruleset-template
2+
3+
go 1.18
4+
5+
require (
6+
github.com/hashicorp/hcl/v2 v2.13.0
7+
github.com/terraform-linters/tflint-plugin-sdk v0.11.0
8+
)
9+
10+
require (
11+
github.com/agext/levenshtein v1.2.1 // indirect
12+
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
13+
github.com/fatih/color v1.7.0 // indirect
14+
github.com/golang/protobuf v1.5.2 // indirect
15+
github.com/google/go-cmp v0.5.8 // indirect
16+
github.com/hashicorp/go-hclog v1.2.0 // indirect
17+
github.com/hashicorp/go-plugin v1.4.3 // indirect
18+
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect
19+
github.com/mattn/go-colorable v0.1.4 // indirect
20+
github.com/mattn/go-isatty v0.0.10 // indirect
21+
github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77 // indirect
22+
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
23+
github.com/oklog/run v1.0.0 // indirect
24+
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
25+
github.com/vmihailenco/tagparser v0.1.1 // indirect
26+
github.com/zclconf/go-cty v1.10.0 // indirect
27+
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
28+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
29+
golang.org/x/text v0.3.6 // indirect
30+
google.golang.org/appengine v1.6.5 // indirect
31+
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
32+
google.golang.org/grpc v1.46.0 // indirect
33+
google.golang.org/protobuf v1.28.0 // indirect
34+
)

0 commit comments

Comments
 (0)