Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] missing build for Darwin Arm64 #13

Open
sigua-cs opened this issue Aug 26, 2022 · 3 comments
Open

[Question] missing build for Darwin Arm64 #13

sigua-cs opened this issue Aug 26, 2022 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@sigua-cs
Copy link

Hello,
There is a missing build for Darwin Arm64 in releases, even though it's included in the goreleaser configuration.

The error message:
Provider registry.terraform.io/rhythmictech/errorcheck v3.0.0 does not have a package available for your current platform, darwin_arm64.

Any chance to investigate it?

@sigua-cs sigua-cs added the question Further information is requested label Aug 26, 2022
@sblack4
Copy link
Contributor

sblack4 commented Aug 26, 2022

It's possible to do checks without creating a custom provider now. Will https://github.com/rhythmictech/terraform-terraform-errorcheck work?

@smiller171
Copy link
Contributor

The errorcheck module is generally going to be better than the provider, but I think all that may need to happen is to run a new build. I don't think darwin_arm64 existed yet when the last release was cut.

@sblack4 sblack4 changed the title [Question] [Question] missing build for Darwin Arm64 Feb 23, 2023
@GuiuMateu
Copy link

GuiuMateu commented Oct 25, 2023

If you cannot migrate all "errorcheck" resources from the provider to the module, as in my case because I have more than 1000 module instances using this provider, you can compile your version for Darwin ARM64 by following these steps:

  1. Clone the project repository.
  2. Checkout the desired version tag.
  3. Modify the dependencies in provider.go.
import (
-  "github.com/hashicorp/terraform/helper/schema"
+  "github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
  1. Modify the dependencies in main.go.
import (
-  "github.com/hashicorp/terraform/plugin"
-  "github.com/hashicorp/terraform/terraform"
+  "github.com/hashicorp/terraform-plugin-sdk/plugin"
+  "github.com/hashicorp/terraform-plugin-sdk/terraform"
)
  1. Modify resource_isValid.go.
import (
   "fmt"
   "strconv"

-  "github.com/hashicorp/terraform/helper/schema"
+  "github.com/hashicorp/terraform-plugin-sdk/helper/schema"
 )
  1. Compile following the documentation at https://www.hashicorp.com/blog/writing-custom-terraform-providers.
$ go build -o terraform-provider-errorcheck

Once you have the provider compiled for Darwin ARM64, you need to instruct Terraform to look for this provider on the local disk instead of registry.terraform.io. To do this, follow these steps (+ Doc):

  1. Create the ~/.terraformrc file in the user's home directory and add this configuration. Replace <username> with the correct username.
provider_installation {
  filesystem_mirror {
    path    = "/Users/<username>/.terraform.d/plugins"
    include = ["registry.terraform.io/rhythmictech/errorcheck"]
  }
  direct {
    exclude = ["registry.terraform.io/rhythmictech/errorcheck"]
  }
}
  1. Create the directory ~/.terraform.d/plugins/registry.terraform.io/rhythmictech/errorcheck/X.Y.Z/darwin_arm64, where X.Y.Z is the provider's version.
  2. Copy the compiled binary from the previous steps into the darwin_arm64 directory.
  3. Add the suffix _vX.Y.Z to the binary, where X.Y.Z is the provider's version.
mv terraform-provider-errorcheck terraform-provider-errorcheck_v3.0.0

With these steps, you can use the locally compiled rhythmictech/errorcheck provider for Darwin ARM64.

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants