This message was deleted.
# package-authoring
s
This message was deleted.
e
There's two go modules github.com/pulumi/pulumi-terraform-bridge/v3 and https://github.com/pulumi/pulumi-terraform-bridge/blob/master/pf/go.mod - please make sure both reference the same commit / version, then I think this should go away.
šŸ‘šŸ¼ 1
b
Yup! That did the trick. Used an old version of
v3
. I guess that's the expected output if no resources has been mapped in the
resources.go
. Right?
Ouch! I mapped the missing resources using:
Copy code
Resources: map[string]*tfbridge.ResourceInfo{
			"tls_cert_request": {
				Tok: tfbridge.MakeResource(mainPkg, mainMod, "CertRequest"),
			},
			"tls_locally_signed_cert": {
				Tok: tfbridge.MakeResource(mainPkg, mainMod, "LocallySignedCert"),
			},
			"tls_private_key": {
				Tok: tfbridge.MakeResource(mainPkg, mainMod, "PrivateKey"),
			},
			"tls_self_signed_cert": {
				Tok: tfbridge.MakeResource(mainPkg, mainMod, "SelfSignedCertificate"),
			},
But this caused this.
Copy code
(cd provider && go build -o /tmp/pulumi-tls/bin/pulumi-tfgen-tls -ldflags "-X <http://github.com/pulumiverse/pulumi-tls/provider/pkg/version.Version=0.0.1-alpha.1675966948+616ad824.dirty|github.com/pulumiverse/pulumi-tls/provider/pkg/version.Version=0.0.1-alpha.1675966948+616ad824.dirty>" <http://github.com/pulumiverse/pulumi-tls/provider/cmd/pulumi-tfgen-tls)|github.com/pulumiverse/pulumi-tls/provider/cmd/pulumi-tfgen-tls)>
/tmp/pulumi-tls/bin/pulumi-tfgen-tls schema --out provider/cmd/pulumi-resource-tls
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x78 pc=0xecad1a]

goroutine 1 [running]:
<http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*ProviderInfo).SetAutonaming(0xc0007df7a0|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*ProviderInfo).SetAutonaming(0xc0007df7a0>, 0xff, {0x27a37d0, 0x1})
        /home/user/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.39.3/pkg/tfbridge/provider.go:1389 +0xda
<http://github.com/pulumiverse/pulumi-tls/provider.Provider()|github.com/pulumiverse/pulumi-tls/provider.Provider()>
        /tmp/pulumi-tls/provider/resources.go:160 +0x8d1
main.main()
        /tmp/pulumi-tls/provider/cmd/pulumi-tfgen-tls/main.go:23 +0x2e
Makefile:27: recipe for target 'tfgen' failed
I'll investigate this any further tomorrow. If you have a quick idea what's causing this, this would be helpful of course šŸ‘šŸ¼
e
No quick thoughts here, we're missing a nil check and helpful error somewhere.
šŸ‘šŸ¼ 1
b
I'll let you know tomorrow šŸ‘šŸ¼ about my findings
e
Is this trying to upgrade pulumi/pulumi-tls fork by any chance? I can get a working pulumi/pulumi-tls PR - was going to do that anyway soon-ish.
b
Terraform TLS provider is my victim to test the new implementation of the Cookiecutter Template. Because it's in so many ways oddly setup, e.g. untile v3.4.0 the go.mod module does not match the source URL and it has not /v3 to match the used git tag etc etc.
e
That makes sense! In that case we're not duplicating work. We just picked it for dogfooding for similar reasons - so it will be one of the first ones to use the PF bridge under the hood in actual Pulumi providers (after pulumi-random).
šŸ‘šŸ¼ 1
b
Quick note about the SIGSEGV from yesterday: I activated autonaming on the provider using
prov.SetAutonaming(255, "-")
. When I remove the statement
tfgen
sucessfully creates a
bridge-metadata.json
And I'm able to successfully create the SDKs.
šŸŽ‰ 1
Everything done via the Cookiecutter Template šŸ˜€
e
Excellent! Gotcha. I'll file an issue - I think this entire area needs to be revisited a bit since the PF bridge doesn't properly respect some of the ProviderInfo options, but it's not obvious yet through compile-time errors or warnings etc.
šŸ‘šŸ¼ 1
b
I finished the (first) implementation to support the terraform-plugin-framework in the Cookiecutter Template for Pulumi Providers. https://github.com/tmeckel/pulumi-tf-provider-cookiecutter Perhaps you'll like to give it a try to scaffold the TLS provider (or a different one) šŸ˜€ I'd appreciate any feedback about the documentation and well the template worked for you! I succefully tested the template with the following terraform providers: • github.com/hashicorp/terraform-provider-tls • github.com/aiven/terraform-provider-aiven • github.com/civo/terraform-provider-civo • github.com/fortinetdev/terraform-provider-fortios • github.com/tmeckel/terraform-provider-mssql
šŸ™Œ 2