Hey, team!
I'm trying to contribute but unfortunately tests are failing out of the gate. I haven't made any modifications to my fork of the repo at all. I cloned then ran go get github.com/nathanielks/terraform-provider-aws to download it.
Terraform v0.10.7
https://gist.github.com/nathanielks/8e2ac160c09258c4ece0ccb2f097a1ae
Tests should pass as I pulled off of master which should be stable.
Tests are failing with error:
terraform-provider-aws/main.go:10: cannot use "github.com/terraform-providers/terraform-provider-aws/aws".Provider (type func() "github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/terraform".ResourceProvider) as type "github.com/nathanielks/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin".ProviderFunc in field value
Please list the steps required to reproduce the issue, for example:
go get github.com/nathanielks/terraformAre there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
Hi @nathanielks . I get the same error trying to build a plugin for terraform. Also on a fresh clone, on a commit that I can see passes travis tests!
./main.go:10:15: cannot use "github.com/f5devcentral/terraform-provider-bigip/bigip".Provider (type func() "github.com/f5devcentral/terraform-provider-bigip/vendor/github.com/hashicorp/terraform/terraform".ResourceProvider) as type "terraform-provider-bigip/vendor/github.com/hashicorp/terraform/plugin".ProviderFunc in field value
Hi folks,
As a quick review:
Thanks!
@Ninir I think I found at least some of the problem. When I got the error reported above I did:
A1 clone github.com/f5devcentral/terraform-provider-bigip into GOPATH/src/terraform-provider-bigip
A2 execute go build
A3 error
Just now I did
B1 go get github.com/f5devcentral/terraform-provider-bigip
B2 cd into GOPATH/src/github.com/f5devcentral/terraform-provider-bigip
B3 execute go build
B4 success
It seems I got the dir structure convention in go wrong (this is my first attempt to build go code). It has to be as in B2, not A1
I can confirm @jwermuth. I had to rename the directory to $GOPATH/src/github.com/terraform-providers/terraform-provider-aws instead of $GOPATH/src/github.com/nathanielks/terraform-provider-aws.
@Ninir can confirm my fork is in sync and am currently using Go 1.9.1.
I had the same problem.
After refresh vendor in terraform-provider-aws/vendor/ I got working make build command.
@nathanielks I'm stuck on this problem as well. Did you figure out a work-around? @pawelsocha what do you mean by a vendor "refresh"?
I forked 'terraform-providers/terraform-provider-aws' under my $GOPATH/src/github.com. It builds and allows me to do my provider development.
Maybe the README section: "Developing the Provider" meant to include that one should fork in the same directory location as specified under "Building the Provider"....
@thomaswhitcomb I'm trying to reproduce the problem on a new computer.
Okey, I create full path in GOPATH
and now everything works o_O
> echo $GOPATH
/Users/psocha/go/
> pwd
/Users/psocha/go/src/github.com/terraform-providers/terraform-provider-aws
> make
==> Checking that code complies with gofmt requirements...
go install
> echo $?
0
@thomaswhitcomb I just renamed the parent directory from $GOPATH/src/github.com/nathanielks/terraform-provider-aws to $GOPATH/src/github.com/terraform-providers/terraform-provider-aws ¯_(ツ)_/¯
I have a similar issue. I forked this repo, cloned it into $GOPATH/src/github.com/iancward/terraform-provider-aws and run make test and get the same error as the OP.
If I move this forked repo to $GOPATH/src/github.com/terraform-providers/terraform-provider-aws the command works from there. But that seems dirty.
$ go version
go version go1.9.2 linux/amd64
Maybe the issue is that terraform has vendored terraform-provider-aws and terraform-provider-aws has a dependency on terraform (and also has it vendored)?
I change makefile on the forked repo to build provider everywhere ;P
https://github.com/NikkeiFTLearning/terraform-provider-aws-nftl/blob/master/GNUmakefile#L14-L18
@iancward golang building process is strictly connected with GOPATH and sometimes it defaults to resolve dependencies from import block.
The solution is to built terraform provider in $GOPATH/src/github.com/terraform-providers/terraform-provider-aws
The repository README does indeed list the solution mentioned above: https://github.com/terraform-providers/terraform-provider-aws/#building-the-provider
Clone repository to:
$GOPATH/src/github.com/terraform-providers/terraform-provider-aws
If there are indeed errors with the README instructions for building/testing, please do let us know!
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
I can confirm @jwermuth. I had to rename the directory to
$GOPATH/src/github.com/terraform-providers/terraform-provider-awsinstead of$GOPATH/src/github.com/nathanielks/terraform-provider-aws.