Commit 5bb97e91 authored by Devin Sylva's avatar Devin Sylva

Merge branch 'cb-tfenv-auto-switch' into 'master'

Automatically use the right version of terraform

See merge request !521
parents 03e96fbd 41d57355
......@@ -2,6 +2,7 @@
_NORM="\033[0m"
_CYN="\033[0;36m"
_YELLOW="\033[0;33m"
# shellcheck disable=SC2034
_BRED="\033[1;31m"
if [[ -z ${environment:-""} ]]; then
......
......@@ -15,8 +15,15 @@ else
fi
if [[ "$installed_version" != "$required_version" ]]; then
echo -e "${_BRED}!!! WARNING !!!${_NORM}"
echo "You are using the wrong version ($installed_version) of Terraform."
echo "Please install version $required_version or proceed at your own risk, press enter to continue."
read -rp ""
if [[ -x "$(which tfenv)" ]]; then
echo -e "${_YELLOW}!!! NOTE !!!${_NORM}"
echo "Setting terraform to use version ${required_version}."
echo "Update the `.terraform-version` file(s) to use a different version"
tfenv use "${required_version}"
else
echo -e "${_BRED}!!! WARNING !!!${_NORM}"
echo "You are using the wrong version ($installed_version) of Terraform."
echo "Please install version $required_version or proceed at your own risk, press enter to continue."
read -rp ""
fi
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment