Skip to content

Commit bd76bcc

Browse files
authored
chore: migrated to trivy and bumped tflint rules (#137)
1 parent 95a3149 commit bd76bcc

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

.github/workflows/static-analysis.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
terraform: [ ~1.3 ]
20+
terraform: [ 1.5.6, ~ 1.8 ]
2121
steps:
2222
- uses: actions/checkout@v4
2323

@@ -31,7 +31,7 @@ jobs:
3131
runs-on: ubuntu-latest
3232
strategy:
3333
matrix:
34-
terraform: [ ~1.3 ]
34+
terraform: [ 1.5.6, ~ 1.8 ]
3535
steps:
3636
- uses: actions/checkout@v4
3737

@@ -45,7 +45,7 @@ jobs:
4545
runs-on: ubuntu-latest
4646
strategy:
4747
matrix:
48-
terraform: [ ~1.3 ]
48+
terraform: [ 1.5.6, ~ 1.8 ]
4949
steps:
5050
- uses: actions/checkout@v4
5151

@@ -68,7 +68,7 @@ jobs:
6868
runs-on: ubuntu-latest
6969
strategy:
7070
matrix:
71-
terraform: [ ~1.3 ]
71+
terraform: [ 1.5.6, ~ 1.8 ]
7272
steps:
7373
- uses: actions/checkout@v4
7474

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.88.4
3+
rev: v1.90.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate
@@ -15,7 +15,7 @@ repos:
1515
args:
1616
- '--args=--lockfile=false'
1717
- repo: https://github.com/pre-commit/pre-commit-hooks
18-
rev: v4.5.0
18+
rev: v4.6.0
1919
hooks:
2020
- id: check-merge-conflict
2121
- id: trailing-whitespace

.tflint.hcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
config {
2-
module = true
2+
call_module_type = "all"
33
}
44

55
plugin "aws" {
66
enabled = true
7-
version = "0.27.0"
7+
version = "0.31.0"
88
source = "github.com/terraform-linters/tflint-ruleset-aws"
99
}
1010

Makefile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ NEXT_TAG := v$(NEXT_VERSION)
2424
STACKS = $(shell find . -not -path "*/\.*" -iname "*.tf" | sed -E "s|/[^/]+$$||" | sort --unique)
2525
ROOT_DIR := $(shell pwd)
2626

27-
all: fmt validate tflint tfsec
27+
all: fmt validate tflint trivy
2828

2929
.PHONY: fmt
3030
fmt: ## Rewrites Terraform files to canonical format
@@ -50,14 +50,9 @@ tflint: ## Runs tflint on all Terraform files
5050
tflint -chdir=$$s -f compact --config $(ROOT_DIR)/.tflint.hcl || exit 1; \
5151
done;
5252

53-
.PHONY: tfsec
54-
tfsec: ## Runs tfsec on all Terraform files
53+
trivy: ## Runs trivy on all Terraform files
5554
@echo "+ $@"
56-
@for s in $(STACKS); do \
57-
echo "tfsec $$s"; \
58-
terraform -chdir=$$s init -backend=false > /dev/null; \
59-
tfsec --custom-check-dir $$s --concise-output --minimum-severity HIGH --exclude aws-s3-encryption-customer-key,aws-sns-topic-encryption-use-cmk,aws-sqs-queue-encryption-use-cmk || exit 1; \
60-
done;
55+
@trivy config --exit-code 1 --severity HIGH --tf-exclude-downloaded-modules .
6156

6257
.PHONY: providers
6358
providers: ## Upgrades all providers and platform independent dependency locks (slow)

0 commit comments

Comments
 (0)