Skip to content

Commit 3602593

Browse files
committed
Add support for tfenv
1 parent 9d557bb commit 3602593

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.1.3 (12/04/2017)
2+
3+
* Support the use of .terraform-version file in components when in the presence of [tfenv](https://github.com/kamatama41/tfenv)
4+
15
## 1.1.2 (06/04/2017)
26

37
* Provide a case for import that requires the variable file parameters

bin/terraform.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
##
99
# Set Script Version
1010
##
11-
readonly script_ver="1.1.2";
11+
readonly script_ver="1.1.3";
1212

1313
##
1414
# Standardised failure function
@@ -289,9 +289,16 @@ rm -rf ${component_path}/.terraform/terraform.tfstate*;
289289

290290
# Make sure we're running in the component directory
291291
cd "${component_path}";
292-
293292
readonly component_name=$(basename ${component_path});
294293

294+
# Check for presence of tfenv (https://github.com/kamatama41/tfenv)
295+
# and a .terraform-version file. If both present, ensure required
296+
# version of terraform for this component is installed automagically.
297+
tfenv_bin="$(which tfenv 2>/dev/null)";
298+
if [[ -n "${tfenv_bin}" && -x "${tfenv_bin}" && -f .terraform-version ]]; then
299+
${tfenv_bin} install;
300+
fi;
301+
295302
if [ -f "pre_apply.sh" ]; then
296303
bash pre_apply.sh "${region}" "${environment}" "${action}";
297304
((status=status+"$?"));

0 commit comments

Comments
 (0)