Skip to content

Commit

Permalink
Add test to reproduce #354
Browse files Browse the repository at this point in the history
  • Loading branch information
OJFord committed Feb 10, 2024
1 parent 1ccfddb commit 934a002
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/test_use_minrequired.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ echo 'min-required' > .terraform-version;
cleanup || log 'error' 'Cleanup failed?!';


log 'info' '### Install min-required with TFENV_AUTO_INSTALL & -chdir';
log 'info' '### Install min-required with TFENV_AUTO_INSTALL & -chdir with rel path';

minv='1.1.0';

Expand All @@ -138,6 +138,24 @@ echo 'min-required' > chdir-dir/.terraform-version

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


log 'info' '### Install min-required with TFENV_AUTO_INSTALL & -chdir with abs path';

minv='1.2.3';

mkdir -p chdir-dir
echo "terraform {
required_version = \">=${minv}\"
}" >> chdir-dir/min_required.tf;
echo 'min-required' > chdir-dir/.terraform-version

(
TFENV_AUTO_INSTALL=true terraform -chdir="${PWD}/chdir-dir" version;
check_active_version "${minv}" chdir-dir;
) || error_and_proceed 'Min required version from -chdir does not match';

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

if [ "${#errors[@]}" -gt 0 ]; then
log 'warn' '===== The following use_minrequired tests failed =====';
for error in "${errors[@]}"; do
Expand Down

0 comments on commit 934a002

Please sign in to comment.