You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ $ which tfenv
81
81
82
82
Install a specific version of Terraform.
83
83
84
-
If no parameter is passed, the version to use is resolved automatically via [TFENV\_TERRAFORM\_VERSION environment variable](#tfenv_terraform_version), [.terraform-version files](#terraform-version-file), or [required_version in "terraform" section of any .tf or .tf.json file](#min-required), in that order of precedence, i.e. TFENV\_TERRAFORM\_VERSION, then .terraform-version, and then required_version in .tf. The default is 'latest' if none are found.
84
+
If no parameter is passed, the version to use is resolved automatically via [TFENV\_TERRAFORM\_VERSION environment variable](#tfenv_terraform_version) or [.terraform-version files](#terraform-version-file), in that order of precedence, i.e. TFENV\_TERRAFORM\_VERSION, then .terraform-version. The default is 'latest' if none are found.
@@ -62,10 +55,14 @@ function tfenv-version-name() {
62
55
| sort -t'.' -k 1nr,1 -k 2nr,2 -k 3nr,3 \
63
56
| grep -e "${regex}" \
64
57
| head -n 1)";
58
+
59
+
log 'debug'"Resolved ${TFENV_VERSION} to locally installed version: ${local_version}";
60
+
elif [[ "${auto_install}"!="true" ]];then
61
+
log 'error''No versions of terraform installed and TFENV_AUTO_INSTALL is not true. Please install a version of terraform before it can be selected as latest';
65
62
fi;
66
63
67
-
if [[ "${TFENV_AUTO_INSTALL:-true}"=="true" ]];then
68
-
log 'debug'"Trying to find the remote version using the regex: ${regex}";
64
+
if [[ "${auto_install}"=="true" ]];then
65
+
log 'debug'"Using latest keyword and auto_install means the current version is whatever is latest in the remote. Trying to find the remote version using the regex: ${regex}";
69
66
remote_version="$(tfenv-list-remote | grep -e "${regex}"| head -n 1)";
70
67
if [[ -n"${remote_version}" ]];then
71
68
if [[ "${local_version}"!="${remote_version}" ]];then
0 commit comments