terramate-io / terramate

Terramate CLI is an open-source Infrastructure as Code (IaC) Orchestration and Code Generation tool for Terraform, OpenTofu and Terragrunt.
https://terramate.io
Mozilla Public License 2.0
3.12k stars 86 forks source link

[BUG] Version constraint check is not working properly #1726

Closed athak closed 1 month ago

athak commented 1 month ago

Describe the bug The version constraint check is not working properly. I have the following in the terramate.tm.hcl file:

required_version = ">= 0.8.0"

And the latest version installed via APT, currently 0.9.0-rc1. Running terramate generate or any other command errors with the following output:

Error: version check failed
version check error: version constraint ">= 0.8.0" not satisfied by terramate version "0.9.0-rc1"

I suspect it's not parsing the -rc1 suffix correctly.

To Reproduce

Steps to reproduce the behavior:

  1. Set a version constraint in the terramate, e.g. required_version = ">= 0.8.0"
  2. Install the latest pre-release terramate version
  3. Run a terramate command
  4. See error

Expected behavior It should parse the version correctly and consider 0.9.0-rc1 a higher version than 0.8.0.

Log Output See above.

Environment (please complete the following information):

i4ki commented 1 month ago

Hi @athak

Did you enable the terramate.required_version_allow_prereleases flag? By default the constraint check ignores prereleases. Check docs here.

terramate {
  required_version = ">= 0.8.0"
  required_version_allow_prereleases = true
}

let me know if this fixes your problem.

athak commented 1 month ago

Hi @i4ki

My bad, I missed that flag in the docs!