This is important so that you know what terraform version to set without accidentally updating the client's terraform state, which can potentially break existing clients and CI/CD which will no longer be able to run using the older client version
"
# used by usage() in lib/utils.sh
# shellcheck disable=SC2034
usage_args="<backend.tf>"
help_usage "$@"
max_args 1"$@"
backend_tf_file="${1:-$PWD/backend.tf}"
if ! [ -f "$backend_tf_file"];then
die "File not found: $backend_tf_file - check you are specifying the right path to the .tf file containing the backend definition"
fi
log "Parsing $backend_tf_file for bucket and prefix"
bucket="$(grep -m1 '^[[:space:]]*bucket[[:space:]]*=.*'"$backend_tf_file"| sed 's/.*=//; s/[[:space:]]//g; s/"//g'|| die "Failed to parse bucket from $backend_tf_file")"
prefix="$(grep -m1 '^[[:space:]]*prefix[[:space:]]*=.*'"$backend_tf_file"| sed 's/.*=//; s/[[:space:]]//g; s/"//g'|| :)"# || die "Failed to parse bucket from $backend_tf_file")"
log "Fetching and parsing bucket '$bucket' file '$prefix${prefix+/}default.tfstate'"