https://pulumi.com logo
Title
a

agreeable-notebook-99278

06/12/2022, 1:00 AM
Hi all — Is it possible to simplify this or do I have to always list all properties on
staticSite
to get to them? I.e. first I tried
.all([staticSite]).apply([{id, name, defaultHostname}])
-> error
p

prehistoric-london-9917

06/12/2022, 7:50 PM
I’m not sure of your exact use case, but you might be able to do something like:
pulumi.output(staticSite).apply(site => console.log(site.id, site.name));
a

agreeable-notebook-99278

06/12/2022, 8:16 PM
Ah interesting. So .output might resolve all properties — I‘ll try that next time I tinker with it. Have never worked with the azure cli before… and kinda get into this top down on free time. Have the feeling that when you know how the underling cloud api works, this would be much much easier.
p

prehistoric-london-9917

06/12/2022, 8:43 PM
Yeah,
pulumi.output()
is a good shortcut for a number of things since most times, Pulumi resources can take
pulumi.Output<T>
as inputs, it’s a way of quickly wrapping something into an
Output
. I use it often for things like AWS account ID or regions, like:
new aws.something.Something({region: pulumi.output(aws.getRegion()).name, ...});
Saves you from having to wrap things in a
aws.getRegion().then(…)
scenario.
a

ancient-car-89914

06/13/2022, 4:52 AM
I’m curious what exact error you got when trying the first way @agreeable-notebook-99278 - I would have assumed that would have worked
a

agreeable-notebook-99278

06/14/2022, 12:44 AM
.all([staticSite]).apply([{id, name, defaultHostname}])
just gives you a prototype of the object (callable functions) 🤷‍♂️🏻
b

bright-horse-50102

06/14/2022, 11:03 PM
you need another set of parentheses and the function body
e.g.
.all([staticSite]).apply(([{id, name, defaultHostname}]) => {
  // ...
})