Hi. I just want to follow up if it is now possibl...
# general
r
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
SKU of what service?
r
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
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
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
Ah yeh ok, which automation api language are you using?
r
C# and typescript
I would prefer a code example for C#
then I can infer to typescript
e
k I'm just having a look if theres anything on automation api for this
r
Thank you very much!
e
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
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
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
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
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
that would be absolutely fantastic
I have a client that I cant deliver a solution to before this is implemented
e
r
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
No it will be in the next release, I think we'll be doing 3.44.2 tomorrow.
r
Thanks it is a tremendous help that you have coded a solution so quickly 😀