Closed wata727 closed 10 months ago
The important outputs are these:
16:37:09 [TRACE] interceptor/logging.go:15: gRPC request: direction=plugin2host method=/proto.Runner/EvaluateExpr req="option:{type:\"\\"string\\"\" module_ctx:MODULE_CTX_TYPE_SELF} expression:{bytes:\"\\"INVALID\\"\" range:{filename:\"subdir/main.tf\" start:{line:3 column:27 byte:140} end:{line:3 column:36 byte:149}}}"
...
16:37:09 [TRACE] interceptor/logging.go:15: gRPC request: direction=plugin2host method=/proto.Runner/ApplyChanges req="changes:{key:\"subdir/main.tf\" value:\"resource \\"google_compute_backend_service\\" \\"backend_service\\" {\n name = data.foo.bar[\\"b\\"]\n load_balancing_scheme = \\"INVALID\\"\n}\n\"}"
...
16:37:09 [TRACE] interceptor/logging.go:15: gRPC request: direction=plugin2host method=/proto.Runner/EvaluateExpr req="option:{type:\"\\"string\\"\" module_ctx:MODULE_CTX_TYPE_SELF} expression:{bytes:\"cheme = \\"\" range:{filename:\"subdir/main.tf\" start:{line:3 column:27 byte:132} end:{line:3 column:36 byte:141}}}"
The expression sent EvaluateExpr after autofix is cheme ="
instead of "INVALID"
. This is obviously wrong because it's not a valid expression.
Summary
Using
--chdir
(or--recursive
) and--fix
together may cause rule checks to fail due to HCL parsing errors. This is probably due to the plugin not being able to properly handle auto-fixed code.Side note: I had a really hard time researching issues like this, so maybe more logging about autofixes would be helpful.
Command
tflint --chdir ./subdir --fix
Terraform Configuration
TFLint Configuration
Output
TFLint Version
0.50.1
Terraform Version
No response
Operating System