tenv terraform installs opentofu bydefault
Describe the bug
tenv terraform install command by default installs opentofu instead of terraform and logs shows
tofu: OpenTofu has been successfully initialized!
To Reproduce Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior When tenv terraform command is used it should installs opentofu and logs shows tofu instead of terraform Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS: [e.g. iOS]
- tofuenv version [e.g. 0.8.0]
Additional context Add any other context about the problem here.
Could you please provide more details? What version of tenv did you use, and what exact command did you execute?
I have the same issue.
When enabling auto install mode either via TENV_AUTO_INSTALL or TFENV_AUTO_INSTALL, even if I have a .terraform-version file up in the directory tree, tenv uses OpenTofu instead of Terraform.
Environment (please complete the following information): OS: MacOS 14.4 tenv version: latest (4.4.0)
Additional context
Initializing the backend...
Successfully configured the backend "s3"! OpenTofu will automatically
use this backend unless the backend configuration changes.
This happens from a clean slate: No Tf / Tg / Tofu versions previously installed via tenv, and just running terragrunt plan
Up the dir tree I have both Tf & Tg version files.
Tg gets installed just fine, but I get Tofu instead of Tf
$ tenv tf list
$ tenv tg list
0.58.3 (used 2025-05-05)
$ tenv tofu list
1.9.1 (used 2025-05-05)
If instead I disable TENV_AUTO_INSTALL and I install Tg / Tf manually:
tenv tg install
tenv tf install
Then I do get Terraform
Initializing the backend...
Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.
I reproduce the same as stated by @kodachimaru with
Environment (please complete the following information): OS: MacOS 15.4.1 tenv version: latest (4.4.0)
@kodachimaru @TsaorKG Terragrunt uses OpenTofu by default now. It can be overrided via terraform_binary (https://terragrunt.gruntwork.io/docs/reference/config-blocks-and-attributes/#terraform_binary). Can you try it?
@kvendingoldo , if that was the issue, then I would get also OpenTofu instead of Terraform when auto install is off, and I don't. This means the issue is the auto install functionality, not Terragrunt's default Tf binary option.
Still, I've tried what you said, overriding terraform_binary via the TG_TF_PATH variable:
$ which terraform
/opt/homebrew/bin/terraform
$ ls -lah /opt/homebrew/bin | grep terraform
lrwxr-xr-x 1 myuser mygroup 34 May 5 11:09 terraform -> ../Cellar/tenv/4.4.0/bin/terraform
export TG_TF_PATH=/opt/homebrew/bin/terraform
And I still get OpenTofu
OpenTofu has been successfully initialized!
Besides, when I check after the terragrunt plan execution, there's no Tf version installed, but OpenTofu has indeed been installed
$ tenv tg list
0.58.3 (used 2025-05-05)
$ tenv tf list
$ tenv tofu list
1.9.1 (used 2025-05-05)
And in fact, when I run terragrunt plan from a clean slate (no Tg / Tf / Tofu versions installed yet), the log shows how tenv installs Tg but not Tf, and the Tofu installation is indeed hidden
$ terragrunt plan
Resolved version from /[...]/instances/default/.terragrunt-version : 0.58.3
Installing Terragrunt 0.58.3
Fetching release information from https://api.github.com/repos/gruntwork-io/terragrunt/releases/tags/v0.58.3
Downloading https://github.com/gruntwork-io/terragrunt/releases/download/v0.58.3/terragrunt_darwin_arm64
Downloading https://github.com/gruntwork-io/terragrunt/releases/download/v0.58.3/SHA256SUMS
Installation of Terragrunt 0.58.3 successful
INFO[0012] Downloading Terraform configurations from git::ssh://XXXX into /[...]/instances/default/xxxxx/yyyyy/.terragrunt-cache/LHeM8BfkA4Gc4EzwqLYsB2cunL8/hyIcZRGNSrfNcby4tfDntXSdbEM
Initializing the backend...
Successfully configured the backend "s3"! OpenTofu will automatically
use this backend unless the backend configuration changes.
I think it's connected to https://github.com/tofuutils/tenv/issues/405. Thank you for detailed report, we'll check it
@kvendingoldo , if that was the issue, then I would get also OpenTofu instead of Terraform when auto install is off, and I don't. This means the issue is the auto install functionality, not Terragrunt's default Tf binary option.
no, actually when auto install is off tofu proxy fail so terragrunt call terraform proxy
@dvaumoron , given your last comment, it's not clear to me then whether this is a bug (which will eventually get fixed), or an expected behaviour which requires me to tweak my configuration in order to fix it. Could you clarify?
Thank you 🙏
Any news @dvaumoron ? Thanks in advance.
That's not a bug in tenv, however as said by my teammate, there is a work around
@kodachimaru @TsaorKG Terragrunt uses OpenTofu by default now. It can be overrided via
terraform_binary(https://terragrunt.gruntwork.io/docs/reference/config-blocks-and-attributes/#terraform_binary). Can you try it?
Ok, thanks for the clarification 👍