tfenv icon indicating copy to clipboard operation
tfenv copied to clipboard

Unbound variable error in error message

Open RodneyMKay opened this issue 2 years ago • 1 comments

Reproducing the issue

  1. Create a .terraform-version file with the following contents:
latest:^1.0.invalid
  1. Attempt to run terraform validate.

Result

$ terraform validate
/[...]/tfutils/tfenv/lib/tfenv-version-name.sh: line 80: version_requested: unbound variable
$ echo $?
1

Expected Result

A proper error message.

Probable cause

Looking at that file (tfenv-version-name.sh), I found that the "unbound variable" is only contained in the error message. This leads me to conclude that this is a bug. Here, I linked the commit that introduced the error message: https://github.com/tfutils/tfenv/commit/3dc5819c65d873cba6420b084cc7dfb395b397df#diff-7fcb3e8511bfa185e617cfd1e1b1d11030818551682579fc45fc0d4443ad13efR110

A possible fix could be to replace ${requested} with ${TFENV_VERSION}.

RodneyMKay avatar Aug 10 '23 11:08 RodneyMKay