https://pulumi.com logo
Title
m

mysterious-australia-14256

07/13/2021, 2:05 PM
I am trying to create a new Web.Connection object for connecting to a Service Bus. The Service Bus is created earlier in the stack and when I create the Connection I need to specify the PrimaryConnectionString from the this Service Bus as a ParameterValue. I am trying to look up the PrimaryConnectionString using Pulumi.AzureNative.ServiceBus.ListNamespaceKeys but this fails if the Service Bus doesn't already exist. Is there a way around this i.e. to look up the string only after the Service Bus has been created and not progress the creation of the Connection until this has been done?
t

tall-librarian-49374

07/13/2021, 2:07 PM
You likely need to call
ListNamespaceKeys
from within an
namespace.Name.Apply()
(or
Output.Tuple
) similar to https://github.com/pulumi/templates/blob/master/azure-csharp/MyStack.cs#L26
This ensures that the call happens after the resource is created
m

mysterious-australia-14256

07/13/2021, 2:19 PM
ah easy when you know how 🙂 Thanks @tall-librarian-49374
t

tall-librarian-49374

07/13/2021, 2:20 PM
In mid-term, we’ll reduce the need for that in https://github.com/pulumi/pulumi/issues/5758
👍 1