Extension cannot run on Windows
dwalker-sabiogroup opened this issue · comments
I have installed the infracost extension and followed the installation instructions. Infracost executable has been added to the path and registered for an API token successfully.
When opening a terraform file in VSCode a pop is shown with the following error
Could not run the infracost cmd in the c:\Users\dwalker\terraform directory. If this is a multi-project workspace please try opening just a single project. If this problem continues please open an issue here: https://github.com/infracost/vscode-infracost.
The Log (Windows) output shows
[2022-06-30 09:39:32.058] [renderer1] [error] [Extension Host] Infracost cmd error trace Error: Command failed: INFRACOST_CLI_PLATFORM=vscode infracost breakdown --path c:\Users\dwalker\terraform --format json --log-level info
'INFRACOST_CLI_PLATFORM' is not recognized as an internal or external command,
operable program or batch file.
If I run the command in Windows cmd I get the same error message but I am able to run the command in Git Bash successfully and see the JSON output for the terraform resources.
Possible solution
Remove the INFRACOST_CLI_PLATFORM
environment variable as it is not mentioned in the infracost docs or refactor the command to be OS agnsotic.
Environment
OS: Windows 10
VSCode version: 1.68.1
Infracost version: Infracost v0.10.6
Extension version: 0.1.7
@dwalker-sabiogroup thanks for raising this issue, I've got a fix for this in master which will be released in 0.1.8 of the extension. I'm just publishing this now, it would be good if you could give that version a whirl and see if it works on your machine.