tfutils / tfenv

Terraform version manager
MIT License
4.48k stars 454 forks source link

min-required doesn't work with auto-install #300

Closed OJFord closed 2 years ago

OJFord commented 2 years ago
$ echo 'min-required' > .terraform-version
$ terraform init
version 'min-required' is not installed (set by [...]/.terraform-version). Installing now as TFENV_AUTO_INSTALL==true
Terraform v1.0.0 is already installed
/opt/tfenv/libexec/tfenv-exec: line 105: /var/lib/tfenv/versions/min-required/terraform: No such file or directory

I think there's two problems here with when 'min-required' is evaluated:

  1. it's thought (presumably always) not to be installed, and tries to install; at which point in this case its value was already installed;
  2. it's again not evaluated in (or in the call to) tfenv-exec, so it tries to find the terraform binary in a min-required dir that will never exist