Error: Unsupported OpenTofu Core version
Resolves OpenTofu's 'Error: Unsupported OpenTofu Core version' at tofu init by aligning the required_version constraint with the installed tofu binary. Use when init refuses right after a Terraform-to-OpenTofu migration or when CI installs a tofu version the config doesn't allow. Not for provider version or lock-file errors.
TL;DR: Your required_version constraint excludes the tofu binary you have installed. Either install a tofu version the constraint allows, or widen the constraint. This bites hardest when migrating from Terraform, because constraints like >= 1.14 follow Terraform's release line, which OpenTofu doesn't share.
Error: Unsupported OpenTofu Core version
on versions.tf line 2, in terraform:
2: required_version = ">= 1.14"
This configuration does not support OpenTofu version 1.11.5.Steps
Run
tofu versionand note the installed version. Expected:OpenTofu v1.11.5(or whatever you have).Decide: upgrade tofu, or relax the constraint. If the constraint references Terraform's line (for example
>= 1.14after a migration), editversions.tfso it covers your tofu, e.g.required_version = ">= 1.11". Expected: the constraint now includes your installed version.If you'd rather keep the constraint, install a matching tofu with a version manager:
tofuenv install 1.12.6 && tofuenv use 1.12.6(or the tenv equivalent). Expected:tofu versionshows the new version.Run
tofu init. Expected: init proceeds past the version check.
When this applies
tofu initfails immediately, naming arequired_versionline, right after migrating a repo from Terraform.- CI installs a pinned tofu version that the repo's constraint doesn't allow.
When it doesn't apply
Error: Failed to install provideris about provider versions, not the tofu binary.Error: Inconsistent dependency lock fileis about provider pins, not the core version.
Tool versions
All OpenTofu versions. The check runs on every init, plan, and apply.
Why it happens
Version numbers diverged after the fork: Terraform and OpenTofu ship on separate cadences. A required_version written against Terraform's line (say >= 1.14) is meaningless on tofu's line (1.11.x, 1.12.x), so tofu refuses at init instead of running under a constraint it can't satisfy.
Edge cases
- During a transition where a repo must work with both tools, pick a floor both lines satisfy, like
>= 1.6(where OpenTofu forked), and tighten it once the migration is done. - The error names the exact file and line, so you don't have to hunt; it's always the root module's
terraformblock. - CI matrices should install the tofu version the repo declares. Pin it in one place (a
.opentofu-versionfile read by tenv/tofuenv) so the number can't drift between local and CI.