Closed alexjurkiewicz closed 2 years ago
It's a technical limitation that we can't completely detect unused data sources with side effects.
https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.1.1/docs/rules/terraform_unused_declarations.md#how-to-fix
But in this example, we might be able to improve the check based on the presence of a self
reference.
PS, I love tflint! Keep it up! 😍
Thanks! I'm glad to hear that :)
After thinking about it overnight, the current behaviour is probably the best.
Many pre/post condition blocks will not be assertions about the whole stack state and shouldn't prevent the data source from being deleted. For example the official Terraform docs use data "aws_ami" as an example, and assert on the image's architecture.
So, I don't think anything should change. My usage should continue to require ignore directives 😊
On Thu, 22 Sept 2022, 00:03 Kazuma Watanabe, @.***> wrote:
It's a technical limitation that we can't completely detect unused data sources with side effects.
https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.1.1/docs/rules/terraform_unused_declarations.md#how-to-fix But in this example, we might be able to improve the check based on the presence of a self reference.
PS, I love tflint! Keep it up! 😍
Thanks! I'm glad to hear that :)
— Reply to this email directly, view it on GitHub https://github.com/terraform-linters/tflint-ruleset-terraform/issues/28#issuecomment-1253759256, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC4U5PKMQDDB54ALVFQZLLV7MIR7ANCNFSM6AAAAAAQSDFWWM . You are receiving this because you authored the thread.Message ID: @.*** com>
Introduction
Sometimes I use new Terraform 1.2 pre/postconditions for runtime assertions on data sources with no other references:
Expected Behavior
No error should be generated.
Actual behavior
Additional Context
PS, I love tflint! Keep it up! 😍