Closed fatbasstard closed 1 year ago
I'd expect/hope that the rule can at least check IF the tags are configured, even without checking the specific tags.
This is not what the rule is intended to do and doesn't seem to be especially useful.
The panic is a legit bug though, assuming it's reproducible in the latest version, and should be easily fixable. The proper handling here is to ignore expressions that are unknown, which includes variables with no set value or default.
Hmm, CanIterateElements
seems to cause panic in unknown and NULL cases.
https://github.com/terraform-linters/tflint-ruleset-aws/blob/47711edd982426cc670aed89db48baf95067478f/rules/aws_resource_missing_tags.go#L382
https://github.com/zclconf/go-cty/blob/v1.13.2/cty/value_ops.go#L1190-L1197
I'm surprised because this is different behavior from the documentation...
CanIterateElements returns true if the receiver can support the ElementIterator method (and by extension, ForEachElement) without panic.
https://pkg.go.dev/github.com/zclconf/go-cty@v1.13.2/cty#Value.CanIterateElements
Having this same error in every version after 24.1. 24.1 is fine but 24.2+ has the bug.
Hi,
when enabling the
aws_resource_missing_tags
rule I get aFailed to check ruleset; error reading from server: EOF
error. This happens apparantly because we use variables for tags. Instead of "not checking" the rule breaks. Here's a simple test setup:Example
.tflint.hcl:
Debug output:
When removing/commenting that
test_var
I get a clean and normal message:I'd expect/hope that the rule can at least check IF the tags are configured, even without checking the specific tags. I've tried enforcing this by removing the tags to validate (assuming it would just do a "missing tags" check):
But this throws an error as well:
Failed to check ruleset; failed to check "aws_resource_missing_tags" rule: .tflint.hcl:12,34-34: Missing required argument; The argument "tags" is required, but no definition was found.
Changing to
tags = []
also doesn't work, just doesn't check anythingConclusion Multiple ways to fix/support this I guess:
tags
from the rule configuration).