infracost / vscode-infracost

See cost estimates for Terraform right in your editor💰📉

Home Page:https://www.infracost.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extension errors and does not show cost analysis above resources in editor

dennislaf opened this issue · comments

Having trouble with the vscode extension. the left sidebar is showing all my directories and their associated costs, but in the editor i am not getting any real time update info, it’s just the normal text editor. i get no pop ups or “total monthly cost” line to click to break down.

Screen Shot 2023-06-28 at 11 43 03 AM

vscode version: 1.79.2
infracost extension: v0.2.13
terraform extension v2.26.1
macos 12.6.2

I am seeing errors in the extension debug logs from the terraform extension every time infracost runs an update after I save

errors I am seeing:
2023-06-28 11:57:29.234 [error] [hashicorp.terraform] provider FAILED
2023-06-28 11:57:29.234 [error] Error: main.tf (49,25): position outside of any attribute name, value or block
at /Users/xxx/.vscode/extensions/hashicorp.terraform-2.26.1-darwin-x64/out/extension.js:1:387194
at re (/Users/xxx/.vscode/extensions/hashicorp.terraform-2.26.1-darwin-x64/out/extension.js:1:387488)
at /Users/xxx/.vscode/extensions/hashicorp.terraform-2.26.1-darwin-x64/out/extension.js:1:382272
at Immediate. (/Users/xxx/.vscode/extensions/hashicorp.terraform-2.26.1-darwin-x64/out/extension.js:1:382292)
at process.processImmediate (node:internal/timers:466:21)

after uninstall and reinstall of both infracost and terraform extensions, i am seeing a new error:
2023-06-28 12:05:55.059 [error] [hashicorp.terraform] provider FAILED
2023-06-28 12:05:55.059 [error] Error: no reference origin found
at /Users/xxx/.vscode/extensions/hashicorp.terraform-2.26.1-darwin-x64/out/extension.js:1:387194
at re (/Users/xxx/.vscode/extensions/hashicorp.terraform-2.26.1-darwin-x64/out/extension.js:1:387488)
at /Users/xxx/.vscode/extensions/hashicorp.terraform-2.26.1-darwin-x64/out/extension.js:1:382272
at Immediate. (/Users/xxx/.vscode/extensions/hashicorp.terraform-2.26.1-darwin-x64/out/extension.js:1:382292)
at process.processImmediate (node:internal/timers:466:21)

Thanks @dennislaf, as mentioned on our slack conversation this looks like something going wrong with the Terraform extension which we use to get the file symbols so that we can show the code lens. Give me some time to replicate this and work out possible solutions. Just for further context, what does the Infracost error logs show?

debug: found project <directory> 
debug: adding file: <directory> to project: <directory> (several of these logs)
debug: setting context infracost:error to undefined

A user reported an issue that might be related?

image

debug: running "infracost breakdown --config-file d:\xxx\xxx\GLOBAL-INFRA\infracost.yml"
debug: found project GLOB - Dev - AU
...
debug: adding file: d:\xxx\xxx\GLOBAL-INFRA\env\.modules\applications\xxx\main.tf to project: d:\xxx\xxx\GLOBAL-INFRA\env
debug: rebuilding Infracost tree view after project run
debug: setting context infracost:error to undefined
Infracost Extension version: 0.2.17
Hashicorp Terraform Extension version: v2.27.2
Edition	Windows 11 Enterprise
Version	22H2
Installed on	‎29/‎06/‎2023
OS build	22621.2134
Experience	Windows Feature Experience Pack 1000.22659.1000.0

hi @dennislaf, we've released a fix in v0.2.18 for the issue @alikhajeh1 mentioned. It might solve your issue, if you could download it and give it a whirl that would be much appreciated. Otherwise I'm working on dropping the hashicorp extension dependency, which should hopefully fix this issue for good.