Hi Pulumi, iā€™m trying to wrap a Terraform provider...
# general
a
Hi Pulumi, iā€™m trying to wrap a Terraform provider terraform-provider-tencentcloud to a Pulumi provider by the pulumi-tf-provider-boilerplate. When i ran the command
make tfgen
, there were always some compilation errors that should be caused by golang package versions before and after i tried to resolved them. Here is the provider/go.mod:
Copy code
module <http://github.com/danli001/pulumi-tencentcloud/provider|github.com/danli001/pulumi-tencentcloud/provider>

go 1.16

replace (
        <http://github.com/hashicorp/go-getter|github.com/hashicorp/go-getter> v1.5.0 => <http://github.com/hashicorp/go-getter|github.com/hashicorp/go-getter> v1.4.0
        <http://github.com/hashicorp/terraform-plugin-sdk/v2|github.com/hashicorp/terraform-plugin-sdk/v2> => <http://github.com/pulumi/terraform-plugin-sdk/v2|github.com/pulumi/terraform-plugin-sdk/v2> upstream-v2.10.1
)

require (
        <http://github.com/hashicorp/terraform-plugin-sdk|github.com/hashicorp/terraform-plugin-sdk> v1.9.1
        <http://github.com/pulumi/pulumi-terraform-bridge/v3|github.com/pulumi/pulumi-terraform-bridge/v3> v3.18.0
        <http://github.com/pulumi/pulumi/sdk/v3|github.com/pulumi/pulumi/sdk/v3> v3.25.1
        <http://github.com/tencentcloudstack/terraform-provider-tencentcloud|github.com/tencentcloudstack/terraform-provider-tencentcloud> v1.70.2
)
Errors:
Copy code
āÆ make tfgen                                                                                                                                                                                             ļ€— 10:28:19
[ -x /usr/local/bin/pulumi ] || curl -fsSL <https://get.pulumi.com> | sh
pulumi plugin install resource random 4.3.1
(cd provider && go build -o /Users/dli/workspace/goproj/src/github.com/danli001/pulumi-tencentcloud/bin/pulumi-tfgen-tencentcloud -ldflags "-X <http://github.com/danli001/pulumi-tencentcloud/provider/pkg/version.Version=0.0.1-alpha.1650620947+25dcfec6.dirty|github.com/danli001/pulumi-tencentcloud/provider/pkg/version.Version=0.0.1-alpha.1650620947+25dcfec6.dirty>" <http://github.com/danli001/pulumi-tencentcloud/provider/cmd/pulumi-tfgen-tencentcloud)|github.com/danli001/pulumi-tencentcloud/provider/cmd/pulumi-tfgen-tencentcloud)>

# <http://github.com/hashicorp/terraform-plugin-test|github.com/hashicorp/terraform-plugin-test>
/Users/dli/go/pkg/mod/github.com/hashicorp/terraform-plugin-test@v1.3.0/helper.go:184:85: not enough arguments in call to zipDecompressor.Decompress
        have (string, string, bool)
        want (string, string, bool, fs.FileMode)
# <http://github.com/pulumi/pulumi/pkg/v3/codegen/schema|github.com/pulumi/pulumi/pkg/v3/codegen/schema>
/Users/dli/go/pkg/mod/github.com/pulumi/pulumi/pkg/v3@v3.23.2/codegen/schema/loader.go:120:31: not enough arguments in call to pkgPlugin.Install
        have (*os.File)
        want (io.ReadCloser, bool)
make: *** [tfgen] Error 2
Did i do anything wrong here?
e
I'd try updating the bridge and pulumi packages:
Copy code
<http://github.com/pulumi/pulumi-terraform-bridge/v3|github.com/pulumi/pulumi-terraform-bridge/v3> v3.21.0
        <http://github.com/pulumi/pulumi/sdk/v3|github.com/pulumi/pulumi/sdk/v3> v3.30.0
a
another error occurs:
Copy code
# <http://github.com/hashicorp/terraform-plugin-test|github.com/hashicorp/terraform-plugin-test>
/Users/dli/go/pkg/mod/github.com/hashicorp/terraform-plugin-test@v1.3.0/helper.go:184:85: not enough arguments in call to zipDecompressor.Decompress
        have (string, string, bool)
        want (string, string, bool, fs.FileMode)
make: *** [tfgen] Error
The repo github.com/hashicorp/terraform-plugin-test had been archived. After i updated it to: v1.4.4
Copy code
# <http://github.com/hashicorp/terraform-plugin-test|github.com/hashicorp/terraform-plugin-test>
/Users/dli/go/pkg/mod/github.com/hashicorp/terraform-plugin-test@v1.4.4/config.go:46:32: not enough arguments in call to tfinstall.Find
        have ([]tfinstall.ExecPathFinder)
        want (context.Context, ...tfinstall.ExecPathFinder)
/Users/dli/go/pkg/mod/github.com/hashicorp/terraform-plugin-test@v1.4.4/helper.go:189:85: not enough arguments in call to zipDecompressor.Decompress
        have (string, string, bool)
        want (string, string, bool, fs.FileMode)
make: *** [tfgen] Error 2
v2.2.1
Copy code
# <http://github.com/hashicorp/terraform-plugin-sdk/acctest|github.com/hashicorp/terraform-plugin-sdk/acctest>
/Users/dli/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.14.0/acctest/helper.go:24:52: too many arguments in call to tftest.AutoInitProviderHelper
        have (string, string)
        want (string)
e
Yeh that looks like plugin-test is just not been updated to use the more recent function signatures
I don't think this is an issue with the bridge, just go modules always using the highest requested version + old code.
a
Agree with youšŸ˜. but is there any suggestion can help to resolve it? It seems o be a problem for everyone who uses pulumi-tf-provider-boilerplate to wrap a Terraform provider.
e
Well an issue for anyone trying to wrap the test-plugin, but most people are trying to wrap more recent and interesting providers.
a
šŸ¤£ I see. Thank you very much for you help.
l
@astonishing-microphone-39160 not an answer to your problem, but if you bump pulumi-terraform-bridge in
go.mod
to v3.21.0, you can customize the package names for the generated client SDKs. We are documenting it as well for the Pulumiverse community providers: https://github.com/pulumiverse/infra/tree/docs-readme
šŸ‘ 1