https://pulumi.com logo
Title
g

glamorous-helmet-50600

04/06/2021, 10:24 AM
What's the best way to unwrap all the outputs of a component to then apply some custom logic (e.g., seed a database container)? What I'm trying to do is to seed a cosmos container when the CosmosComponent (ComponentResource) is created..feels like I need to chain Apply() methods in order to unwrap all the properties I need for the CosmosClient
t

tall-librarian-49374

04/06/2021, 10:38 AM
chain Apply() methods
You can use
Output.Tuple
(assuming C#) instead of chaining, as in https://github.com/pulumi/examples/blob/master/azure-cs-appservice/AppServiceStack.cs#L130
g

glamorous-helmet-50600

04/06/2021, 10:44 AM
Ah nice that's very useful thank you. Also, is it reasonable to use apply like that - to cause side-effects rather than just returning another output? I can't think of a better way for seeding a container using C#
t

tall-librarian-49374

04/06/2021, 10:45 AM
It’s okay if you are fine with it running multiple times - every
up
basically
g

glamorous-helmet-50600

04/06/2021, 10:45 AM
yeah should be fine, thanks
t

tall-librarian-49374

04/06/2021, 10:46 AM
We still don’t have dynamic providers for C# that would be a better option