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_required_version: false positive with multiple terraform blocks #1451

Closed
bendrucker opened this issue Jul 27, 2022 · 1 comment · Fixed by #1452
Closed

terraform_required_version: false positive with multiple terraform blocks #1451

bendrucker opened this issue Jul 27, 2022 · 1 comment · Fixed by #1452
Labels

Comments

@bendrucker
Copy link
Member

Introduction

When multiple terraform blocks are defined, TFLint is unable to detect that required_version has been set, resulting in a warning for valid configuration. This is a regression in 0.39.0.

Expected Behavior

No reported issues.

Actual behavior

1 issue(s) found:

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

  on  line 0:
   (source code not available)

Steps to Reproduce

terraform {
  required_version = ">= 1, < 2"
}

terraform {
  cloud {
    organization = "my-org"

    workspaces {
      name = "my-ws"
    }
  }
}
tflint --enable-rule terraform_required_version

Additional Context

$ tflint -v
TFLint version 0.39.0
$ terraform -v
Terraform v1.2.5
@bendrucker bendrucker added the bug label Jul 27, 2022
bendrucker added a commit that referenced this issue Jul 27, 2022
bendrucker added a commit that referenced this issue Jul 27, 2022
)

* add failing test for #1451, improve test naming
* fix logic for `required_version` existence check
@yermulnik
Copy link

@bendrucker Any ETA on when the fix is going to be bundled into release? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants