Pulumi Provider Functions #11748
-
I am trying to better understand how the pulumi provider functions and methods work. I started with, https://github.com/pulumi/pulumi-component-provider-py-boilerplate, and picked through it. The component resources I find are fairly straight forward. I can see how the token is used for code generation of the sdk and how it is used to create the construct in provider. I can't quite figure out how the functions work. I have defined my function in the provider to return a string as a test. I updated my schema and after generating sdk I can see the function there. Specifically, I'm trying to under how the It's obvious the entry point for instantiating a construct is in the provider.py code where it gets the class from resources but not so obvious with functions and methods. I tried looking through pulumi-aws for their functions, like get_dns_name, but it's in go and not clicking for me with all the imports. https://www.pulumi.com/docs/intro/concepts/resources/functions -> shows how you could make use of them but I don't see anything about configuring them. Also, looked at https://github.com/pulumi/pulumi/blob/master/developer-docs/providers/implementers-guide.md, but it is just a paragraph on uses. Any recommended docs or places to look would be welcome. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
For functions, your Resource methods are similar, but are implemented inside |
Beta Was this translation helpful? Give feedback.
For functions, your
Provider
subclass will need an implementation ofinvoke
, similar toconstruct
, that checks to see if thetoken
is"example::argFunction"
.Resource methods are similar, but are implemented inside
call
rather thaninvoke
. See https://www.pulumi.com/blog/resource-methods-for-pulumi-packages/ for more details.