Monday, January 30, 2023

rebuild terraform deprecated packages like terraform-provider-template or terraform-provider-local

 on a m1 mac os laptop you might run into deprecated terraform packages : 

╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider
│ hashicorp/template: no available releases match the given constraints >=
│ 2.1.0
╵

ERRO[0011] Terraform invocation failed in /Users/]
ERRO[0011] 1 error occurred:
	* exit status 1

To solve, just rebuild it locally on your mac like so for the missing provider: 

cd /tmp
git clone https://github.com/hashicorp/terraform-provider-template.git
cd terraform-provider-template
git checkout v2.1.0
go build 
mkdir -p ${HOME}/.terraform.d/plugins/registry.terraform.io/hashicorp/template/2.1.0/darwin_arm64
mv terraform-provider-template ${HOME}/.terraform.d/plugins/registry.terraform.io/hashicorp/template/2.1.0/darwin_arm64/
chmod u+x ${HOME}/.terraform.d/plugins/registry.terraform.io/hashicorp/template/2.1.0/darwin_arm64/terraform-provider-template