# tflint-ignore: terraform_unused_declarations no longer masks a finding
richardj-bsquare opened this issue · comments
Summary
I'm having problems ignoring unused declarations. I've got these kinds of statements scattered through various input variables. And at some point, they were working, but now they always report failures.
To be clear, I've tried the annotation everywhere within the codebase, to no avail.
Regression testing 0.46.0 and 0.47.0 shows these statements working just fine, so the problem appeared for me in 0.48.0
Perhaps related to: #1834 ?
Command
tflint
Terraform Configuration
# tflint-ignore: terraform_unused_declarations
variable "ecr_registry_id" {
description = "AWS ECR registry ID from which to fetch ECR container images (deprecated)"
type = string
default = "deprecated_ecr_registry_id"
}
TFLint Configuration
plugin "terraform" {
enabled = true
preset = "all"
}
rule "terraform_naming_convention" {
enabled = false
}
Output
Warning: [Fixable] variable "ecr_registry_id" is declared but not used (terraform_unused_declarations)
on variables.tf line 65:
65: variable "ecr_registry_id" {
Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.4.0/docs/rules/terraform_unused_declarations.md
TFLint Version
0.48.0
Terraform Version
v1.5.7
Operating System
- Linux
- macOS
- Windows
Had to tediously create a new issue, as unable to 're-open' the old one: #1873
The open state of an issue is a tool for maintainers to identifiable actionable issues. It's totally fine to continue refining an issue and adding comments, we can always re-open. But then you've closed this one too?
There's still a missing piece here. The output includes the declaration range. Running with --format json
would give you the full range, but the default formatter shows the first line. And your annotation appears the line before.
I am unable to reproduce:
tflint --only terraform_unused_declarations
This gives no output, as expected. Same OS/architecture.