Terraform version constraint tester

Check exactly which versions a constraint allows. Terraform uses different rules for providers, modules and required_version, and this tool shows where they disagree.

Runs entirely in your browser. Your data is never uploaded.

Where is the constraint used?

A constraint like ~> 5.0 or ">= 1.6, < 2.0". You can paste the whole line, e.g. version = "~> 5.0".

Try:

One per line (commas and spaces also work). Paste a release list to see what would be selected.

What ~> actually allows

The pessimistic operator lets only the right-most number you wrote increase. Providers and modules are evaluated by two different libraries, and they differ when you give a single number:

ConstraintProvider versionsModule versions and required_version
~> 1.2.3>= 1.2.3, < 1.3.0>= 1.2.3, < 1.3.0
~> 1.2>= 1.2.0, < 2.0.0>= 1.2, < 2.0
~> 1>= 1.0.0, < 2.0.0>= 1 — no upper bound
~> 0.12>= 0.12.0, < 1.0.0>= 0.12, < 1.0
1.2exactly 1.2.0exactly 1.2.0

Which rules apply where

Pre-releases

Syntax gotchas

OpenTofu

OpenTofu forked Terraform and depends on the same two libraries, so the provider and required_version results apply to OpenTofu too. OpenTofu changed some of its module pre-release handling, so for module pre-releases this tool reflects Terraform's behavior.

About this tester

The engines are TypeScript ports of hashicorp/go-version 1.9.0, apparentlymart/go-versions 1.0.3 and the Terraform code that connects them. They are tested against results from the real Go libraries for 58 constraints × 34 versions, including error messages. Everything runs in your browser.