Skip to content

Commit 23d6cbc

Browse files
OJFordZordrak
authored andcommitted
Add test to reproduce #354
1 parent 978ef3a commit 23d6cbc

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/test_use_minrequired.sh

+19-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ echo 'min-required' > .terraform-version;
121121
cleanup || log 'error' 'Cleanup failed?!';
122122

123123

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

126126
minv='1.1.0';
127127

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

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

141+
142+
log 'info' '### Install min-required with TFENV_AUTO_INSTALL & -chdir with abs path';
143+
144+
minv='1.2.3';
145+
146+
mkdir -p chdir-dir
147+
echo "terraform {
148+
required_version = \">=${minv}\"
149+
}" >> chdir-dir/min_required.tf;
150+
echo 'min-required' > chdir-dir/.terraform-version
151+
152+
(
153+
TFENV_AUTO_INSTALL=true terraform -chdir="${PWD}/chdir-dir" version;
154+
check_active_version "${minv}" chdir-dir;
155+
) || error_and_proceed 'Min required version from -chdir does not match';
156+
157+
cleanup || log 'error' 'Cleanup failed?!';
158+
141159
if [ "${#errors[@]}" -gt 0 ]; then
142160
log 'warn' '===== The following use_minrequired tests failed =====';
143161
for error in "${errors[@]}"; do

0 commit comments

Comments
 (0)