Skip to content

tflint doesn't include the full path to warnings. #511

@lexton

Description

@lexton

Describe the bug

When running pre-commit the errors are always bubbled up using relative paths:

TFLint in <my_relative_path>:
1 issue(s) found:

variables.tf:6:1: Warning - variable "unused" is declared but not used (terraform_unused_declarations)

We want the errors to provide the full path.

TFLint in <my_relative_path>:
1 issue(s) found:

<my_relative_path>/variables.tf:6:1: Warning - variable "unused" is declared but not used (terraform_unused_declarations)

This makes it hard for editors + CI checks to ensure that the errors are passed to the full path to make it easier to debug.

How can we reproduce it?

Create a TFlint warning error in a nested module.

Environment information

OS: MacOS
Darwin  22.4.0 Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64
  • Tools availability and versions:
pre-commit 3.1.1
Terraform v1.2.0
Python 3.11.2+
Python 3.11.2+
checkov 2.3.90
terraform-docs version v0.16.0 darwin/arm64
terragrunt version v0.36.7-3-gc1a70b07ac3d
terrascan terrascan SKIPPED
TFLint version 0.44.1
+ ruleset.aws (0.17.1)
+ ruleset.terraform (0.1.1)
tfsec v1.28.1
tfupdate tfupdate SKIPPED
hcledit hcledit SKIPPED
  • .pre-commit-config.yaml:
file content
- repo: https://github.com/antonbabenko/pre-commit-terraform
    rev: v1.75.0
    hooks:
      - id: terraform_tflint
        alias: tflint_init
        name: run tflint --init
        stages: [commit]
        args:
          - --args=--init
          - --args=--no-color
      - id: terraform_tflint
        alias: tflint_init
        name: run tflint --init
        stages: [commit]
        args:
          - --args=--init
          - --args=--no-color
      - id: terraform_tflint
        stages: [commit]
        args:
          - --args=-f compact

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions