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

No source specified for terraform_required_version warning in a local module #177

Closed
1 of 3 tasks
rdimartino opened this issue May 18, 2024 · 2 comments · Fixed by #178
Closed
1 of 3 tasks

No source specified for terraform_required_version warning in a local module #177

rdimartino opened this issue May 18, 2024 · 2 comments · Fixed by #178
Labels
bug Something isn't working

Comments

@rdimartino
Copy link
Contributor

Summary

It is not clear from the output of tflint which modules are missing a required_version for terraform. The warning just says on line 0: (source code not available) which is not helpful for finding the issue.

Command

tflint --recursive

Terraform Configuration

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.49"
    }
  }
}

data "aws_availability_zones" "available" {}

TFLint Configuration

tflint {
  required_version = "~> 0.51"
}

plugin "terraform" {
  enabled = true
  preset  = "recommended"
}

plugin "aws" {
    enabled = true
    version = "0.31.0"
    source  = "github.com/terraform-linters/tflint-ruleset-aws"
}

Output

Warning: terraform "required_version" attribute is required (terraform_required_version)

  on  line 0:
   (source code not available)

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

TFLint Version

0.51.1

Terraform Version

No response

Operating System

  • Linux
  • macOS
  • Windows
@rdimartino rdimartino added the bug Something isn't working label May 18, 2024
@wata727 wata727 transferred this issue from terraform-linters/tflint May 19, 2024
@wata727
Copy link
Member

wata727 commented May 19, 2024

I agree that there is room for improvement in the current output, but be aware that this is a rule that reports "missing" required declarations, so you may not always get a valid range. For example, we may also need to report this issue for empty directories.

See also terraform-linters/tflint#1790

@rdimartino
Copy link
Contributor Author

Yeah, thank you. That makes sense. I get why we'd see (source code not available) for a "missing" report, but an indication of the file or directory would at least make the warning actionable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants