kreuzwerker / m1-terraform-provider-helper

CLI to support with downloading and compiling terraform providers for Mac with M1 chip

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error after compiling

austinflowspace opened this issue · comments

Expected Behavior

tf-m1=m1-terraform-provider-helper install hashicorp/random -v v3.4.3

Actual Behavior

Getting provider data from terraform registry
Getting source code...
Compiling...
2022/12/15 14:06:31 rename /Users/austiin/go/bin/terraform-provider-random /Users/austiin/.terraform.d/plugins/registry.terraform.io/hashicorp/random/3.4.3/darwin_arm64/terraform-provider-random_3.4.3_x5: no such file or directory

Steps to Reproduce (including precondition)

I'm pretty sure this occurred after I complied on a v2.1.2 from a older tf module then went to another folder and asked to use latest so I complied latest. Latest is no longer working and I get the above error when I retry.

It doesn't seem to be creating terraform-provider-random_3.4.3_x5 in the path that it is looking but I don't know enough myself on how terraform stores plugins on the OS.

Screenshot on This Problem (if possible)

Screenshot 2022-12-15 at 2 09 42 PM

Your Environment

  • OS: Ventura 13.0.1 | Apple M1 Max
  • m1-terraform-provider-helper version: Current version: 0.8.0%

FYI: love the tool. Definitely has saved myself having to write a bunch of module.

The module now won't init bc it wants the latest version of random.

Error: Required plugins are not installed │ │ The installed provider plugins are not consistent with the packages selected in the dependency lock file: │ - registry.terraform.io/hashicorp/random: there is no package for registry.terraform.io/hashicorp/random 2.3.1 cached in .terraform/providers │ │ Terraform uses external plugins to integrate with a variety of different infrastructure services. To download the plugins required for this │ configuration, run: │ terraform init

Hi @austinflowspace,
IMO you do not need to build this version of the provider for arm as the binary exists: see here https://github.com/hashicorp/terraform-provider-random/blob/v3.4.3/.goreleaser.yml#L25

And using it via

resource "random_integer" "priority" {
  min = 1
  max = 50000
}

and testing it via

uname -m
arm64
# 
terraform init
terraform apply

works fine on my Mac Apple M1 Pro

Manuel is right.
There is another possibility, though.

@austinflowspace you said that

then went to another folder

Do you need the tf-m1 because one of the providers in the gke-cluster does not have an arm version? Because if not you can also simply disable the tf-m1 (via tf-m1 deactivate) and you should be good to go.

If you are using tf-m1 in your terraform project because another provider does not have an darwin_arm64 binary (e.g. an old AWS provider version) then I am wondering why you need to install the latest terraform-provider-random version...

It doesn't seem to be creating terraform-provider-random_3.4.3_x5 in the path
You are right, because it can't find the compiled binary of terraform-provider-random. Even when I git clone the project and run make build myself, I cannot find the binary...

I got around the error by putting in a requirement to use the latest version of random & null to allow it to use the typical arm64 package that was built for it. Thank you, @mavogel!

@Junkern I used it for an older module that used an older version and found the fix using tf-m1 so when it came up again in the newer module I built I thought, to just use it again. Thank you for your timely response!

terraform {
  required_version = ">= 0.13.0"

  required_providers {
    # google = ">= 3.16, <4.0.0"
    google-beta = {
      source = "hashicorp/google-beta"
      version = ">=4.46.0"
    }
    kubernetes = ">= 2.16.1"
    random     = "3.4.3"
    null       = "3.2.1"
  }
}