terraform-linters / tflint-ruleset-terraform

TFLint ruleset for Terraform Language
Mozilla Public License 2.0
61 stars 21 forks source link

bug: Not detecting the use of a data.aws_iam_policy_document.* #58

Closed davidjeddy closed 1 year ago

davidjeddy commented 1 year ago

The following ...

data "aws_iam_policy_document" "vpc_flow_logs_kms" {
  statement {
    sid       = "AdminVPCFlowLogs"
    effect    = "Allow"
    resources = ["*"]
    actions   = ["kms:*"]

    principals {
      type        = "AWS"
      identifiers = ["..."]
    }
  }

}

resource "aws_cloudwatch_log_resource_policy" "route53_query_logging_policy" {
  provider = aws.us-east-1

  policy_document = data.aws_iam_policy_document.route53_query_logging.json
  policy_name = "route53_query_logging"
}

...results in a warning from tflint...

1 issue(s) found:

Warning: data "aws_iam_policy_document" "route53_query_logging" is declared but not used (terraform_unused_declarations)

  on iam_policy_document.tf line 3:
   3: data "aws_iam_policy_document" "route53_query_logging" {

Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.2.1/docs/rules/terraform_unused_declarations.md`

Am I doing something incorrectly?

davidjeddy commented 1 year ago

Nvmd, I was in the wrong module. :/