In my case I was not cloning the repository to the build agent in my pipeline. Adding - checkout: self at the very beginning of the job fixed my issue.
- checkout: self
Special thanks to the answer in the following: Azure DevOps Pipeline Terraform Init fail