terraform-linters / tflint

A Pluggable Terraform Linter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for a single run to be converted into different outputs

stevehipwell opened this issue · comments

Introduction

Currently in CI/CD I have to run TFLint 4 times to get my desired outputs and error code, this is very expensive so I;d like to be able to only run the TFLint scanner once and then report on the output. Trivy does this very well with trivy convert and Terraform has similar functionality with terraform show.

Proposal

I'd like TFLint to add a command to read a common format (JSON?) and convert it to an output with error codes as if it was coming directly from a scan.

The following example code assumes there is a new --convert arg and minimum failure severity could be set to none.

tflint --recursive --minimum-failure-severity none --format json > tflint.json
tflint --convert tflint.json --recursive --minimum-failure-severity none --format sarif > tflint.sarif
tflint --convert tflint.json --recursive --disable-rule terraform_required_version --disable-rule terraform_required_providers --minimum-failure-severity error --format compact
tflint --convert tflint.json --only terraform_required_version --only terraform_required_providers --minimum-failure-severity error --format compact

References