pulumi / pulumi-terraform-provider

Use any Terraform provider with Pulumi
Apache License 2.0
6 stars 0 forks source link

The version of the existing Terraform provider is not known #30

Open scraly opened 2 months ago

scraly commented 2 months ago

What happened?

When using an existing Terraform provider (OVHcloud for example):

$ pulumi package add terraform-provider ovh/ovh

We don't know what is the version of the generated SDK:

Image

That is a problem because an user can't know which version of the Terraform generated provider he/she uses.

Example

Image

Output of pulumi about

CLI
Version      3.130.0
Go Version   go1.22.6
Go Compiler  gc

Plugins
KIND      NAME                VERSION
language  go                  unknown
resource  harbor              3.10.13
resource  terraform-provider  0.1.0

Host
OS       darwin
Version  14.1
Arch     arm64

This project is written in go: executable='/Users/aurelievache/.gvm/gos/go1.21/bin/go' version='go version go1.21.0 darwin/arm64'

Backend
Name           pulumi.com
URL            https://app.pulumi.com/scraly
User           scraly
Organizations  scraly, ninjascraly
Token type     personal

Dependencies:
NAME                                                     VERSION
github.com/pulumi/pulumi-terraform-provider/sdks/go/ovh
github.com/pulumi/pulumi/sdk/v3                          v3.129.0
github.com/pulumiverse/pulumi-harbor/sdk/v3              v3.10.13

Pulumi locates its logs in /var/folders/vk/r2mm9c3s3x593lfsjmn4z6fr0000gq/T/ by default
warning: Failed to get information about the current stack: No current stack

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

scraly commented 2 months ago

Even when I select a version of the provider, I don't have this information in the go.mod file:

$ pulumi package add terraform-provider ovh/ovh 0.48.0
Successfully generated a Go SDK for the ovh package at /Users/avache/git/github.com/ovh/public-cloud-examples/containers-orchestration/managed-private-registry/create-registry-with-pulumi/ovhcloud-tf-registry-go/sdks/ovh

To use this SDK in your Go project, run the following command:

   go mod edit -replace github.com/pulumi/pulumi-terraform-provider/sdks/go/ovh=./sdks/ovh

You can then use the SDK in your Go code with:

  import "github.com/pulumi/pulumi-terraform-provider/sdks/go/ovh"

$  go mod edit -replace github.com/pulumi/pulumi-terraform-provider/sdks/go/ovh=./sdks/ovh

$ go mod tidy
go: found github.com/pulumi/pulumi-terraform-provider/sdks/go/ovh in github.com/pulumi/pulumi-terraform-provider/sdks/go/ovh v0.0.0-00010101000000-000000000000

So the user can't know what provider version he/she uses and if he/she needs to update the code to the latest version for example.

mjeffryes commented 2 months ago

Hmmm... At some level this is intentional; the SDKs are local, and so we don't want to introduce confusion by implying that the code exists with that version at github.com/pulumi/pulumi-terraform-provider/sdks/go/ovh

However, I can see how a consumer of this SDK would like to be able to recover information about the version of the terraform provider it is pointing to. At the moment that information is embedded in the SDK, but a bit inaccessible:

rg -A3 '"ovh"' sdks/ovh/internal/pulumiUtilities.go
182:                Name:    "ovh",
183-                Version: "0.48.0",
184-                Value:   parameter,
185-            },

However, I imagine you may be looking at this from the perspective of a provider author and wanting a well defined versions of the SDK as well for the sake of triaging user issues as well? We have a bit of work to do there, but hoping to be able to follow up soon with an option for publishing versioned SDKs that leverage this generic bridged provider support.