tfutils / tfenv

Terraform version manager
MIT License
4.54k stars 455 forks source link

Could not determine required_version based on your terraform sources. #261

Open skadem07 opened 3 years ago

skadem07 commented 3 years ago

Hi, I have been recently getting this error in Jenkins. I have installed tfenv 2.2.1,

Error: Could not determine required_version based on your terraform sources.
Make sure at least one of your *tf files includes a required version section like
terraform {
  required_version = ">= 0.0.0"
}

see https://www.terraform.io/docs/configuration/terraform.html for details
tfenv-min-required failed
grep: Unmatched [ or [^
No versions matching 'min-required' found in remote

backend.tf

terraform {
  backend "s3" {
    bucket         = "ixxx"
    key            = "xxxx"
    dynamodb_table = "txxxxk"
    region         = "us-east-1"
    encrypt        = true
    role_arn       = "arn:aws:iam::xxxxxx:role/xxx-xx"
  }

  required_version = "0.11.13"
}

It was working before, but we upgraded tfenv started facing this issue, If anyone faced this same issue? if pls let me know , how did you solve this?

aaroncline commented 3 years ago

I have the same issue, 2.2.1 does not work. in a *.tf file in a subdirectory

terraform {
  required_version = "= 0.12.31"
  backend "gcs" {}
}

Error: Could not determine required_version based on your terraform sources.
Make sure at least one of your *tf files includes a required version section like
terraform {
  required_version = ">= 0.0.0"
}

see https://www.terraform.io/docs/configuration/terraform.html for details
tfenv-min-required failed
grep: brackets ([ ]) not balanced
No versions matching 'min-required' found in remote
No versions of terraform installed. Please install one with: tfenv install
skadem07 commented 3 years ago

Ya, I'm still having the same issue, and all our jenkins builds are broken. This seems to be fixed based on this pr https://github.com/tfutils/tfenv/pull/235 May be the only solution is downgrading to 1.0.2 version.

Zordrak commented 3 years ago

Can you provide some bash debug output on this (-x), or offer a new test in the test suite to reproduce the failure?

Zordrak commented 2 years ago

Can you also prove against the latest master?