From ad3a7e71eaff22e27f830f2f373d4896815b5726 Mon Sep 17 00:00:00 2001 From: Jean-Frederic Date: Tue, 25 Oct 2022 16:40:13 +0200 Subject: [PATCH] Add graceful fail for min-required Even when setting `TFENV_TERRAFORM_VERSION` to `min-required`, we might prefer to fallback on the normal inference method rather than a hard fail. Resolves #353 --- lib/tfenv-version-name.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tfenv-version-name.sh b/lib/tfenv-version-name.sh index 3975769..e57ddeb 100644 --- a/lib/tfenv-version-name.sh +++ b/lib/tfenv-version-name.sh @@ -33,7 +33,9 @@ function tfenv-version-name() { TFENV_VERSION="${potential_min_required}" \ TFENV_VERSION_SOURCE='terraform{required_version}'; else - log 'error' 'Specifically asked for min-required via terraform{required_version}, but none found'; + log 'debug' 'Specifically asked for min-required via terraform{required_version}, but none found, falling back to normal detection'; + TFENV_TERRAFORM_VERSION=""; + echo $(tfenv-version-name); fi; fi;