Closed cmellongoempyrean closed 2 years ago
Can you share debug logs?
https://github.com/terraform-linters/tflint/blob/master/README.md
Separately, the scope of a Terraform module is a directory. Passing individual files may lead to unexpected errors. Syntax rules like comment_syntax
are fine but anything structural, eg required_providers
is likely to break when not called against a complete module.
The ability to pass files instead of modules is likely to be removed in a future release with a move to a -chdir
option to match Terraform.
There's some info in the debug logs that I would rather not paste so I created a minimal repo at this gist instead: https://gist.github.com/cmellongoempyrean/add2e9d93bc9cf050eebc543bed16e6d
Understood about the individual file vs the module concept. I noticed this because the leading dot syntax is how paths get tab completed in powershell on Windows, and I was experimenting with only linting files that had changed in pull requests. I will need to change my methodology to be more sophisticated, running it on modules that contain changed files instead.
This seems to be a bug about file path normalization. If you pass a file path, TFLint will only report issues that match the passed file path from the inspection results for that directory. https://github.com/terraform-linters/tflint/blob/v0.37.0/tflint/runner.go#L408-L423
This issue occurs here because .\org.tf
and org.tf
cannot be identified as the same file. This can be reproduced on Linux.
When run on this directory, tflint correctly identifies issues in an individual file:
When run on a single file, however, it only identifies issues when the path does not have a leading dot:
Version