Hi all — Is it possible to simplify this or do I h...
# general
a
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
I’m not sure of your exact use case, but you might be able to do something like:
Copy code
pulumi.output(staticSite).apply(site => console.log(site.id, site.name));
a
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
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:
Copy code
new aws.something.Something({region: pulumi.output(aws.getRegion()).name, ...});
Saves you from having to wrap things in a
aws.getRegion().then(…)
scenario.
a
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
.all([staticSite]).apply([{id, name, defaultHostname}])
just gives you a prototype of the object (callable functions) 🤷🏻‍♂️
b
you need another set of parentheses and the function body
e.g.
Copy code
.all([staticSite]).apply(([{id, name, defaultHostname}]) => {
  // ...
})