Skip to content

Commit

Permalink
Terraform 0.13.0 support (#191)
Browse files Browse the repository at this point in the history
* replaced usages of terraform --version with terraform version, as terraform --version is no longer supported starting with 0.13.0

* use 'version' instead of '--version' in helper.sh for 0.13.0 compatibility

Co-authored-by: Zordrak <Zordrak@users.noreply.github.com>
  • Loading branch information
Bobonium and Zordrak authored Jan 30, 2021
1 parent 7459b02 commit 0119322
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,20 +408,20 @@ Note, that [TFENV\_TERRAFORM\_VERSION environment variable](#tfenv_terraform_ver
$ cat .terraform-version
0.6.16

$ terraform --version
$ terraform version
Terraform v0.6.16

Your version of Terraform is out of date! The latest version
is 0.7.3. You can update by downloading from www.terraform.io

$ echo 0.7.3 > .terraform-version

$ terraform --version
$ terraform version
Terraform v0.7.3

$ echo latest:^0.8 > .terraform-version

$ terraform --version
$ terraform version
Terraform v0.8.8

$ TFENV_TERRAFORM_VERSION=0.7.3 terraform --version
Expand Down
4 changes: 2 additions & 2 deletions lib/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ export -f curlw;

check_active_version() {
local v="${1}";
[ -n "$(${TFENV_ROOT}/bin/terraform --version | grep -E "^Terraform v${v}((-dev)|( \([a-f0-9]+\)))?$")" ];
[ -n "$(${TFENV_ROOT}/bin/terraform version | grep -E "^Terraform v${v}((-dev)|( \([a-f0-9]+\)))?$")" ];
}
export -f check_active_version;

check_installed_version() {
local v="${1}";
local bin="${TFENV_ROOT}/versions/${v}/terraform";
[ -n "$(${bin} --version | grep -E "^Terraform v${v}((-dev)|( \([a-f0-9]+\)))?$")" ];
[ -n "$(${bin} version | grep -E "^Terraform v${v}((-dev)|( \([a-f0-9]+\)))?$")" ];
};
export -f check_installed_version;

Expand Down
4 changes: 2 additions & 2 deletions libexec/tfenv-use
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@ if [ "${version_file}" != "$(tfenv-version-file)" ]; then
log 'warn' "Default version file overridden by $(tfenv-version-file), changing the default version has no effect";
fi;

terraform --version 1>/dev/null \
|| log 'error' "'terraform --version' failed. Something is seriously wrong";
terraform version 1>/dev/null \
|| log 'error' "'terraform version' failed. Something is seriously wrong";
log 'info' "Switching completed";

0 comments on commit 0119322

Please sign in to comment.