Open
Description
Hello,
I'm working with multiple workspaces (with either s3, local or tf cloud backends).
Now I've enabled infracost extension and in vscode I'm getting an error (in the vscode editor):
Could not run the infracost cmd in the /Users/USERNAME/repos/healthscope/Some-Infrastructure 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.
It does work on the cli when I specify the workspace though:
$ infracost breakdown --path . --terraform-workspace dev
Evaluating Terraform directory at .
✔ Downloading Terraform modules
✔ Evaluating Terraform directory
✔ Retrieving cloud prices to calculate costs
Project: Some-Infrastructure/some-aws-shakeout-ec2/app1
Workspace: dev
Name Monthly Qty Unit Monthly Cost
aws_alb.application_load_balancer
├─ Application load balancer 730 hours $18.40
└─ Load balancer capacity units Monthly cost depends on usage: $5.84 per LCU
aws_autoscaling_group.asg
└─ aws_launch_template.apptemplate
├─ Instance usage (Linux/UNIX, on-demand, ) 730 hours $0.00
└─ EC2 detailed monitoring 7 metrics $2.10
aws_cloudwatch_metric_alarm.all_alarms["cpu_high"]
└─ High resolution 1 alarm metrics $0.30
aws_cloudwatch_metric_alarm.all_alarms["cpu_low"]
└─ High resolution 1 alarm metrics $0.30
OVERALL TOTAL $21.10
──────────────────────────────────
28 cloud resources were detected:
∙ 4 were estimated, 2 of which include usage-based costs, see https://infracost.io/usage-file
∙ 22 were free, rerun with --show-skipped to see details
∙ 2 are not supported yet, rerun with --show-skipped to see details
Currently got a 'dev' workspace:
$ terraform workspace list
* dev
Why can't you do something like this in the extension to figure out the active workspace?
terraform_workspace="$(command terraform workspace show 2>/dev/null)"
Any way to fix it?
Metadata
Metadata
Assignees
Labels
Something isn't workingSomething isn't working