https://pulumi.com logo
#general
Title
# general
d

delightful-napkin-38557

06/02/2022, 8:06 PM
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

billowy-army-68599

06/02/2022, 8:09 PM
@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

delightful-napkin-38557

06/02/2022, 8:12 PM
where is this sdk folder ? in the source of my plugin ?
b

billowy-army-68599

06/02/2022, 8:12 PM
it should have been generated, what did you run in your process? have you run
make generate
?
d

delightful-napkin-38557

06/02/2022, 8:13 PM
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

billowy-army-68599

06/02/2022, 8:19 PM
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

delightful-napkin-38557

06/02/2022, 8:20 PM
ha ! ok !
So I need the plugin install only when I run pulumi, not when I write the code
b

billowy-army-68599

06/02/2022, 8:21 PM
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

delightful-napkin-38557

06/02/2022, 8:22 PM
So the sdk is the python/go/... modules
b

billowy-army-68599

06/02/2022, 8:22 PM
correct!
d

delightful-napkin-38557

06/02/2022, 8:22 PM
what's the resources.go ?
b

billowy-army-68599

06/02/2022, 8:23 PM
oh sorry, i meant your schema.json
d

delightful-napkin-38557

06/02/2022, 8:24 PM
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

billowy-army-68599

06/02/2022, 8:25 PM
yeah sorry,
resources.go
should be switched for
schema.json
d

delightful-napkin-38557

06/02/2022, 8:26 PM
ok
b

billowy-army-68599

06/02/2022, 8:26 PM
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

delightful-napkin-38557

06/02/2022, 8:26 PM
wow ! the pip install will install the plugin by itself ?!
b

billowy-army-68599

06/02/2022, 8:27 PM
yup
d

delightful-napkin-38557

06/02/2022, 8:27 PM
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

billowy-army-68599

06/02/2022, 8:38 PM
of what, sorry?
d

delightful-napkin-38557

06/02/2022, 8:38 PM
of the plugin
b

billowy-army-68599

06/02/2022, 8:39 PM
we call the plugin binary the plugin binary 🙂
d

delightful-napkin-38557

06/02/2022, 8:39 PM
because the command line says "plugin", the boilerplate says "component", and the doc seems to say "package"
b

billowy-army-68599

06/02/2022, 8:39 PM
a package is a plugin + a component
d

delightful-napkin-38557

06/02/2022, 8:39 PM
I mean the repository which contain the source of the "plugin"
what the right name ? component ?
ok ! thanks a lot !
b

billowy-army-68599

06/02/2022, 8:40 PM
we call this a multi language package a multi language package consists of a component and a plugin binary
d

delightful-napkin-38557

06/02/2022, 8:41 PM
perfect this is so clear now !
thanks again
a

acoustic-tiger-77630

06/02/2022, 8:51 PM
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

billowy-army-68599

06/02/2022, 8:54 PM
@acoustic-tiger-77630 looks like you built a binary and put it in your
$PATH
with a git working tree without commits 🙂
a

acoustic-tiger-77630

06/02/2022, 9:32 PM
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

billowy-army-68599

06/02/2022, 9:34 PM
what does
which pulumi-resource-zpa
return?
pulumi-resource-zpa
is somewhere on your
$PATH
or in
~/.pulumi/plugins
somewhere
a

acoustic-tiger-77630

06/02/2022, 9:44 PM
It actually returns not found.
In plugins I see the resource-zpa-v0.0.1 but not pulumi-resource-zpa
b

billowy-army-68599

06/02/2022, 9:47 PM
What does pulumi plugin ls return
a

acoustic-tiger-77630

06/02/2022, 10:02 PM
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
3 Views