action-tflint
action-tflint copied to clipboard
No way to pass flags to `tflint --init`
Use case: I have a repository with a single .tflint.hcl
which contains the terraform
and aws
plugins. I'd like this file to be the single source of truth for how tflint
is configured to run both locally and in CI.
I can almost achieve this by using the flags
argument and passing --config
to tflint
directly:
- uses: reviewdog/[email protected]
with:
tflint_init: true
flags: --config=${{ github.workspace }}/terraform/.tflint.hcl
However, since the value of the flags
argument is never passed to the tflint --init
command, the plugins are never installed, resulting in the following error:
Running tflint with reviewdog 🐶 ...
Failed to initialize plugins; Plugin `terraform` not found. Did you run `tflint --init`?
I see at least two options:
- Use the value of
flags
for both thetflint
command and thetflint --init
command. - Introduce a new parameter,
tflint_init_flags
which can be used to pass values exclusively to thetflint --init
command.
The first option seems simpler to me, but I don't know if there might be a scenario where you'd want to pass different flags to the two commands?
I am also experiencing the same issue. As an alternative solution to those mentioned above, I would like to propose implementing a new parameter tflint_config
.
In addition to tflint
and tflint --init
, tflint --version
also accepts a --config
argument. When --config
is specified in tflint --version
, it displays the version of the enabled plugins. Currently, action-tflint doesn't show the version of the plugins being used.
While the --config
option is common in tflint, I believe it would be valuable to create it as a separate input for action-tflint.