https://pulumi.com logo
Title
r

red-scooter-62880

10/25/2022, 12:57 PM
Hi. I just want to follow up if it is now possible with Pulumi Automation API to get the SKU of a service when running Preview() method? Last time I asked it appeared it was not possible.
e

echoing-dinner-19531

10/25/2022, 1:27 PM
SKU of what service?
r

red-scooter-62880

10/25/2022, 1:28 PM
It could be SKU of Azure Virtual Machine for example B2s. I need to know the SKU that is sent to Automation API so I can generate a price estimation for it
e

echoing-dinner-19531

10/25/2022, 1:32 PM
Right, and how are you trying to get that info out of automation api? By just looking at Input<T>s before they're set as resource inputs?
r

red-scooter-62880

10/25/2022, 1:33 PM
Yes that could be an option but I am not able to specify inputs
even better would be to get it from preview output
because then it has been through graph dependcy modelling
to determine if it already exists
e

echoing-dinner-19531

10/25/2022, 1:34 PM
Ah yeh ok, which automation api language are you using?
r

red-scooter-62880

10/25/2022, 1:35 PM
C# and typescript
I would prefer a code example for C#
then I can infer to typescript
e

echoing-dinner-19531

10/25/2022, 1:35 PM
k I'm just having a look if theres anything on automation api for this
r

red-scooter-62880

10/25/2022, 1:36 PM
Thank you very much!
e

echoing-dinner-19531

10/25/2022, 1:38 PM
I think if you pass the
Diff
option to preview, the StandardOutput text will have the full diff of all resources in it, although parsing that would be a pain (I've got plans to overhaul automation api to not just return big text strings but it's a while off yet 😞 ) One of our old sales guys had an example of doing price estimates via policy packs for aws: https://github.com/clstokes/pulumi-policy-aws-cost Might be that makes more sense for you rather than trying to hook Preview results directly.
r

red-scooter-62880

10/25/2022, 1:39 PM
thanks
the cost estimation works
I just need the diff output in json preferably
but yeah I understand it has not been implemented yet, though the automation api would be much better with json output
e

echoing-dinner-19531

10/25/2022, 1:41 PM
yeh I have no idea why automation api doesn't default to json output everywhere, it doesn't even look like it supports turning json output on for Preview at the moment
r

red-scooter-62880

10/25/2022, 1:41 PM
Ideally I would like all the input for a given resource such as a Virtual Machine for example attached disks, load balancers, nics, public ips and so on to accurately do cost estimation
e

echoing-dinner-19531

10/25/2022, 1:43 PM
I think I'll have to raise a PR to get json output added as an option, doesn't look like theres a way to set that right now.
r

red-scooter-62880

10/25/2022, 1:47 PM
that would be absolutely fantastic
I have a client that I cant deliver a solution to before this is implemented
e

echoing-dinner-19531

10/25/2022, 3:08 PM
r

red-scooter-62880

10/25/2022, 3:21 PM
thanks
looking forward to it getting approved
I can see the pr has been approved. have a new version of pulumi automation api been released then as well?
e

echoing-dinner-19531

10/25/2022, 9:25 PM
No it will be in the next release, I think we'll be doing 3.44.2 tomorrow.
r

red-scooter-62880

10/26/2022, 10:06 PM
Thanks it is a tremendous help that you have coded a solution so quickly 😀