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 7
7
* Fix to not use 0.12.22 during testing which reports its version incorrectly
8
8
* Introduce tfenv-resolve-version to deduplicate translation of requested version into actual version
9
9
* 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
10
11
11
12
## 1.0.2 (October 29, 2019)
12
13
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
138
138
TFENV_ARCH=arm tfenv install 0.7.9
139
139
```
140
140
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
+
141
151
##### ` TFENV_CURL_OUTPUT `
142
152
143
153
Integer (Default: 2)
Original file line number Diff line number Diff line change @@ -83,6 +83,15 @@ TFENV_VERSION="$(tfenv-version-name)" \
83
83
};
84
84
export TFENV_VERSION;
85
85
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
+
86
95
TF_BIN_PATH=" ${TFENV_ROOT} /versions/${TFENV_VERSION} /terraform" ;
87
96
export PATH=" ${TF_BIN_PATH} :${PATH} " ;
88
97
log ' debug' " TF_BIN_PATH added to PATH: ${TF_BIN_PATH} " ;
Original file line number Diff line number Diff line change 100
100
[ -z " ${TFENV_VERSION} " ] \
101
101
&& log ' error' " Version could not be resolved (set by ${TFENV_VERSION_FILE} or tfenv use <version>)" ;
102
102
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} )" ;
107
105
fi ;
106
+
107
+ echo " ${TFENV_VERSION} " ;
108
+
You can’t perform that action at this time.
0 commit comments