I'm wanting to generate a docker container style n...
# general
f
I'm wanting to generate a docker container style name like "sad_panda" or "amazing_aardvark", use that to name a resource, and store it in state. I've used
@pulumi/random
to generate things and store them in state. However, I don't see any sort of generic construct to do this. Does this need to be a custom provider?
l
For which resources? Most resources have a
name
parameter that does what you want.
f
My experience in the past is that if I were to pull in some other name generator, it would attempt to generate a random value for the
name
and attempt a rename of the resource.
Essentially, I'm looking for something to run the name generation the first time, then just retrieve from state all subsequent calls, similar to the pulumi random
Hopefully, I'm not thinking about this incorrectly
b
@few-carpenter-12885 this is what
RandomPet
does: https://www.pulumi.com/registry/packages/random/api-docs/randompet/
f
Ah, I did see that package, makes sense. What is the preferred way to duplicate then modify this functionality? Create a class that
extends pulumi.CustomResource
?
e
Are you trying to set the resource name via this? That's not really supported right now, the name is what tells us what to look up in state, you can't build the name based on something in state because until you have the name you can't look up anything in state...