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

elegant-pager-5412

04/26/2021, 5:04 AM
My use case is that I have a
Queue
and a
CallbackFunction
defined and I want to add the
CallbackFunction
as the `Queue`’s event source. I’m trying to use the
queue.onEvent
method to do so, but I’m required to give the
onEvent
a name for the source mapping. I would like that name to just be my lambda’s name and the word
Event
at the end of it. How can I achieve that?
b

billowy-army-68599

04/26/2021, 5:18 AM
This isn’t possible no. If you need to explicitly name a resource in the upstream provider’s api, you can set the name property on that resource but the resource name itself has to be known at runtime
e

elegant-pager-5412

04/26/2021, 5:55 AM
That makes tooling around Pulumi rather hard to do
The current solution I’m investigating is wrapping Pulumi resources in a custom builder class that will eventually build the Pulumi resources but still leaves me access to the raw properties
b

billowy-army-68599

04/26/2021, 6:06 AM
I’m getting a sense from the questions you’re asking that you’re using Pulumi as an SDK, are you aware of the state/declarative model of Pulumi? The reason you cant use outputs as resource names is because if you do, the downstream resource can’t be created until the output is resolved, which breaks the dependency graph
e

elegant-pager-5412

04/26/2021, 8:37 AM
@billowy-army-68599 I see. I’m not really trying to use Pulumi as a SDK. I guess what I’m trying to do is to build constructs around Pulumi. These constructs just encapsulates logic and configure the underlying resources. Do you think it is a bad pattern?