By giving a try to these different answers, here is what I ran to install a Terraform 1.3.3 version that works under my Mac M1 and get rid of this error:
I agree with @stuart-c - For those landing on this article in 2022/2023, please, make sure you stop using the Template Provider as it has been deprecated.
$ m1-terraform-provider-helper install hashicorp/template -v v2.2.0
Getting provider data from terraform registry
Getting source code...
FATA[0001] Bash execution did not run successfully: exit status 1.
Output:
Im Moment auf keinem Branch.
Bitte geben Sie den Branch an, welchen Sie zusammenfĂźhren mĂśchten.
Siehe git-pull(1) fĂźr weitere Details.
git pull <Remote-Repository> <Branch>
I know this is an old post. However, I think this might be helpful for someone.
Like @lpossamai2 said in his comment above, donât use template_file anymore and replace it with templatefile in all your modules. Then run the following:
rm -rf .terraform
rm -f .terraform.lock.hcl
terraform init # this one will fail again, with the same error as above, but it will give you access to the state
for i in `terraform state list | grep template_file`; do terraform state rm $i; done
terraform init # this one will work now
terraform apply
Just make sure you have replaced your template_file in all your modules. Otherwise, you will hit the same problem. And check the state before you run the for loop, just in case you called any resource/module a template_file
ok so this is weird. just ran a terraform plan/apply Terraform 0.14.4 on my m1 Ventura Version 13.2 (22D49) and it worked even though the template provider has not been updated to dawin_arm64 : Terraform Provider Template v2.2.0 Binaries | HashiCorp Releases
Hi, for us any of it did not work (except crippling template_file plugin worked, but it is not really nice solution). We removed all references to template_file from code which left empty references in state file for some reason, e.g.
Which did not pose any issue on non-darwin_arm64 terraform binaries, but on M1 it fails. There is no clean way to fix this issue, but to go to state file and remove these empty references manually. They do not appear in terraform state list so there is really nothing to do. This seems like rather critical bug to me
Terraformâs code normally removes these resource blocks when the instances collection becomes empty. If you are able to figure out a sequence of operations which leaves one behind like this, that would be worth a bug report.
Hey @AyushKumar55, though the m1-terraform-provider-helper installed the plugins to local machine, for some reason terraform did not pick it up / use it while doing a terraform init.
This command tells Homebrew to install the package defined in the local m1-terraform-provider-helper.rb formula file. The --build-from-source flag is typically used to compile the package from source
Steps to install terraform of your choice of version using Homebrew:
Now, while executing terraform init I faced the below error when I´m working in a MAC with M1/M2 chip in it,
Error: Incompatible provider version
â
â Provider Terraform Registry 113 v2.2.0 does not have a
â package available for your current platform, darwin_arm64.