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 85 forks source link

[BUG] `required_version` validation error #1778

Closed ohmer closed 5 days ago

ohmer commented 6 days ago

Describe the bug

Version constraint ">= 0.9.0" is not satisfied by terramate version "0.9.1-dev"

To Reproduce

> GOBIN=~/bin/ go install github.com/terramate-io/terramate/cmd/terramate@i4k-fix-tg-after-cycle
❯ ~/bin/terramate create --all-terragrunt
Error: version check failed
> version check error: version constraint ">= 0.9.0" not satisfied by terramate version "0.9.1-dev"

Expected behavior

Version constraint is accepted and Terramate execution continues.

Additional context

terramate.tm.hcl:

terramate {
  required_version = ">= 0.9.0"

  config {
    change_detection {
      terragrunt = "force"
    }

    generate {
      hcl_magic_header_comment_style = "#"
    }

    disable_safeguards = ["git"]

    git {
      default_branch = "master"
      default_remote = "origin"
    }
  }
}

https://jubianchi.github.io/semver-check/#/%3E%3D%200.9.0/0.9.1-dev says it is valid and that's my understanding too.

soerenmartius commented 5 days ago

Hi @ohmer, thanks for reporting this. To allow pre-releases in required_version you need to set terramate.required_version_allow_prereleases to true.

So your configuration would look something like this

terramate.tm.hcl

terramate {
  required_version = ">= 0.9.0"
  required_version_allow_prereleases = true

  config {
    change_detection {
      terragrunt = "force"
    }

    generate {
      hcl_magic_header_comment_style = "#"
    }

    disable_safeguards = ["git"]

    git {
      default_branch = "master"
      default_remote = "origin"
    }
  }
}

Let me know if that solves your problem!

ohmer commented 5 days ago

So that's not a bug but PEBKAC ;-) Thanks for clarifying, I forgot about required_version_allow_prereleases.