-
Notifications
You must be signed in to change notification settings - Fork 3
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
Panic: Invalid reference error when issues are emitted with non-expression range #85
Panic: Invalid reference error when issues are emitted with non-expression range #85
Comments
Did a bit of debugging. The reason for the panic is that the emitted expression is not valid. The Use of |
Switching to |
Dug deeper, actually only This is actually the issue: Which in turn just attempts to parse the expression: But that isn't sufficient for expression detection. It avoids any labeled blocks but it's still going to treat an unlabeled block's name (minus curly braces) as an expression. I don't see how we can detect this without asking plugins to specify whether they're emitting an issue about an expression or a declaration. Keeping this open but also re-opening a TFLint issue to cover this. |
Discussed in #84
Prematurely converted this to a discussion. Belongs as an issue in the
opa
repo.Originally posted by ericsaboia February 4, 2024
Summary
Hi, I'm using
tflint-ruleset-opa
to set an issue when the resourcesignalfx_detector
is missing anotifications
attribute insiderule
.The rule works fine when validating my detector, but if I include a
main.tf
file that loads my defective detector, tflint fails with the error pasted in the output section. I even tried to excludemain.tf
with# tflint-ignore-file: all
, but it still fails.My folder structure is:
main.tf:
detectors/example.tf:
.tflind.d/policies/tags.rego:
Command
TFLINT_OPA_POLICY_DIR="$(pwd)/.tflint.d/policies/" tflint --config "$(pwd)/.tflint.hcl" --recursive
Terraform Configuration
TFLint Configuration
Output
TFLint Version
0.50.2
Terraform Version
No response
Operating System
The text was updated successfully, but these errors were encountered: