File tree Expand file tree Collapse file tree 4 files changed +25
-4
lines changed
Expand file tree Collapse file tree 4 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 77 * Fix to not use 0.12.22 during testing which reports its version incorrectly
88 * Introduce tfenv-resolve-version to deduplicate translation of requested version into actual version
99 * README.md updates
10+ * Fix #176 - New parameter TFENV_AUTO_INSTALL to handle the version specified by ` use ` or a ` .terraform-version ` file not being installed
1011
1112## 1.0.2 (October 29, 2019)
1213
Original file line number Diff line number Diff line change @@ -138,6 +138,16 @@ Specify architecture. Architecture other than the default amd64 can be specified
138138TFENV_ARCH=arm tfenv install 0.7.9
139139```
140140
141+ ##### ` TFENV_AUTO_INSTALL `
142+
143+ String (Default: true)
144+
145+ Should tfenv automatically install terraform if the version specified by defaults or a .terraform-version file is not currently installed.
146+
147+ ``` console
148+ TFENV_AUTO_INSTALL=false terraform plan
149+ ```
150+
141151##### ` TFENV_CURL_OUTPUT `
142152
143153Integer (Default: 2)
Original file line number Diff line number Diff line change @@ -83,6 +83,15 @@ TFENV_VERSION="$(tfenv-version-name)" \
8383 };
8484export TFENV_VERSION;
8585
86+ if [ ! -d " ${TFENV_ROOT} /versions/${TFENV_VERSION} " ]; then
87+ if [ " ${TFENV_AUTO_INSTALL:- true} " == " true" ]; then
88+ log ' info' " version '${TFENV_VERSION} ' is not installed (set by $( tfenv-version-file) ). Installing now as TFENV_AUTO_INSTALL==true" ;
89+ tfenv-install;
90+ else
91+ log ' error' " version '${TFENV_VERSION} ' was requested, but not installed and TFENV_AUTO_INSTALL is not 'true'" ;
92+ fi ;
93+ fi ;
94+
8695TF_BIN_PATH=" ${TFENV_ROOT} /versions/${TFENV_VERSION} /terraform" ;
8796export PATH=" ${TF_BIN_PATH} :${PATH} " ;
8897log ' debug' " TF_BIN_PATH added to PATH: ${TF_BIN_PATH} " ;
Original file line number Diff line number Diff line change 100100[ -z " ${TFENV_VERSION} " ] \
101101 && log ' error' " Version could not be resolved (set by ${TFENV_VERSION_FILE} or tfenv use <version>)" ;
102102
103- if [ -d " ${TFENV_ROOT} /versions/${TFENV_VERSION} " ]; then
104- echo " ${TFENV_VERSION} " ;
105- else
106- log ' warn' " version '${TFENV_VERSION} ' is not installed (set by ${TFENV_VERSION_FILE} )" ;
103+ if [ ! -d " ${TFENV_ROOT} /versions/${TFENV_VERSION} " ]; then
104+ log ' debug' " version '${TFENV_VERSION} ' is not installed (set by ${TFENV_VERSION_FILE} )" ;
107105fi ;
106+
107+ echo " ${TFENV_VERSION} " ;
108+
You can’t perform that action at this time.
0 commit comments