Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libexec/tfenv-resolve-version
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ if [[ "${version_requested}" =~ ^latest-allowed$ ]]; then
;;
'~>'*)
version_without_rightmost="${version_num%.*}";
version_requested="latest:^${version_without_rightmost}";
version_requested="latest:^${version_without_rightmost}\.";
;;
*)
log 'error' "Unsupported version spec: '${version_spec}', only >, >=, <=, and ~> are supported.";
Expand Down
10 changes: 5 additions & 5 deletions test/test_use_latestallowed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ echo "terraform {
tfenv install latest-allowed;
tfenv use latest-allowed;
check_active_version 1.1.9;
) || error_and_proceed 'Latest allowed version does not match';
) || error_and_proceed 'Latest allowed version does not match. Requested: "~> 1.1.0", Expected: 1.1.9';

cleanup || log 'error' 'Cleanup failed?!';

Expand All @@ -78,7 +78,7 @@ echo "terraform {
tfenv install latest-allowed;
tfenv use latest-allowed;
check_active_version 0.13.0-rc1;
) || error_and_proceed 'Latest allowed tagged-version does not match';
) || error_and_proceed 'Latest allowed tagged-version does not match. Requested: "<=0.13.0-rc1", Expected: 0.13.0-rc1';

cleanup || log 'error' 'Cleanup failed?!';

Expand All @@ -93,7 +93,7 @@ echo "terraform {
tfenv install latest-allowed;
tfenv use latest-allowed;
check_active_version 0.15.5;
) || error_and_proceed 'Latest allowed incomplete-version does not match';
) || error_and_proceed 'Latest allowed incomplete-version does not match. Requested: "~> 0.12", Expected: 0.15.5';

cleanup || log 'error' 'Cleanup failed?!';

Expand All @@ -108,7 +108,7 @@ echo 'latest-allowed' > .terraform-version;
(
TFENV_AUTO_INSTALL=true terraform version;
check_active_version 1.0.11;
) || error_and_proceed 'Latest allowed auto-installed version does not match';
) || error_and_proceed 'Latest allowed auto-installed version does not match. Requested: "~> 1.0.0", Expected: 1.0.11';

cleanup || log 'error' 'Cleanup failed?!';

Expand All @@ -124,7 +124,7 @@ echo 'latest-allowed' > chdir-dir/.terraform-version
(
TFENV_AUTO_INSTALL=true terraform -chdir=chdir-dir version;
check_active_version 0.14.11 chdir-dir;
) || error_and_proceed 'Latest allowed version from -chdir does not match';
) || error_and_proceed 'Latest allowed version from -chdir does not match. Requested: "~> 0.14.3", Expected: 0.14.11';

cleanup || log 'error' 'Cleanup failed?!';

Expand Down
Loading