Is there still yet not a way to have a pulumi’s re...
# general
g
Is there still yet not a way to have a pulumi’s resource_name be generated using an Output[T] component? I’d really like to be able to leverage a previous resource’s Output properties as part of generating a resource_name (which becomes part of the URN) when constructing another dependent resource off it…
👀 1
The alternative to this still seems to be creating resources in callbacks, which is/was discouraged last time I checked?
g
I remember at least in the JS/TS sdk I sent a PR exactly to support resources inside the apply callback (long time ago and I don't have that use case anymore, so I'm not sure if support for this was dropped). The derived resource won't appear in a preview when the parent doesn't exist. I think that is why is not recommended
g
That makes sense… if the parent does exist though or you are explicit by setting a parent=, I can’t see why this would be dangerous then…
even in the callback enclosure the scope of the parent should be available depending on how you make it available .. at least, In python the outer variable scope is available to it..
l
Why would you not use the previous resource's resource_name when building the new resource's resource_name? If you're dependent on the output of one resource to start building the next, then you need the Pulumi engine to run twice...
If you imagine that all Output values are only available hours after the Pulumi program is started, that might help.
Pulumi can't build a deploy-time dependency map for resources that can't be added to the map until after the deployment is finished...