Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Sebelino opened this issue Sep 26, 2022 · 2 comments · Fixed by #68
Closed

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

Sebelino opened this issue Sep 26, 2022 · 2 comments · Fixed by #68

Comments

@Sebelino
Copy link

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
Copy link
Author

I see at least two options:

  • Use the value of flags for both the tflint command and the tflint --init command.
  • Introduce a new parameter, tflint_init_flags which can be used to pass values exclusively to the tflint --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?

@thaim
Copy link
Contributor

thaim commented Mar 8, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants