Skip to content

Commit b80e3ce

Browse files
OJFordZordrak
authored andcommitted
Add test to reproduce #354
1 parent ca62417 commit b80e3ce

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/test_use_minrequired.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ echo 'min-required' > .terraform-version;
8080
cleanup || log 'error' 'Cleanup failed?!';
8181

8282

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

8585
minv='1.1.0';
8686

@@ -97,6 +97,24 @@ echo 'min-required' > chdir-dir/.terraform-version
9797

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

100+
101+
log 'info' '### Install min-required with TFENV_AUTO_INSTALL & -chdir with abs path';
102+
103+
minv='1.2.3';
104+
105+
mkdir -p chdir-dir
106+
echo "terraform {
107+
required_version = \">=${minv}\"
108+
}" >> chdir-dir/min_required.tf;
109+
echo 'min-required' > chdir-dir/.terraform-version
110+
111+
(
112+
TFENV_AUTO_INSTALL=true terraform -chdir="${PWD}/chdir-dir" version;
113+
check_active_version "${minv}" chdir-dir;
114+
) || error_and_proceed 'Min required version from -chdir does not match';
115+
116+
cleanup || log 'error' 'Cleanup failed?!';
117+
100118
if [ "${#errors[@]}" -gt 0 ]; then
101119
log 'warn' '===== The following use_minrequired tests failed =====';
102120
for error in "${errors[@]}"; do

0 commit comments

Comments
 (0)