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

Fix build command for version 2.x of AWS provider #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

et304383
Copy link

@et304383 et304383 commented Apr 4, 2022

Underlying issue: golang/go#51706

What does this do / why do we need it?

This fixes the install of the AWS provider 2.x due to a bug in Go sys module

How this PR fixes the problem?

Updates the sys module before running the various build commands, only for the command used to compile the AWS provider

What should your reviewer look out for in this PR?

N/A

Check lists

  • Test passed
  • Coding style (indentation, etc)

Which issue(s) does this PR fix?

N/A

@Junkern
Copy link
Contributor

Junkern commented Apr 5, 2022

Thanks for the PR. Are you having issues installing AWS provider?
For me this is working: m1-terraform-provider-helper install hashicorp/aws -v v2.70.0
I am running on go version go1.17.6 darwin/arm64

@et304383
Copy link
Author

et304383 commented Apr 5, 2022

@Junkern

Thanks for the PR. Are you having issues installing AWS provider? For me this is working: m1-terraform-provider-helper install hashicorp/aws -v v2.70.0 I am running on go version go1.17.6 darwin/arm64

Go 1.18 is where the error is thrown. Please see the link I placed in the commit message:

golang/go#51706

@et304383
Copy link
Author

@Junkern can you provide an update? Any reason this can't be merged? I honestly don't know how I'd resolve these failing tests.

@thiagolsfortunato
Copy link

I had the same problem when installing hashicorp/random v3.1.0, to fixed it I ran:

$ m1-terraform-provider-helper install hashicorp/random -v v3.1.0 --custom-build-command "go get -u golang.org/x/sys && gofmt -s -w tools && go mod vendor && make build -mod=mod"
Repo: https://github.com/hashicorp/terraform-provider-random
GitRepo: https://github.com/hashicorp/terraform-provider-random
HEAD is now at db6fc41 v3.1.0
2022/04/19 12:12:45 version: v3.1.0
Using custom build command: "go get -u golang.org/x/sys && gofmt -s -w tools && go mod vendor && make build -mod=mod
"Cancel
go: upgraded golang.org/x/sys v0.0.0-20200523222454-059865788121 => v0.0.0-20220412211240-33da011f77ad
go: downloading github.com/hashicorp/terraform-plugin-docs v0.4.0
go: downloading github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.3
go: downloading github.com/dustinkirkland/golang-petname v0.0.0-20170105215008-242afa0b4f8a
go: downloading github.com/hashicorp/errwrap v1.1.0
go: downloading github.com/hashicorp/go-uuid v1.0.2
go: downloading github.com/mattn/go-colorable v0.1.8
go: downloading github.com/mitchellh/cli v1.1.2
go: downloading github.com/hashicorp/terraform-exec v0.13.0
go: downloading github.com/hashicorp/terraform-json v0.8.0
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading github.com/Masterminds/sprig v2.22.0+incompatible
go: downloading github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310
go: downloading github.com/bgentry/speakeasy v0.1.0
go: downloading github.com/fatih/color v1.7.0
go: downloading github.com/posener/complete v1.1.1
go: downloading github.com/russross/blackfriday v1.6.0
go: downloading github.com/zclconf/go-cty v1.7.1
go: downloading github.com/Masterminds/goutils v1.1.0
go: downloading github.com/Masterminds/semver v1.5.0
go: downloading github.com/google/uuid v1.1.2
go: downloading github.com/huandu/xstrings v1.3.2
go: downloading github.com/imdario/mergo v0.3.11
go: downloading github.com/mitchellh/copystructure v1.0.0
go: downloading golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
go: downloading github.com/hashicorp/go-hclog v0.15.0
go: downloading github.com/hashicorp/go-plugin v1.4.0
go: downloading github.com/hashicorp/terraform-plugin-go v0.2.1
go: downloading google.golang.org/grpc v1.32.0
go: downloading github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
go: downloading github.com/hashicorp/go-multierror v1.0.0
go: downloading github.com/mitchellh/reflectwalk v1.0.1
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/mitchellh/go-testing-interface v1.0.4
go: downloading github.com/mitchellh/mapstructure v1.1.2
go: downloading github.com/hashicorp/go-checkpoint v0.5.0
go: downloading github.com/hashicorp/go-cleanhttp v0.5.1
go: downloading github.com/hashicorp/go-getter v1.5.0
go: downloading github.com/hashicorp/go-version v1.2.1
go: downloading golang.org/x/text v0.3.3
go: downloading github.com/hashicorp/hcl/v2 v2.3.0
go: downloading github.com/hashicorp/logutils v1.0.0
go: downloading github.com/vmihailenco/msgpack v4.0.4+incompatible
go: downloading golang.org/x/net v0.0.0-20200707034311-ab3426394381
go: downloading github.com/golang/protobuf v1.4.2
go: downloading github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d
go: downloading github.com/oklog/run v1.0.0
go: downloading google.golang.org/appengine v1.6.6
go: downloading github.com/google/go-cmp v0.5.2
go: downloading google.golang.org/genproto v0.0.0-20200711021454-869866162049
go: downloading google.golang.org/protobuf v1.25.0
go: downloading github.com/agext/levenshtein v1.2.2
go: downloading github.com/apparentlymart/go-textseg v1.0.0
go: downloading github.com/mitchellh/go-wordwrap v1.0.0
go: downloading cloud.google.com/go/storage v1.10.0
go: downloading github.com/aws/aws-sdk-go v1.25.3
go: downloading cloud.google.com/go v0.61.0
go: downloading github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d
go: downloading github.com/hashicorp/go-safetemp v1.0.0
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading github.com/ulikunitz/xz v0.5.8
go: downloading google.golang.org/api v0.29.0
go: downloading github.com/apparentlymart/go-textseg/v12 v12.0.0
go: downloading github.com/googleapis/gax-go/v2 v2.0.5
go: downloading github.com/jstemmer/go-junit-report v0.9.1
go: downloading golang.org/x/lint v0.0.0-20200302205851-738671d3881b
go: downloading golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed
go: downloading go.opencensus.io v0.22.4
go: downloading github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af
go: downloading github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
go: downloading golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
go: downloading golang.org/x/mod v0.3.0
go: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
==> Checking that code complies with gofmt requirements...
go install
2022/04/19 12:13:00 Move from /Users/thiago.fortunato/go/bin/terraform-provider-random to /Users/thiago.fortunato/.terraform.d/plugins/registry.terraform.io/hashicorp/random/3.1.0/darwin_arm64/terraform-provider-random_3.1.0_x5

@Junkern
Copy link
Contributor

Junkern commented Apr 20, 2022

@et304383 sorry for the long delay. I am actually torn between the two decisions... on the one hand it is not a problem of this tool, but of the provider and go itself.
On the other hand, we would like the tool to be as easy to use as possible...
Maybe a big note in the README would be a good trade-off?
What is your thought on that?

@et304383
Copy link
Author

@Junkern I agree. Maintaining this list going forward will be challenging as more bugs are introduced in newer versions of go, etc. I think the custom build command was a huge leap, but now it seems that we're going to rely more and more on that going forward.

I'm almost thinking that it's time to make it (custom build command) a mandatory argument as there's no way you can keep this maintained going forward. Maybe coupling it with some kind of file structure that users could maintain that would define the build command for various providers/versions? A default location for this file, then users can edit once if a new issue arrises, and then move on.

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

Successfully merging this pull request may close these issues.

None yet

3 participants