Skip to content

Commit

Permalink
chore: Added tflint to Pipeline (#69)
Browse files Browse the repository at this point in the history
* removed unused files

* fixed effect value in IAM policy doc statements and added terraform provider lockfile

* chore: Add `tflint` to Pipeline (#68)

* fix: AWS IAM Policy Document (#66)

* removed unused files

* fixed effect value in IAM policy doc statements and added terraform provider lockfile

* tflint config

* running cd before tflint --init to pickup custom config

* removed color option

* removed tflint wrapper

* added required_version to tf config
  • Loading branch information
fullerzz authored Sep 21, 2024
1 parent 43c2208 commit eb9c3e9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/tf-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: IAC Checks - tflint
on:
push:
branches: [ master, dev ]
pull_request:

jobs:
tflint:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v4
name: Checkout source code

- uses: actions/cache@v4
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }}

- uses: terraform-linters/setup-tflint@v4
name: Setup TFLint
with:
tflint_version: v0.52.0

- name: Show version
run: tflint --version

- name: Init TFLint
run: cd terraform && tflint --init
env:
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
GITHUB_TOKEN: ${{ github.token }}

- name: Run tflint
run: tflint -f compact --recursive --chdir=terraform
10 changes: 10 additions & 0 deletions terraform/.tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
plugin "terraform" {
enabled = true
preset = "recommended"
}

plugin "aws" {
enabled = true
version = "0.33.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}
1 change: 1 addition & 0 deletions terraform/providers.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
terraform {
required_version = ">= 1.5"
required_providers {
aws = {
source = "hashicorp/aws"
Expand Down

0 comments on commit eb9c3e9

Please sign in to comment.