Open isybub opened 1 year ago
An alternate, maybe easier and less prone to side effects, approach would be to completely ditch .terraform-version file. See #367 for a happy path.
Then:
This way, just using tfenv on its default configuration will render the expected results: Terraform ends up installed and working on the highest valid version (either latest stable or the highest one as per Terraform's code constrains).
Also you can avoid tfenv automatically installing terraform as per TFENV_AUTO_INSTALL=false. Also you can change tfenv's default version management behaviour by means of TFENV_TERRAFORM_VERSION=min-allowed. Also you could set TFENV_TERRAFORM_VERSION to an explicit version (this usage should be discouraged: use Terraform's own required_version parameter for that.
I made a branch and tried to make a PR but I can't find contribution guidelines so I don't think I can push to the remote. All it is is changing line 13 in lib/tfenv-version-name.sh from TFENV_VERSION="$cat "${TFENV_VERSION_FILE}" || true)" \ to TFENV_VERSION="$(sed -e '/^#/d' "${TFENV_VERSION_FILE}" || true)" \
This also strips blank lines.