Harish J
Harish J

Reputation: 168

Terraform aws provider issue for Mac M1 Installation

I use Terraform v1.0.11 on my Mac M1. When I try to run terraform init, I run into the following error:

Initializing provider plugins...
- Finding latest version of hashicorp/local...
- Finding latest version of hashicorp/null...
- Reusing previous version of hashicorp/aws from the dependency lock file
- Finding latest version of hashicorp/random...
- Finding latest version of hashicorp/template...
- Finding latest version of hashicorp/external...
- Installing hashicorp/external v2.1.0...
- Installed hashicorp/external v2.1.0 (signed by HashiCorp)
- Installing hashicorp/local v2.1.0...
- Installed hashicorp/local v2.1.0 (signed by HashiCorp)
- Installing hashicorp/null v3.1.0...
- Installed hashicorp/null v3.1.0 (signed by HashiCorp)
- Using previously-installed hashicorp/aws v3.53.0
- Installing hashicorp/random v3.1.0...
- Installed hashicorp/random v3.1.0 (signed by HashiCorp)
╷
│ Error: Incompatible provider version
│ 
│ Provider registry.terraform.io/hashicorp/template v2.2.0 does not have a package available for your current platform, darwin_arm64.
│ 
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider
│ may have different platforms supported.

My provider provider info:

terraform {
  required_providers {
    aws = {
      version = "~> 3.53.0"
    }
  }
}

I understand that the provider version is not available for M1. Is there any workaround for this?

I tried using this: https://github.com/hashicorp/terraform/issues/27257#issuecomment-754777716, but with provider version 3.53.0, but running into issues.

Is there any workaround for this problem?

Upvotes: 1

Views: 6987

Answers (2)

Raghu Reddy
Raghu Reddy

Reputation: 672

I was able to resolve the issue by following below steps.

brew install kreuzwerker/taps/m1-terraform-provider-helper
m1-terraform-provider-helper activate

You might have to delete the .terraform.lock.hcl file if you're encountering checksum errors, and then run terraform plan and terraform apply again.

References: m1-terraform-provider-helper

Upvotes: 0

Nic
Nic

Reputation: 357

You can use what they say on this answer to run on your M1 which is to compile the resource for your architecture.

However template is a deprecated resource and you can use templatefile which works correctly on M1.

Upvotes: 1

Related Questions