diff --git a/libexec/tfenv-min-required b/libexec/tfenv-min-required index d54169d..e550a98 100755 --- a/libexec/tfenv-min-required +++ b/libexec/tfenv-min-required @@ -74,8 +74,7 @@ see https://www.terraform.io/docs/configuration/terraform.html for details'; find_min_required() { local root="${1}"; - # Only grep recursively if we cannot a required version in base of directory - versions="$( echo $(grep -h required_version --include '*tf' "${root}"/* || grep -h -R required_version --include '*tf' "${root}"/*) | grep -o '\([0-9]\+\.\?\)\{2,3\}\(-[a-z]\+[0-9]\+\)\?')"; + versions="$( echo $(grep -h required_version "${root}"/*.tf 2>/dev/null ) | grep -o '\([0-9]\+\.\?\)\{2,3\}\(-[a-z]\+[0-9]\+\)\?')"; if [[ "${versions}" =~ ([~=!<>]{0,2}[[:blank:]]*[0-9]+[0-9.]+)[^0-9]*(-[a-z]+[0-9]+)? ]]; then found_min_required="${BASH_REMATCH[1]}${BASH_REMATCH[2]}"