reviewdog / action-tflint

Run tflint with reviewdog on pull requests to enforce best practices
MIT License
107 stars 22 forks source link

No way to pass flags to `tflint --init` #57

Closed Sebelino closed 1 year ago

Sebelino commented 1 year ago

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/action-tflint@v1.17.0
  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`?
Sebelino commented 1 year ago

I see at least two options:

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?

thaim commented 1 year ago

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.