Skip to content

Commit

Permalink
feat: Add tftools
Browse files Browse the repository at this point in the history
  • Loading branch information
qbart committed Apr 26, 2024
1 parent 3c2854f commit 86708a8
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Generate terraform docs
name: Terraform Docs
on:
- pull_request

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ jobs:
runs-on: ubuntu-latest

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

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

- uses: terraform-linters/setup-tflint@v3
- uses: terraform-linters/setup-tflint@v4
name: Setup TFLint
with:
tflint_version: v0.45.0
tflint_version: v0.50.3
tflint_wrapper: true

- name: Show version
run: tflint --version
Expand All @@ -32,7 +33,11 @@ jobs:

- name: Run TFLint
run: |
tflint -f compact .
tflint -f compact modules/cloudfront-app
tflint -f compact modules/cloudfront-deployment-policy
tflint -f compact modules/cloudfront-s3-origin-bucket-policy
tflint -f compact --chdir .
tflint -f compact --chdir modules/cloudfront-app
tflint -f compact --chdir modules/cloudfront-deployment-policy
tflint -f compact --chdir modules/cloudfront-s3-origin-bucket-policy
- run: echo ${{ steps.tflint.outputs.stdout }}
- run: echo ${{ steps.tflint.outputs.stderr }}
- run: echo ${{ steps.tflint.outputs.exitcode }}
15 changes: 15 additions & 0 deletions .github/workflows/tfsec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Terraform Security Check
on:
pull_request:
jobs:
tfsec:
name: tfsec
runs-on: ubuntu-latest

steps:
- name: Clone repo
uses: actions/checkout@master
- name: tfsec
uses: aquasecurity/[email protected]
with:
soft_fail: true
4 changes: 2 additions & 2 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugin "terraform" {
enabled = true
version = "0.2.2"
version = "0.6.0"
source = "github.com/terraform-linters/tflint-ruleset-terraform"
}

plugin "aws" {
enabled = true
version = "0.21.2"
version = "0.30.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}
5 changes: 5 additions & 0 deletions examples/cloudfront-app/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ terraform {
source = "hashicorp/aws"
version = "~> 5.0"
}

random = {
source = "hashicorp/random"
version = "~> 3.0"
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions modules/cloudfront-app/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ terraform {
source = "hashicorp/aws"
version = "~> 5.0"
}

random = {
source = "hashicorp/random"
version = "~> 3.0"
}
}
}

5 changes: 5 additions & 0 deletions modules/cloudfront-deployment-policy/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ terraform {
source = "hashicorp/aws"
version = "~> 5.0"
}

random = {
source = "hashicorp/random"
version = "~> 3.0"
}
}
}

5 changes: 5 additions & 0 deletions modules/cloudfront-s3-origin-bucket-policy/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ terraform {
source = "hashicorp/aws"
version = "~> 5.0"
}

random = {
source = "hashicorp/random"
version = "~> 3.0"
}
}
}

0 comments on commit 86708a8

Please sign in to comment.