super-linter: tflint failing in slim-v4.9.3 "Plugin `aws` not found in /github/home/.tflint.d/plugins"
Describe the bug
We’re running super-linter on our codebase that is largely made up of terraform files. it has just failed with error:
2022-05-24 20:26:03 [INFO] File:[/github/workspace/repo/path/to/file.tf]
2022-05-24 20:26:03 [ERROR] Found errors in [tflint] linter!
2022-05-24 20:26:03 [ERROR] Error code: 1. Command output:
------
Failed to initialize plugins; Plugin `aws` not found in /github/home/.tflint.d/plugins
Note that we don’t use AWS, we don’t use any AWS terraform providers.
I note that this is running on v4.9.3:
Status: Downloaded newer image for ghcr.io/github/super-linter:slim-v4.9.3
I have compared to a successful run of the super-linter 6 horus ago which also used tflint to lint some terraform code, it is using an earlier version of the super-linter:
Status: Image is up to date for ghcr.io/github/super-linter:slim-v4.9.2
Expected behavior
This error should not occur. We haven’t done anything to cause it and it does look as though its been caused by the bump to v4.9.3.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 11
- Comments: 25 (10 by maintainers)
As an aside (whilst waiting for the fix to be released) I’ve also found that setting
plugin_dir = "/root/.tflint.d/plugins"in a custom.tflint.hclfile also resolves this issue, for example:Having this file also allows you to enable other rules for this linter, as very few are actually enabled by default.
@admiralAwkbar @ferrarimarco I think I found the solution, to take with a grain of salt given I am neither very familiar with
super-linterinternals nortflint. SettingTFLINT_PLUGIN_DIRto/root/.tflint.d/pluginsdoes the trick.Observations:
tflint --initseems to be used to download plugins, given aws is manually installed bytflint-bundle, I dont think it plays a role hereHOMEis set to/github/homeso tflint look for plugins in/github/home/.tflint.d/pluginsinstead of/root/.tflint.d/pluginswhere they actually are.Now the question is whether we should set
TFLINT_PLUGIN_DIRto/root/.tflint.d/pluginsor to something else and move the directory there (for example/usr/lib/.tflint.d/plugins)