Commit 41d57355 authored by Craig Barrett's avatar Craig Barrett

We should automatically use the right version of terraform if tfenv is available

parent 03e96fbd
......@@ -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