Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Gaardsholt
33 changes: 33 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
categories:
- title: Breaking Changes 💥
labels:
- breaking-change
- title: New Features 🎉
labels:
- feature
- title: Bug Fixes 🐛
labels:
- bug-fix
- title: Other Changes 🛠
- title: Dependencies 📌
labels:
- dependencies
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- "major"
minor:
labels:
- "minor"
patch:
labels:
- "patch"
default: patch
template: |
$CHANGES

**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
32 changes: 32 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]
# pull_request_target event is required for autolabeler to support PRs from forks
# pull_request_target:
# types: [opened, reopened, synchronize]

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# (Optional) GitHub Enterprise requires GHE_HOST variable set
#- name: Set GHE_HOST
# run: |
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV

# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v6
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50 changes: 25 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: release
on:
push:
branches:
- '!*'
- "!*"
tags:
- v*.*.*
- v*.*.*

permissions:
contents: write
Expand All @@ -16,26 +16,26 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- uses: actions/attest-build-provenance@v1
with:
subject-path: 'dist/checksums.txt'
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- uses: actions/attest-build-provenance@v1
with:
subject-path: "dist/checksums.txt"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# don't track built binary
/tflint-ruleset-template
/tflint-ruleset-trailing-comma
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ build:

install: build
mkdir -p ~/.tflint.d/plugins
mv ./tflint-ruleset-template ~/.tflint.d/plugins
mv ./tflint-ruleset-trailing-comma ~/.tflint.d/plugins
71 changes: 52 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,81 @@ plugin "template" {
enabled = true

version = "0.1.0"
source = "github.com/terraform-linters/tflint-ruleset-template"
source = "github.com/Gaardsholt/tflint-ruleset-trailing-comma"

signing_key = <<-KEY
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGCqS2YBEADJ7gHktSV5NgUe08hD/uWWPwY07d5WZ1+F9I9SoiK/mtcNGz4P
JLrYAIUTMBvrxk3I+kuwhp7MCk7CD/tRVkPRIklONgtKsp8jCke7FB3PuFlP/ptL
SlbaXx53FCZSOzCJo9puZajVWydoGfnZi5apddd11Zw1FuJma3YElHZ1A1D2YvrF
...

mQGNBGcKjvABDADOtyLeAVdP/bjqdvukjvOqdQ0q/l1vyWTtilb9haLUFcBAos1Q
knjyq4Q0XWcs8HdB9lnd7mvd37Tut5D2t4RMlKWbANGgU286WaLdf9P0a62yN1ID
TdobfcWoJrQgrx5Wx24r4WPOCPjVoW4bYX4zO588WDTXu+OLtJ1d6vNgdtEx6ck+
oL6eg5nBqya8s3xHbQx0aXWwUHFDTAlHG5UfBoOM2t9ROhdDIF6aCby68piuXBOV
L4vXmbbfR2vdMZvq7/zFCtER1kpM76To4mElsi9QzmFiRGcPk4DyGUOyrfux9cI/
IpTbZJMNXjS/lq7l6OU5Mnpijk7vUyewM9o0RKO1KCN0JHzjTX/2AZHhuL6l/6+m
nj/m3LADZFKck+rd7cQSZPCEHapen+wy6MEbsFChbnSZSDJrDupOfpI8xAE1ndxI
jhSg9a+qOTKaRvJXbVNwFq2SEHkKfbuH5DwSshg4YG3A+SDQ7mI5fZAyTsMVBqBO
o5GYqlb0b8cMjK8AEQEAAbQtTGFzc2UgR2FhcmRzaG9sdCA8bGFzc2UuZ2FhcmRz
aG9sdEBnbWFpbC5jb20+i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k8EfsE0V7lfV35+l+M9fyKQDLXPa59cyYVSbd8vX38PTsGk+CoNSslbaFC
l4mrJKD1Lj29xSTQyWkAEQEAAYkBtgQYAQgAIBYhBMi6Rjn2hiSppAlzTrIEpArH
Z8DsBQJnCo7wAhsMAAoJELIEpArHZ8Ds2HoL/iU0FeYPjB3N8JngXLyklc5ZuDC7
fGLTEqHO31bGhB7Bs+7xojgwrK+zvswGJU+ByoLUHP++SVal1lZ8OwbygM46NGjj
F5OKVJ2MYt8GGwPeSrxhrAokxH7sAleENCy+IuwoD8e6pFr53o9KXCNGIOp65SM6
/RuBo+Tt/P8lz4TibSMCsP+zo1q0yhHo2kOvDVqnFGQGbiRI6PCdotMT0c9bkHxa
JGG2fNbiriIf6cCV25G7Ajf8OCYhiQGhDyZYpeozfHZJORFxd1z+VsdW4RX2zVIw
B4OT9Sg2ujkrdgnHgCAa36PS9jDel+z04DqL5gVYPjXpR2vdLQORZgJwtP8XY0g/
NRZWg5k99kHCLBDg7kLjDJpx7UHE7+Q98Fxi/5HDYrBQ+dHcDiHpIZuiIaUAG45v
csie3rKvoDiXBOccjXrxJNbhqN6RTuqBts+atNgz7Mn4j6YGCIoF03gfsxGc51ZB
haUXwAPe9pvS8sCURInYGfMFlThmvN5ZuYkJ3g==
=U3wP
-----END PGP PUBLIC KEY BLOCK-----
KEY
}
```

## Rules

|Name|Description|Severity|Enabled|Link|
| --- | --- | --- | --- | --- |
|aws_instance_example_type|Example rule for accessing and evaluating top-level attributes|ERROR|✔||
|aws_s3_bucket_example_lifecycle_rule|Example rule for accessing top-level/nested blocks and attributes under the blocks|ERROR|✔||
|google_compute_ssl_policy|Example rule with a custom rule config|WARNING|✔||
|terraform_backend_type|Example rule for accessing other than resources|ERROR|✔||
| Name | Description | Severity | Enabled | Link |
| ------------------------------ | ------------------------------------------------------ | -------- | ------- | ---- |
| terraform_lists_trailing_comma | Will check if last item in a list has a trailing comma | ERROR | ✔ | |

## Building the plugin

Clone the repository locally and run the following command:

```
$ make
```shell
make
```

You can easily install the built plugin with the following:

```
$ make install
```shell
make install
```

You can run the built plugin like the following:

```
$ cat << EOS > .tflint.hcl
plugin "template" {
```shell
cat << EOS > .tflint.hcl
plugin "trailing-comma" {
enabled = true
}
EOS
$ tflint
tflint
```
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/terraform-linters/tflint-ruleset-template
module github.com/Gaardsholt/tflint-ruleset-trailing-comma

go 1.22.2
go 1.23.0

require (
github.com/hashicorp/hcl/v2 v2.22.0
Expand Down
9 changes: 3 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
package main

import (
"github.com/Gaardsholt/tflint-ruleset-trailing-comma/rules"
"github.com/terraform-linters/tflint-plugin-sdk/plugin"
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
"github.com/terraform-linters/tflint-ruleset-template/rules"
)

func main() {
plugin.Serve(&plugin.ServeOpts{
RuleSet: &tflint.BuiltinRuleSet{
Name: "template",
Name: "trailing-comma",
Version: "0.1.0",
Rules: []tflint.Rule{
rules.NewAwsInstanceExampleTypeRule(),
rules.NewAwsS3BucketExampleLifecycleRule(),
rules.NewGoogleComputeSSLPolicyRule(),
rules.NewTerraformBackendTypeRule(),
rules.NewTerraformListsTrailingCommaRule(),
},
},
})
Expand Down
75 changes: 0 additions & 75 deletions rules/aws_instance_example_type.go

This file was deleted.

Loading
Loading