https://pulumi.com logo
#general
Title
# general
f

full-artist-27215

06/10/2021, 2:47 PM
I'm trying to build a Pulumi provider for Nomad. I've been following along with the instructions at https://github.com/pulumi/pulumi-tf-provider-boilerplate and have gotten to the
make build_sdks
step, but it's failing with the following:
Copy code
no required module provides package <http://github.com/pulumi/pulumi-nomad/provider/cmd/pulumi-tfgen-nomad;|github.com/pulumi/pulumi-nomad/provider/cmd/pulumi-tfgen-nomad;> to add it:
        go get <http://github.com/pulumi/pulumi-nomad/provider/cmd/pulumi-tfgen-nomad|github.com/pulumi/pulumi-nomad/provider/cmd/pulumi-tfgen-nomad>
That obviously doesn't exist... any pointers? Thanks in advance 🙇
b

billowy-army-68599

06/10/2021, 2:58 PM
is there any reference to module in your repo?
f

full-artist-27215

06/10/2021, 3:04 PM
I've got a provider/cmd/pulumi-tfgen-nomad/pulumi-tfgen-xyz/main.go file... perhaps the name replacement logic missed something?
no, that didn't work.
Seems like a bit of a chicken-and-the-egg scenario. 🤔
b

billowy-army-68599

06/10/2021, 3:08 PM
that dir structure doesn't look right
f

full-artist-27215

06/10/2021, 3:10 PM
well that's weird 😅
I removed that intervening directory and got further:
Copy code
resources.go:24:2: missing go.sum entry for module providing package <http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge> (imported by <http://github.com/pulumi/pulumi-nomad/provider|github.com/pulumi/pulumi-nomad/provider>); to add:
        go get <http://github.com/pulumi/pulumi-nomad/provider|github.com/pulumi/pulumi-nomad/provider>
cmd/pulumi-tfgen-nomad/main.go:18:2: missing go.sum entry for module providing package <http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen> (imported by <http://github.com/pulumi/pulumi-nomad/provider/cmd/pulumi-tfgen-nomad|github.com/pulumi/pulumi-nomad/provider/cmd/pulumi-tfgen-nomad>); to add:
        go get <http://github.com/pulumi/pulumi-nomad/provider/cmd/pulumi-tfgen-nomad|github.com/pulumi/pulumi-nomad/provider/cmd/pulumi-tfgen-nomad>
resources.go:25:2: missing go.sum entry for module providing package <http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim> (imported by <http://github.com/pulumi/pulumi-nomad/provider|github.com/pulumi/pulumi-nomad/provider>); to add:
        go get <http://github.com/pulumi/pulumi-nomad/provider|github.com/pulumi/pulumi-nomad/provider>
resources.go:26:2: missing go.sum entry for module providing package <http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v1|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v1> (imported by <http://github.com/pulumi/pulumi-nomad/provider|github.com/pulumi/pulumi-nomad/provider>); to add:
        go get <http://github.com/pulumi/pulumi-nomad/provider|github.com/pulumi/pulumi-nomad/provider>
resources.go:27:2: missing go.sum entry for module providing package <http://github.com/pulumi/pulumi/sdk/v3/go/common/resource|github.com/pulumi/pulumi/sdk/v3/go/common/resource> (imported by <http://github.com/pulumi/pulumi-nomad/provider|github.com/pulumi/pulumi-nomad/provider>); to add:
        go get <http://github.com/pulumi/pulumi-nomad/provider|github.com/pulumi/pulumi-nomad/provider>
resources.go:28:2: missing go.sum entry for module providing package <http://github.com/pulumi/pulumi/sdk/v3/go/common/tokens|github.com/pulumi/pulumi/sdk/v3/go/common/tokens> (imported by <http://github.com/pulumi/pulumi-nomad/provider|github.com/pulumi/pulumi-nomad/provider>); to add:
        go get <http://github.com/pulumi/pulumi-nomad/provider|github.com/pulumi/pulumi-nomad/provider>
resources.go:29:2: no required module provides package <http://github.com/terraform-providers/terraform-provider-nomad/nomad;|github.com/terraform-providers/terraform-provider-nomad/nomad;> to add it:
        go get <http://github.com/terraform-providers/terraform-provider-nomad/nomad|github.com/terraform-providers/terraform-provider-nomad/nomad>
make: *** [Makefile:52: tfgen] Error 1
I would have thought this is what the
(cd provider && go mod download)
step would have done...
(obviously, I'm not a Go person 🙃 )
b

billowy-army-68599

06/10/2021, 3:15 PM
go mod tidy
f

full-artist-27215

06/10/2021, 3:19 PM
had an incorrect path in there somewhere for the nomad provider, but now it's going
b

broad-dog-22463

06/10/2021, 3:21 PM
@full-artist-27215 if you want to jump on a call about this then let me know and we can help you take this to the next stage when you've created it 🙂
f

full-artist-27215

06/10/2021, 3:21 PM
Next problem: creating the provider in
resources.go
. The generated code reads as
Copy code
// Instantiate the Terraform provider
	p := shimv1.NewProvider(nomad.Provider().(*schema.Provider))
The compiler takes issue with that, however:
Copy code
./resources.go:94:42: invalid type assertion: nomad.Provider().(*"<http://github.com/hashicorp/terraform-plugin-sdk/helper/schema|github.com/hashicorp/terraform-plugin-sdk/helper/schema>".Provider) (non-interface type *"<http://github.com/hashicorp/terraform-plugin-sdk/helper/schema|github.com/hashicorp/terraform-plugin-sdk/helper/schema>".Provider on left)
@broad-dog-22463 That would be fantastic 🎉
b

broad-dog-22463

06/10/2021, 3:22 PM
I'll DM you my calendar link
🙏 1