Can I use auto-naming of resources with dynamic re...
# general
a
Can I use auto-naming of resources with dynamic resource providers? Or do I have to implement the auto-naming logic myself?
e
You have to implement it yourself. Its nothing very complex though just "is the 'name' in new use that, else is 'name' in olds use that, else make a random string"
https://github.com/pulumi/pulumi/blob/master/sdk/go/common/resource/resource_id.go#L67 <- that's the go code to make the hex strings. Should be pretty easy to do something similar in python or javascript.
Also open to thoughts about how we could expose a way to do this for the user
a
Okay, thanks 🙂
Btw. regardign the “news” and “olds” arguments for “diff()“, they are not working, how I expected them to work. I values in “news” even though they didn’t change and they are not in “olds”. How exactly does that work?
e
News is the input values that the program has declared in this run. Olds is the saved inputs returned by
Check
from the last run.
Ah the above is olds and news for
Check
Olds and news for diff is similar, but in that case olds is the old "outputs" returned from Create/Update from the last run, and news is the new inputs from the program after having gone through
Check
There's been suggestions to define type parameters for all these on the ResourceProvider interface so it's easier to keep track of
m
Can I use auto-naming of resources with dynamic resource providers?
i was about to ask the very same thing, good think i used search first 😄 Is there any way to access the logical name of the resource during the Create method in a dynamic provider (to fully re-create pulumi's default behaviour for physical name generation)?
e
Not on the current dynamic providers. That's an oversight I'm looking to correct in the next version, and for example the (currently not public) C# dynamic providers get all the same parameters in Create as a normal non-dynamic provider would, including the resource name.