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

full-artist-27215

12/10/2021, 12:52 AM
I'm trying to port the HCP Terraform provider (https://github.com/hashicorp/terraform-provider-hcp) to Pulumi, but am running into issues. The provider code itself is in an
internal
folder (https://github.com/hashicorp/terraform-provider-hcp/tree/main/internal), which my non-Go-coding self has discovered is how Go denotes private code that can't be used by other code. Is there some kind of way around this restriction for Pulumi's purposes, or is this provider effectively impossible to convert to Pulumi using the tfbridge? Thanks.
b

broad-dog-22463

12/10/2021, 1:26 PM
Hey @full-artist-27215 you need to follow the same sort of thing we have done in pulumi-azuread where we have a shim that allows us to reach inside the internal folder
f

full-artist-27215

12/10/2021, 1:48 PM
Cool, thanks for the tip... I'll see if I can get that working.
b

broad-dog-22463

12/10/2021, 1:49 PM
that is the one! Notice the go.mod module name
and then how we import that in provider/go.mod
f

full-artist-27215

12/10/2021, 1:56 PM
👍
Oh, this is sneaky
@broad-dog-22463 Making more progress, but now I've run into this:
Copy code
make tfgen
[ -x /home/maier/.pulumi/bin/pulumi ] || curl -fsSL <https://get.pulumi.com> | sh
pulumi plugin install resource random 4.3.1
(cd provider && go build -a -o /home/maier/go/src/github.com/christophermaier/pulumi-hcp/bin/pulumi-tfgen-hcp -ldflags "-X <http://github.com/christophermaier/pulumi-hcp/provider/pkg/version.Version=0.0.1-alpha.1639018537+f68ef466.dirty|github.com/christophermaier/pulumi-hcp/provider/pkg/version.Version=0.0.1-alpha.1639018537+f68ef466.dirty>" <http://github.com/christophermaier/pulumi-hcp/provider/cmd/pulumi-tfgen-hcp)|github.com/christophermaier/pulumi-hcp/provider/cmd/pulumi-tfgen-hcp)>
# <http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2>
/home/maier/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.13.0/pkg/tfshim/sdk-v2/upgrade_state.go:38:24: undefined: schema.UpgradeFlatmapState
/home/maier/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.13.0/pkg/tfshim/sdk-v2/upgrade_state.go:44:14: undefined: schema.UpgradeJSONState
/home/maier/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.13.0/pkg/tfshim/sdk-v2/upgrade_state.go:52:2: undefined: schema.RemoveAttributes
/home/maier/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.13.0/pkg/tfshim/sdk-v2/upgrade_state.go:69:6: undefined: schema.NormalizeObjectFromLegacySDK
make: *** [Makefile:57: tfgen] Error 2
Have you seen errors like that before? Any suggestions? Thanks 🙇
Ah, never mind... I found a pointer of yours from a few months ago!
👌 1
@broad-dog-22463 I think I've got this working (at least through the "build SDKs" step)... would you all be interested in doing the same thing we did with the Nomad provider?
@broad-dog-22463 Ping on this ☝️
6 Views