Hi, I wanted to upgrade our pulumi-ovh provider ( ...
# package-authoring
t
Hi, I wanted to upgrade our pulumi-ovh provider ( to be synced with our terraform provider, as usual). When I executed the upgrade command
upgrade-provider ovh/pulumi-ovh
, I have an error:
error: failed to gather package metadata: problem gathering data sources: 1 error occurred:
* Pulumi token "ovh:CloudProjectDatabase/getIpRestrictions:getIpRestrictions" is mapped to TF provider data source "ovh_cloud_project_database_ip_restrictions", but no such data source found. Remove the mapping and try again
make: *** [Makefile:59: tfgen] Error 255
After analyzing our Terraform provider, it appears that the datasource have not disapeared BUT we are currently migrating our resources and datasources to use the new
terraform-plugin-framework
instead of old
terraform-plugin-sdk/v2
This is the new SDK that should and will be used to declare new resources/datasources. The terraform provider now uses a mux server that allows to have both SDKs used at the same time (see: https://github.com/ovh/terraform-provider-ovh/blob/master/main.go#L33-L43). So is it possible to say to Pulumi to take in account resources and datasources declared with the old and the new terraform plugin framework? FYI, for the moment, we only declared in the new way this datasource: https://github.com/ovh/terraform-provider-ovh/blob/master/ovh/provider_new.go#L163 but all of the others are still declared in the old way: https://github.com/ovh/terraform-provider-ovh/blob/master/ovh/provider.go#L50 Is it possible to help us in this issue, because right now we can’t upgrade.sync the pulumi provider. Thanks 🙂
l
@thankful-match-46035 in a case where you are migrating from old to new in TF land, you can leverage the multiplexer, aka "muxer" of our tf-bridge framework. Here is an example where you see both providers muxed on the Pulumi side: https://github.com/pulumiverse/pulumi-buildkite/blob/c3cd7cc214e71d6d5b7ab38555a2050b785b8dde/provider/resources.go#L60-L63
a
I would look at the guide for How to Upgrade a provider that has partially migrated to the Plugin Framework. If you get stuck, please reach out here again.
t
Thanks I’m trying to follow the guide, step by step ^^ Question: is it
pfbridge
or
tfbridge
?
a
🤦 The examples don’t include import statements. The examples assume these imports:
Copy code
import (
    pfbridge "<http://github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge|github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge>"
    "<http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge>"
)
To answer your question directly, it is both
pfbridge
and
tfbridge
.
t
and what is the import for “provShim” ?
a
Whatever the correct import is to access the PF provider struct of the provider you are bridging.
Looks like it will be "github.com/ovh/terraform-provider-ovh/ovh" in your case.
If I’m reading the
main
function of
terraform-provider-ovh
correctly, you would write
&ovh.OvhProvider{}
instead of
provShim.PFProvider()
.
t
For the moment I wrote this but I still have an error in
ovh.New(),
line
a
I can’t find
ovh.New()
. What is the return type of
ovh.New()
?
t
I finally fixed the resources.go file I updated the tf-gen main.go file And updated the main.go with tfbridge call but unfortunately when I am launching the upgrade-provider script, I have an error “error: ProviderInfo.MetadataInfo is required and cannot be nil”
a
You need to add a metadata file and point ProviderInfo to it. This is called out unfortunately subtly in the upgrade guide:
> Muxed providers need an accompanying
MetadataInfo
. If the provider did not have one set up, this is the time to do so.
How to set this up is shown in “How to Upgrade a Bridged Provider to Plugin Framework” (step 4).
I have opened this issue to track failures in our documentation. Let me know if you think we are missing anything else.
t
I updated the code with MetaDataInfo and go embed bridgeMetadata (and added missing import embed), unfortunately still have an issue
a
You also need to create the empty file for
go:embed
to pick up:
Copy code
echo {} > cmd/pulumi-resource-ovh/bridge-metadata.json
t
fixed with //go:embed cmd/pulumi-resource-ovh/bridge-metadata.json Documentation is not easy to understand and follow 😞
a
Documentation is not easy to understand and follow 😞
I’m sorry. We know and are working on it.
t
I’m executing again (for the xx time, I didn’t count ^^) the upgrade-provider command and hope everything should be ok 🤞
The upgrade was successfull ... but in the pulumi registry the new version have not been updated https://www.pulumi.com/registry/packages/ovh/ https://github.com/ovh/pulumi-ovh/releases/tag/v0.37.0 Do you know why? thanks 🙂
l
@thankful-match-46035 our registry publishing isn't instantaneous. We check for new releases twice a day. Here is the PR for your new release: https://github.com/pulumi/registry/pull/4005 I'll merge it together with some other ones this morning.
t
thanks for the information
So the 0.37.0 have been published but it’s not working 😞 I tested the same example in 0.35.0 it’s working, but when changing to 0.37.0 (the version that needs to support the Terraform framework) it’s not working anymore. Is it possible to take a look? Following the not uptodate tutorials and try to imagine the fix have compiled, pased the upgrade-provider script but not worked 😞 https://github.com/ovh/pulumi-ovh/pull/104 Thx
@ancient-policeman-24615 @limited-rainbow-51650 Is it possible to have some help? Since the migration and the code you ask me to add, the new release is not working Even if the upgrade script have generated the PR So it published a non working provider release
l
I will have to leave this to @ancient-policeman-24615 or @enough-garden-22763 for further investigation.
a
From the error message, it looks like the version wasn’t correctly linked into the executable. I’m taking a look now.
@thankful-match-46035 I believe the fix is just setting the Version field in the ProviderInfo struct: https://github.com/ovh/pulumi-ovh/pull/107
t
Top, thanks! I merged the commits and published a new release 0.37.1 is now working