Title
#contributors
Duncan

Duncan

03/11/2022, 12:56 PM
So, this is very cool! Browsing a TF repo in VS Code and running
infracost breakdown --terraform-parse-hcl
from a terminal inside it to get costs output in a very short time. I was wondering what the ideas were for further VS integration? Brainstorming a bit: • Hit F5 to run the breakdown? • Run breakdown on save and display the results in a tab? • Integrate with Visual Studio (as opposed to VSCode)? (Not sure how much value there is in this exactly, but I thought at first from the blogpost that's what this was.) • Have a side panel (mockup pictured) which showed you the bottom line, updating whenever you saved or browsed the git history?
Hugo (Infracost)

Hugo (Infracost)

03/11/2022, 12:59 PM
🎉 nice! At the moment we don’t really have any “concrete” ideas for the code editor integration, but I’m really liking the idea of a side panel to provide realtime feedback
1:00 PM
I know @Vadim (Infracost) has some thoughts on how an integration could work
Alistair (Infracost)

Alistair (Infracost)

03/11/2022, 1:00 PM
One thought I had was if it’s possible a metadata above each resource/module in the HCL. For example how “0 references” is shown here:

https://raw.githubusercontent.com/maptz/Maptz.VSCode.Extensions.customfolding/master/imgs/CSharp_region_wrap.gif

Hugo (Infracost)

Hugo (Infracost)

03/11/2022, 1:01 PM
Oooh that’s nice
1:01 PM
blush
Vadim (Infracost)

Vadim (Infracost)

03/11/2022, 1:02 PM
I thought to experiment with LSP, but haven't had a chance yet
Alistair (Infracost)

Alistair (Infracost)

03/11/2022, 1:10 PM
I don’t think it would be too difficult to update the HCL parsing to add files and line numbers as metadata to each resource. Am I right Hugo?
Hugo (Infracost)

Hugo (Infracost)

03/11/2022, 1:11 PM
should be fine
1:11 PM
we already do this a bit to add
id
and
arn
attributes to resources
1:11 PM
it’s essentially the same process
Rory Malcolm

Rory Malcolm

03/11/2022, 1:13 PM
Hugo (Infracost)

Hugo (Infracost)

03/11/2022, 1:14 PM
ah yeah that’s nice
Rory Malcolm

Rory Malcolm

03/11/2022, 1:15 PM
I dont know enough about infracost internals but it would be good if you didn't have to run a breakdown to get the costs and instead it just imputed the costs for each resource on declaration, get it could be a bit heavy though..
Alistair (Infracost)

Alistair (Infracost)

03/11/2022, 1:37 PM
Yeah that’s interesting, we could probably do something to scope it down to resources, so we can process them individually. The complication may come from any interdependent resources