Hi All. I am looking to update a couple Pulumi pro...
# pulumiverse
a
Hi All. I am looking to update a couple Pulumi providers I current maintain to add some new resources/features/attributes that were introduced. I attempted to re-run the
make tfgen
again, but it failed with the following error:
Copy code
# <http://github.com/pulumi/pulumi/pkg/v3/resource/deploy/deploytest|github.com/pulumi/pulumi/pkg/v3/resource/deploy/deploytest>
../../../../../pkg/mod/github.com/pulumi/pulumi/pkg/v3@v3.76.1/resource/deploy/deploytest/languageruntime.go:31:9: cannot use &languageRuntime{…} (value of type *languageRuntime) as plugin.LanguageRuntime value in return statement: *languageRuntime does not implement plugin.LanguageRuntime (wrong type for method GeneratePackage)
                have GeneratePackage(string, string, map[string][]byte) error
                want GeneratePackage(string, string, map[string][]byte, string) error
# <http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tf2pulumi/il|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tf2pulumi/il>
../../../../../pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.58.0/pkg/tf2pulumi/il/plugin_info.go:182:82: not enough arguments in call to workspace.GetPluginPath
        have ("<http://github.com/pulumi/pulumi/sdk/v3/go/common/workspace|github.com/pulumi/pulumi/sdk/v3/go/common/workspace>".PluginKind, string, nil, nil)
        want (diag.Sink, "<http://github.com/pulumi/pulumi/sdk/v3/go/common/workspace|github.com/pulumi/pulumi/sdk/v3/go/common/workspace>".PluginKind, string, *"<http://github.com/blang/semver|github.com/blang/semver>".Version, []"<http://github.com/pulumi/pulumi/sdk/v3/go/common/workspace|github.com/pulumi/pulumi/sdk/v3/go/common/workspace>".ProjectPlugin)
# <http://github.com/pulumi/pulumi/pkg/v3/engine|github.com/pulumi/pulumi/pkg/v3/engine>
../../../../../pkg/mod/github.com/pulumi/pulumi/pkg/v3@v3.76.1/engine/plugins.go:190:76: not enough arguments in call to workspace.GetPluginPath
        have ("<http://github.com/pulumi/pulumi/sdk/v3/go/common/workspace|github.com/pulumi/pulumi/sdk/v3/go/common/workspace>".PluginKind, string, *semver.Version, []"<http://github.com/pulumi/pulumi/sdk/v3/go/common/workspace|github.com/pulumi/pulumi/sdk/v3/go/common/workspace>".ProjectPlugin)
        want (diag.Sink, "<http://github.com/pulumi/pulumi/sdk/v3/go/common/workspace|github.com/pulumi/pulumi/sdk/v3/go/common/workspace>".PluginKind, string, *semver.Version, []"<http://github.com/pulumi/pulumi/sdk/v3/go/common/workspace|github.com/pulumi/pulumi/sdk/v3/go/common/workspace>".ProjectPlugin)
# <http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2>
../../../../../pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.58.0/pkg/tfshim/sdk-v2/resource.go:24:26: r.tf.SchemaMap undefined (type *schema.Resource has no field or method SchemaMap)
../../../../../pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.58.0/pkg/tfshim/sdk-v2/resource.go:90:67: r.tf.SchemaMap undefined (type *schema.Resource has no field or method SchemaMap)
../../../../../pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.58.0/pkg/tfshim/sdk-v2/resource.go:91:22: r.tf.SchemaMap undefined (type *schema.Resource has no field or method SchemaMap)
../../../../../pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.58.0/pkg/tfshim/sdk-v2/schema.go:137:23: e.SchemaMap undefined (type *schema.Resource has no field or method SchemaMap)
make: *** [tfgen] Error 1
The same error is returned when attempting to regenerate the sdks. Any ideas on how I can solve this?
m
Hi William, this is probably a version conflict. The version of pulumi-terraform-bridge in your project is 3.58, which depends on Pulumi 3.78.1, but the Pulumi version in your project is 3.76.1. Can you upgrade the latter?
a
Hi Thomas. Thanks for the guidance. I fixed the version conflict, but error still persists.
Copy code
[ -x /opt/homebrew/bin/pulumi ] || curl -fsSL <https://get.pulumi.com> | sh
pulumi plugin install resource random 4.8.2
(cd provider && go build -o /Users/wguilherme/go/src/github.com/zscaler/pulumi-zpa/bin/pulumi-tfgen-zpa -ldflags "-X <http://github.com/zscaler/pulumi-zpa/provider/pkg/version.Version=0.0.1-alpha.1693978907+dacf430e.dirty|github.com/zscaler/pulumi-zpa/provider/pkg/version.Version=0.0.1-alpha.1693978907+dacf430e.dirty>" <http://github.com/zscaler/pulumi-zpa/provider/cmd/pulumi-tfgen-zpa)|github.com/zscaler/pulumi-zpa/provider/cmd/pulumi-tfgen-zpa)>
# <http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tf2pulumi/il|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tf2pulumi/il>
../../../../../pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.58.0/pkg/tf2pulumi/il/plugin_info.go:182:82: not enough arguments in call to workspace.GetPluginPath
        have ("<http://github.com/pulumi/pulumi/sdk/v3/go/common/workspace|github.com/pulumi/pulumi/sdk/v3/go/common/workspace>".PluginKind, string, nil, nil)
        want (diag.Sink, "<http://github.com/pulumi/pulumi/sdk/v3/go/common/workspace|github.com/pulumi/pulumi/sdk/v3/go/common/workspace>".PluginKind, string, *"<http://github.com/blang/semver|github.com/blang/semver>".Version, []"<http://github.com/pulumi/pulumi/sdk/v3/go/common/workspace|github.com/pulumi/pulumi/sdk/v3/go/common/workspace>".ProjectPlugin)
# <http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2>
../../../../../pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.58.0/pkg/tfshim/sdk-v2/resource.go:24:26: r.tf.SchemaMap undefined (type *schema.Resource has no field or method SchemaMap)
../../../../../pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.58.0/pkg/tfshim/sdk-v2/resource.go:90:67: r.tf.SchemaMap undefined (type *schema.Resource has no field or method SchemaMap)
../../../../../pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.58.0/pkg/tfshim/sdk-v2/resource.go:91:22: r.tf.SchemaMap undefined (type *schema.Resource has no field or method SchemaMap)
../../../../../pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.58.0/pkg/tfshim/sdk-v2/schema.go:137:23: e.SchemaMap undefined (type *schema.Resource has no field or method SchemaMap)
make: *** [tfgen] Error 1
m
I checked and found this was a breaking change in v3.78.0. You’ll need to add an argument
diag.Sink
to the
GetPluginPath
call.
l
@acoustic-tiger-77630 over the past weeks, our Pulumi engineers built a custom tool to bump the versions of some Pulumi dependencies, as well as upgrading to the latest version of the bridged Terraform provider. This should prevent problems like you encountered above. https://github.com/pulumi/upgrade-provider
a
Hi @limited-rainbow-51650 When running this command (Assuming I am doing this right.) it ends up with the following error. Should this be because the repository is currently private?
Copy code
---- Setting Up Environment ----
- ✓ GOWORK="off": done
- ✓ PULUMI_MISSING_DOCS_ERROR="true": done
- ✓ PULUMI_CONVERT_EXAMPLES_CACHE_DIR="": done
---- Discovering Repository ----
- Ensure '<http://github.com/zscaler/pulumi-zpa|github.com/zscaler/pulumi-zpa>'
  - ✓ Expected Location: /Users/wguilherme/go/src/github.com/zscaler/pulumi-zpa
  - ✓ Downloading: skipped - already exists
  - ✓ Validating: done
- pull default branch
  - ✓ /opt/homebrew/bin/git ls-remote --heads origin: done
  - ✓ finding default branch: master
  - ✓ /opt/homebrew/bin/git fetch: done
  - ✓ /opt/homebrew/bin/git checkout master: done
  - ✓ /opt/homebrew/bin/git pull origin: done
- X Repo kind: go.mod: could not find upstream 'zscaler/pulumi-zpa' in go.mod
l
Yes, I think so. But if you checkout the repo yourself and run the tool with the current working folder the root of your repo, it will skip the checkout part.
You also will need the Github CLI (
gh
) installed and a working
GITHUB_TOKEN
environment variable allowed to create a branch, push it and create a PR.
a
That’s what I am doing. I am in the root of the repo, then I ran the following command:
upgrade-provider zscaler/pulumi-zpa --upstream-provider-name zscaler/pulumi-zpa
The same error above still persists.
l
The
--upstream-provider-name
actually refers to your Terraform provider, so that should be
zscaler/terraform-provider-zpa
a
Oh got it.
This is the output now. It didn’t go all the way to though.
Copy code
---- Setting Up Environment ----
- ✓ GOWORK="off": done
- ✓ PULUMI_MISSING_DOCS_ERROR="true": done
- ✓ PULUMI_CONVERT_EXAMPLES_CACHE_DIR="": done
---- Discovering Repository ----
- Ensure '<http://github.com/zscaler/pulumi-zpa|github.com/zscaler/pulumi-zpa>'
  - ✓ Expected Location: /Users/wguilherme/go/src/github.com/zscaler/pulumi-zpa
  - ✓ Downloading: skipped - already exists
  - ✓ Validating: done
- pull default branch
  - ✓ /opt/homebrew/bin/git ls-remote --heads origin: done
  - ✓ finding default branch: master
  - ✓ /opt/homebrew/bin/git fetch: done
  - ✓ /opt/homebrew/bin/git checkout master: done
  - ✓ /opt/homebrew/bin/git pull origin: done
- ✓ Repo kind: plain
- X Planning Provider Update: exit status 1
l
I'll have to check with the team on this one.
a
BTW I set the repo as public and the result was the same.
It was quite a saga but I got it working.. Had to refer to how the Okta provider is calling upstream as well as use the same sdk version/packages. Not sure exactly what was broken but setting the go.mod like this did the trick. I also had to create git submodule along with the upstream shell script included in some of the providers. plus adding the following entry in my go.mod file
<http://github.com/zscaler/terraform-provider-zia|github.com/zscaler/terraform-provider-zia> => ../upstream
The steps below is what actually fixed things in the end.
Copy code
require (
	<http://github.com/pulumi/pulumi-terraform-bridge/v3|github.com/pulumi/pulumi-terraform-bridge/v3> v3.57.0
	<http://github.com/pulumi/pulumi/sdk/v3|github.com/pulumi/pulumi/sdk/v3> v3.76.1
	<http://github.com/zscaler/terraform-provider-zpa/v2|github.com/zscaler/terraform-provider-zpa/v2> v2.83.0-beta
)

replace (
	<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> v2.0.0-20230710100801-03a71d0fca3d
	<http://github.com/zscaler/terraform-provider-zpa|github.com/zscaler/terraform-provider-zpa> => ../upstream
)
In addition to I had to add this file
bridge-metadata.json
into the provider/cmd/pulumi-resource-zpa. Finally, I had to add this entry in my
resources.go
Copy code
//go:embed cmd/pulumi-resource-zpa/bridge-metadata.json
var metadata []byte
Along with importing this
Copy code
import (
	"fmt"
	// embed is used to store bridge-metadata.json in the compiled binary
	_ "embed"
)
After that all make commands worked without any problems. BTW. Using the upgrading tool didn’t work as described in the README file.
m
Would you mind filing an issue or submitting PR for the README?