For me building "hashicorp/template" from the source was the solution. I was using terragrunt.
git clone https://github.com/hashicorp/terraform-provider-template.git
cd terraform-provider-template
go build
move the binary to terraform plugins directory. You can create the directory if the plugin's directory does not exist.
mv terraform-provider-template ~/.terraform.d/plugins/registry.terraform.io/hashicorp/template/2.2.0/darwin_arm64/terraform-provider-template
Set execution permission to the terraform-provider-template binary file.
chmod +x ~/.terraform.d/plugins/registry.terraform.io/hashicorp/template/2.2.0/darwin_arm64/terraform-provider-template
terraform init
or terragrunt init
from your project folder.