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

adorable-gpu-98268

03/19/2022, 8:02 PM
Can I use auto-naming of resources with dynamic resource providers? Or do I have to implement the auto-naming logic myself?
e

echoing-dinner-19531

03/19/2022, 9:22 PM
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

adorable-gpu-98268

03/20/2022, 11:30 AM
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

echoing-dinner-19531

03/20/2022, 1:07 PM
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

most-gigabyte-40961

02/24/2023, 8:19 AM
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

echoing-dinner-19531

02/24/2023, 7:57 PM
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.
27 Views