Hello, I'm trying to use <https://github.com/pulum...
# general
d
Hello, I'm trying to use https://github.com/pulumi/pulumi-component-provider-py-boilerplate to build my own component resource. I have packaged my component and installed it with
pulumi plugin install resource  xyz 0.0.1 --file ./dist/pulumi-resource-xyz-v0.0.1-linux-amd64.tar.gz
. But the last thing I can not find in the doc, it's how to use the plugin/resource in my main (python) code. Can someone help me with that ? Thanks !
b
@delightful-napkin-38557 you need to import the sdk into your venv with
pip3 install -e sdk/python/bin
then you can just import it
d
where is this sdk folder ? in the source of my plugin ?
b
it should have been generated, what did you run in your process? have you run
make generate
?
d
yeah
but what the point of running
plugin install
?
pip3 install -e .../sdk/python/
works, thanks ! But I just don't get the
pulumi plugin install --file ...
command. It seems useless ?
b
its not useless, the plugin provider is what talks via grpc to the pulumi engine
so the SDK is used to author your program, the plugin binary is what communicates with the engine. you need both
d
ha ! ok !
So I need the plugin install only when I run pulumi, not when I write the code
b
that's right, when you run
pulumi up
if you set the right fields in your
resources.go
and publish the tarball to github releases, it'll get installed automatically for users
d
So the sdk is the python/go/... modules
b
correct!
d
what's the resources.go ?
b
oh sorry, i meant your schema.json
d
ok
Copy code
if you set the right fields in your resources.go and publish the tarball to github releases, it'll get installed automatically for users
when ? when the user install the plugin with
pulumi plugin install
?
b
yeah sorry,
resources.go
should be switched for
schema.json
d
ok
b
if you set the
pluginDownloadUrl
the user never has to run
pulumi plugin install
they just do
pip3 install <name>
and it autoacuires the plugin
d
wow ! the pip install will install the plugin by itself ?!
b
yup
d
nice !
that's what I was looking for !
thanks a lot for your help !
last question, what's the good name of that: plugins/packages/component/component resource/OTHER ?
b
of what, sorry?
d
of the plugin
b
we call the plugin binary the plugin binary 🙂
d
because the command line says "plugin", the boilerplate says "component", and the doc seems to say "package"
b
a package is a plugin + a component
d
I mean the repository which contain the source of the "plugin"
what the right name ? component ?
ok ! thanks a lot !
b
we call this a multi language package a multi language package consists of a component and a plugin binary
d
perfect this is so clear now !
thanks again
a
Nice, I got it working, but with one caveat, which I am not quite sure now. When I run pulumi up, it returns a warning saying: warning:
resource plugin zpa is expected to have version >=0.0.1-alpha.1654199673, but has 0.0.1-alpha.1653983237+fff10f33.dirty; the wrong version may be on your path, or this may be a bug in the plugin
This is what was generated in the SDK under the path sdk/python/bin/dist/ Any ideas here, what I might be missing?
b
@acoustic-tiger-77630 looks like you built a binary and put it in your
$PATH
with a git working tree without commits 🙂
a
Hi @billowy-army-68599 Thanks for the insight. Yes, had forgotten to commit 🙂 . But even after that still get eh same warning message. On the other hand, when I look at my path (in my case I am using $GOPATH) I don see the pulumi-resource-xyz (In my case would be pulumi-resource-zpa). What am I missing?
b
what does
which pulumi-resource-zpa
return?
pulumi-resource-zpa
is somewhere on your
$PATH
or in
~/.pulumi/plugins
somewhere
a
It actually returns not found.
In plugins I see the resource-zpa-v0.0.1 but not pulumi-resource-zpa
b
What does pulumi plugin ls return
a
ok… I think I got it… I had to first run the make provider, which will generate the binary pulumi-resource-zpa and then I have to move it into my $GOPATH/bin, but I still receive the same warning about the mismatched version. It runs successfully though. But it is an annoying warning, and I can’t figure it out how to fix it for now. I’ll have to dig a little deeper to find out.
Thanks for all your help so far @billowy-army-68599