Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform_unused_required_providers does not support provider-defined functions #213

Closed
1 of 3 tasks
bgpat opened this issue Sep 25, 2024 · 0 comments · Fixed by #214
Closed
1 of 3 tasks

terraform_unused_required_providers does not support provider-defined functions #213

bgpat opened this issue Sep 25, 2024 · 0 comments · Fixed by #214

Comments

@bgpat
Copy link
Contributor

bgpat commented Sep 25, 2024

Summary

The terraform_unused_required_providers rule does not support provider-defined functions, which were introduced in Terraform 1.8. As a result, valid configurations that utilize provider-defined functions are incorrectly flagged as unused providers.

https://www.hashicorp.com/blog/terraform-1-8-improves-extensibility-with-provider-defined-functions

Command

tflint

Terraform Configuration

terraform {
  required_providers {
    time = {
      source = "hashicorp/time"
    }
  }
  required_version = ">= 1.8"
}

output "example_output" {
  value = provider::time::rfc3339_parse("2023-07-25T23:43:16Z")
}

TFLint Configuration

rule "terraform_unused_required_providers" {
  enabled = true
}

Output

$ tflint
1 issue(s) found:

Warning: provider 'time' is declared in required_providers but not used by the module (terraform_unused_required_providers)

  on main.tf line 3:
   3:     time = {
   4:       source = "hashicorp/time"
   5:     }

Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.9.1/docs/rules/terraform_unused_required_providers.md

TFLint Version

0.53.0

Terraform Version

1.9.5

Operating System

  • Linux
  • macOS
  • Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant