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

Panic with Go version go1.17.6 darwin/arm64

ChapChap opened this issue · comments

On my macbook pro M1, that I restored from a time machine backup, I encounter some gRPC rendom bugs.
I decided to give this tool a try.

I wasn't able to install hashicorp/aws provider so I tried updating my go version
Now, I get a panic on every installation attempt
Here you can find my attempts

22:18 ❯ m1-terraform-provider-helper install hashicorp/aws
Cancel
panic: Get "https://registry.terraform.io/v1/providers/hashicorp/aws": context canceled

goroutine 1 [running]:
github.com/kreuzwerker/m1-terraform-provider-helper/internal/app.getProviderData({0x16bd77425, 0xd})
	/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/internal/app/install.go:79 +0x304
github.com/kreuzwerker/m1-terraform-provider-helper/internal/app.(*App).Install(0x14000124a08, {0x16bd77425, 0xd}, {0x0, 0x0}, {0x0, 0x0})
	/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/internal/app/install.go:239 +0x30
github.com/kreuzwerker/m1-terraform-provider-helper/cmd.installCmd.func1(0x140001b4f00, {0x1400019a9d0, 0x1, 0x1})
	/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/cmd/install.go:26 +0xcc
github.com/spf13/cobra.(*Command).execute(0x140001b4f00, {0x1400019a9b0, 0x1, 0x1})
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:852 +0x668
github.com/spf13/cobra.(*Command).ExecuteC(0x140001b4500)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x404
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
main.main()
	/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/cmd/m1-terraform-provider-helper/main.go:11 +0x24
22:19 ❯ brew reinstall kreuzwerker/taps/m1-terraform-provider-helper
==> Downloading https://github.com/kreuzwerker/m1-terraform-provider-helper/releases/download/0.5.1/m1-terraform-provider
Already downloaded: /Users/antoinechapusot/Library/Caches/Homebrew/downloads/0f6cd86f6d6ae5ed6016b6f38237bf41e7b73d1f50b64dbd9bc0152ee7fe44af--m1-terraform-provider-helper_0.5.1_Darwin_arm64.tar.gz
==> Reinstalling kreuzwerker/taps/m1-terraform-provider-helper
🍺  /opt/homebrew/Cellar/m1-terraform-provider-helper/0.5.1: 6 files, 10.2MB, built in 1 second
==> Running `brew cleanup m1-terraform-provider-helper`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
22:19 ❯ m1-terraform-provider-helper install hashicorp/aws
Repo: https://github.com/hashicorp/terraform-provider-aws
GitRepo: https://github.com/hashicorp/terraform-provider-aws
HEAD is now at b2290be9a4 Merge pull request #23346 from PatMyron/tflint
2022/02/24 22:19:32 No version specified, pulling and checking out main branch
fatal: ref refs/remotes/origin/HEAD is not a symbolic ref
Already up to date.
cd providerlint && go install .
cd tools && go install github.com/bflad/tfproviderdocs
cd tools && go install github.com/client9/misspell/cmd/misspell
cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint
cd tools && go install github.com/katbyte/terrafmt
cd tools && go install github.com/terraform-linters/tflint
Cancel
cd tools && go install github.com/pavius/impi/cmd/impi
cd tools && go install github.com/hashicorp/go-changelog/cmd/changelog-build
==> Fixing source code with gofmt...
gofmt -s -w ./internal ./providerlint/helper ./providerlint/main.go ./providerlint/passes
stat ./tools.go: no such file or directory
2022/02/24 22:19:37 Bash code did not run successfully: exit status 2
22:20 ❯ m1-terraform-provider-helper status
Status: Active
Local providers are used
22:20 ❯ m1-terraform-provider-helper list
22:20 ❯ m1-terraform-provider-helper install hashicorp/template
Cancel
panic: Get "https://registry.terraform.io/v1/providers/hashicorp/template": context canceled

goroutine 1 [running]:
github.com/kreuzwerker/m1-terraform-provider-helper/internal/app.getProviderData({0x16aea741d, 0x12})
	/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/internal/app/install.go:79 +0x304
github.com/kreuzwerker/m1-terraform-provider-helper/internal/app.(*App).Install(0x140000a4a08, {0x16aea741d, 0x12}, {0x0, 0x0}, {0x0, 0x0})
	/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/internal/app/install.go:239 +0x30
github.com/kreuzwerker/m1-terraform-provider-helper/cmd.installCmd.func1(0x140001b6f00, {0x1400019a9d0, 0x1, 0x1})
	/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/cmd/install.go:26 +0xcc
github.com/spf13/cobra.(*Command).execute(0x140001b6f00, {0x1400019a9b0, 0x1, 0x1})
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:852 +0x668
github.com/spf13/cobra.(*Command).ExecuteC(0x140001b6500)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x404
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
main.main()
	/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/cmd/m1-terraform-provider-helper/main.go:11 +0x24

I am also running on go version go1.17.6 darwin/arm64 and it works fine for me.

The only thing that I am able to see that it looks like it is somehow unable to do a GET https://registry.terraform.io/v1/providers/hashicorp/aws.

Are you behind a proxy/vpn? Do other network calls work fine? Can you do a curl https://registry.terraform.io/v1/providers/hashicorp/aws?

@ChapChap in case you did not see my comment :)

Hi @Junkern,

I can curl https://registry.terraform.io/v1/providers/hashicorp/aws

19:17 ❯ curl https://registry.terraform.io/v1/providers/hashicorp/aws >/dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  241k    0  241k    0     0  1162k      0 --:--:-- --:--:-- --:--:-- 1201k
19:17 ❯ echo $?
0

But still can't run m1-terraform-provider-helper install hashicorp/aws
Yet this time, I didn't get the same issue :

==> Fixing source code with gofmt...
gofmt -s -w ./internal ./providerlint/helper ./providerlint/main.go ./providerlint/passes
stat ./tools.go: no such file or directory
2022/03/04 19:19:02 Bash code did not run successfully: exit status 2

It successfully git clone the repo and go install the dependencies but go fmt failed.

Is this step can be skipped ?

This step cannot be skipped as it is part of compiling and building the provider.
I can reproduce the issue on my local machine.
The reason is that the provider has released a new version (4.0.0) 25 days ago and now has new commands to build the provider: make tools && make build.

Until I releaese a new version of m1-terraform-provider-helper which has those commands build-in, you can use the custom-build-command parameter: m1-terraform-provider-helper install hashicorp/aws --custom-build-command "make tools && make build"