Closed j-fraga closed 1 year ago
Most important part—what is the Terraform config that caused this?
@bendrucker, the Terraform stack TFlint is failing on is too big to include here (9243 lines in total, not including modules!).
However, I noticed that if I disable the rule aws_resource_missing_tags
as follows:
rule "aws_resource_missing_tags" {
enabled = false
tags = ["Name", "Application"]
}
the error does not occur.
I should mention that with v0.24.1 the error does not occur even with the rule aws_resource_missing_tags
enabled.
the Terraform stack TFlint is failing on is too big to include here (9243 lines in total, not including modules!).
Sure, please don't include your whole configuration (too much noise, too little signal), just enough to reproduce the issue. Ideally one resource or something similarly minimal. This is a must-have so we can ensure a test case is added that matches the behavior you're seeing.
Failed to check ruleset; error reading from server: EOF
This is not actually the error, it's just what happens on subsequent requests once the plugin has crashed from the root cause:
go-plugin@v1.4.10/client.go:1046: tflint-ruleset-aws: rules/aws_resource_missing_tags.go:204: Walk `%s` attribute: EXTRA_VALUE_AT_END=aws_sns_topic.main.tags
host2plugin/client.go:124: starting host-side gRPC server
go-plugin@v1.4.10/client.go:1046: tflint-ruleset-aws: rules/aws_resource_missing_tags.go:204: Walk `%s` attribute: EXTRA_VALUE_AT_END=aws_s3_bucket.main.tags
go-plugin@v1.4.10/client.go:1046: tflint-ruleset-aws: panic: value is unknown
Based on the error we at least need the config for aws_s3_bucket.main
and anything it depends on. The cause of the panic is there and we need a sample/reproduction to proceed.
I think maybe this issue is caused by AsValueMap
.
https://github.com/terraform-linters/tflint-ruleset-aws/blob/bcd0c2d7e76192b8d390a3e2506b3385f0cd7e46/rules/aws_resource_missing_tags.go#L118
This implicitly expects the key to be a known string, so this panic can occur when the tag's key is unknown. https://github.com/zclconf/go-cty/blob/v1.13.2/cty/value_ops.go#L1457
In v0.24.2 the following error occurs:
The TFlint version used is v0.47.0.
Output with TFLINT_LOG=debug tflint:
The
.tflint.hcl
: