This message was deleted.
# package-authoring
s
This message was deleted.
e
Have you run
make provider
to build the provider binary so it's on $PATH?
s
Not sure I follow, the Makefile does:
Copy code
provider:: tfgen install_plugins # build the provider binary
	(cd provider && go build -o $(WORKING_DIR)/bin/${PROVIDER} -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" ${PROJECT}/${PROVIDER_PATH}/cmd/${PROVIDER})
Had to inquire ChatGPT: The command performs the following actions: 1. Change Directory: It changes the current directory to
provider
using
cd provider
.
2. _Go Build: It then runs
go build
to compile the Go code located in
${PROJECT}/${PROVIDER_PATH}/cmd/${PROVIDER}
._ 3. _Output: The compiled binary is saved to
$(WORKING_DIR)/bin/${PROVIDER}
._ 4. Linker Flags: It sets some linker flags to embed the version information into the binary. This make task doesn't seem to add anything to the PATH, so I symlinked
./bin/pulumi-resource-openwrt
to
~/go/bin/pulumi-resource-openwrt
and it was picked up . Next error 🙂
Copy code
 pulumi up
Previewing update (dev)

View in Browser (Ctrl+O): <https://app.pulumi.com/pcuci/ts/dev/previews/9498ada9-bbe5-4071-af4d-ee57be9ad417>

     Type                         Name             Plan       Info
 +   pulumi:pulumi:Stack          ts-dev           create     2 warnings
     └─ pulumi:providers:openwrt  openwrtProvider             1 error


Diagnostics:
  pulumi:providers:openwrt (openwrtProvider):
    error: pulumi:providers:openwrt resource 'openwrtProvider' has a problem: could not validate provider configuration: Invalid or unknown key. Examine values at 'openwrtProvider.pluginDownloadURL'.

  pulumi:pulumi:Stack (ts-dev):
    warning: using pulumi-resource-openwrt from $PATH at /home/paul/go/bin/pulumi-resource-openwrt
    warning: using pulumi-resource-openwrt from $PATH at /home/paul/go/bin/pulumi-resource-openwrt
I can only guess it's complaining about this line: https://github.com/deposition-cloud/pulumi-openwrt/blob/109b949f89b1cb83cbdc3be8244cdd3eb5d97900/provider/resources.go#L83 (?) Am I returning the right thing here: https://github.com/deposition-cloud/pulumi-openwrt/blob/109b949f89b1cb83cbdc3be8244cdd3eb5d97900/provider/resources.go#L187
Copy code
return pf.ProviderInfo{
		ProviderInfo: prov,
		NewProvider: func() pfprovider.Provider {
			return openwrt.New(version.Version, os.LookupEnv)
		},
	}
e
This make task doesn't seem to add anything to the PATH
Ah right some of our provider makefiles build directly to /go/bin, assumed this one was the same. Just symlinking works.
I can only guess it's complaining about this line
That pluginUrl looks fine. It might be you just need to update the deps in go.mod to the lastest version of github.com/pulumi/pulumi-terraform-bridge/v3 and github.com/pulumi/pulumi-terraform-bridge/pf
b
Only as a small sidenote. I always perform intial tests for a new Pulumi provider, e.g. which has been wrapped by using the TF bridge, with a YAML program. The advantage of Pulumi YAML is that the provider executable only needs to be present in the path. The complete (correct) setup, e.g. for Node via yarn link, can then be omitted for the time being.
👍🏼 1
s
@echoing-dinner-19531 hm, upgrading seems to break the contract https://github.com/pulumi/pulumi-terraform-bridge/blob/master/pf/tfbridge/main.go doesn't export a
ProviderInfo
struct anymore, so the code I shared above breaks @big-architect-71258 - any plans to upgrade your cookiecutter?
b
@straight-cartoon-24485 Mind opening an issue in my repo? And I think the issue might stem from a breaking change in TF PF mentioned by @orange-policeman-59119 a couple of weeks ago. But I didn't have any time to look at it or even incorporate the required changes into the template yet.
👍 1
@straight-cartoon-24485 I just published v0.0.12 of the Cookiecutter Template with fixes to the breaking change mentioned in the issue you opened. @billowy-army-68599
❤️ 2