backport of commit 905e371607112dc00c55cae53c907b989a651f61 Co-authored-by: Michael Zalimeni <michael.zalimeni@hashicorp.com>