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

.tflint.hcl missing error with module and recursive mode since 0.50.0 bugfix #1952

Closed
1 of 3 tasks
tommyallieri opened this issue Jan 4, 2024 · 2 comments
Closed
1 of 3 tasks
Labels

Comments

@tommyallieri
Copy link

Summary

since the introduction of #1940, which throws an error if .tflint.hcl is missing, it is now expecting a .tflint.hcl file in every sub-directory when using the following

tflint --config .tflint.hcl --module --recursive
Failed to load TFLint config; failed to load file: open .tflint.hcl: no such file or directory working_dir=modules

I tried adding to the modules directory, but it then errors out on the next one underneath

.tflint.hcl files shouldn't be recursively set in every sub-directory, it's not scalable. either bugfix should be removed and warn instead, or configuration should be inherited from the top, unless there's a flag I'm not seeing which would resolve this bug

Command

tflint --config .tflint.hcl --module --recursive

Terraform Configuration

N/A

TFLint Configuration

plugin "terraform" {
  enabled = true
  preset  = "recommended"
}

plugin "aws" {
  enabled = true
  version = "0.27.0"
  source  = "github.com/terraform-linters/tflint-ruleset-aws"
}

Output

[...]
09:45:39 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
09:45:39 [DEBUG] go-plugin@v1.6.0/grpc_stdio.go:142: stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
09:45:39 [INFO]  go-plugin@v1.6.0/client.go:780: plugin process exited: plugin=/usr/local/bin/tflint id=56
09:45:39 [DEBUG] go-plugin@v1.6.0/client.go:558: plugin exited
09:45:39 [DEBUG] go-plugin@v1.6.0/grpc_stdio.go:142: stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
09:45:39 [INFO]  go-plugin@v1.6.0/client.go:780: plugin process exited: plugin=/root/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-aws/0.27.0/tflint-ruleset-aws id=66
09:45:39 [DEBUG] go-plugin@v1.6.0/client.go:558: plugin exited
09:45:39 config.go:143: [INFO] Load config: .tflint.hcl
Failed to load TFLint config; failed to load file: open .tflint.hcl: no such file or directory working_dir=modules

TFLint Version

0.50.0

Terraform Version

No response

Operating System

  • Linux
  • macOS
  • Windows
@tommyallieri
Copy link
Author

a workaround is to specify the full, rather than relative path to .tflint.hcl

tflint --config "$(pwd).tflint.hcl" --module --recursive

@wata727
Copy link
Member

wata727 commented Jan 4, 2024

If you just want to ignore instead of returing an error if .tflint.hcl doesn't exist in a sub-directory, you can simply remove --config .tflint.hcl. See also #1926

Discussion on configuration inheritance is tracked in #1929.

@wata727 wata727 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants