terraform-linters / setup-tflint

A GitHub action that installs Terraform linter TFLint
MIT License
149 stars 38 forks source link

Support matchers in a monorepo setup #137

Closed moritzzimmer closed 1 year ago

moritzzimmer commented 1 year ago

We are using tflint for linting a repository with multiple independent (in terms of state) stacks. Our GitHub action loops over all of those stacks (using --force) to gather all findings.

It seems like anntotations are not using the full path of the affected terraform file, so those are not visible in the GitHub UI:

Notice: main.tf:23:26: Notice - "default.mysql5.6" is default parameter group. You cannot edit it. (aws_db_instance_default_parameter_group)
Error: main.tf:16:26: Error - "mysql57" is invalid engine. (aws_db_instance_invalid_engine)

The main.tf file is actually global/cdn/content/main.tf in this example. Would it be possible to configure the problem matcher to support a monorepo structure?

Might be related to https://github.com/terraform-linters/setup-tflint/issues/19

wata727 commented 1 year ago

We plan to add --chdir and --recursive flags in TFLint v0.44. https://github.com/terraform-linters/tflint/pull/1612 https://github.com/terraform-linters/tflint/pull/1622

When using these, the output path will be a relative path from the original working directory.

moritzzimmer commented 1 year ago

Thanks for the quick reply @wata727 , looking forward to v0.44

wata727 commented 1 year ago

v0.44 has been released. https://github.com/terraform-linters/tflint/releases/tag/v0.44.0