Open gordonmurray opened 2 years ago
Hello @gordonmurray, thanks for raising the first issue on vscode-infracost
🎉 ! Sorry to hear that Infracost is being finicky about your multi-workspace environment. I've got some further questions which will help me debug what's going on behind the scenes:
infracost breakdown --path .
in the top-level folder of the original workspace (the one with over a dozen Terraform projects) and see if you get a successful output.Many thanks
Hi Hugo,
Thanks for responding. Tried those steps just now:
hmm, @gordonmurray could you try posting the following block into a random file in both workspaces (the large and the 2 project one) saving and seeing if you have any prices displayed?
resource "aws_instance" "web_app" {
ami = "ami-674cbc1e"
instance_type = "m5.4xlarge"
root_block_device {
volume_size = 50
}
ebs_block_device {
device_name = "my_data"
volume_type = "io1"
volume_size = 1000
iops = 800
}
}
Are you trying to sneak an ec2 instance in to my account? :)
I added the snippet to the small 2-project workspace, It gave me a cost of $825.98 in the first project but didn't show for the second project.
I added the snippet to one or two projects in the busy workspace also, no output.
I didn't see the Infracost status process at any time in case that should animate or anything.
Haha, bitcoin mining you know... although that might not fetch much these days. Hmm weird, could you:
instance_type
to "m5.8xlarge" and save the fileWhen I open the tf file, even before making a change I get the following output
I tried looking at the file mentioned (/home/gordon/.vscode/extensions/hashicorp.terraform-2.23.0-linux-x64/out/extension.js
) though its minified and doesn't make much sense even if I try to format it.
I could try removing extensions and try it with just Terraform and Infracost.
hmm @gordonmurray I'd just ignore that and see if there's any Infracost output if you scroll. I have a ton of random error logs as well
I removed all but 2 extensions from VS Code ( Terraform and Infracost) in case some other extension was causing an issue, no luck I'm afraid.
While working away for a while, the only output to appear is this:
Overall if this is only happening to me, I'm happy to close this issue if you prefer.
hmm no @gordonmurray I'd love to get to the bottom of this. Would you be open to scheduling a call with me so we can debug together? It would be easier and hopefully, save your time going back and forth.
Sure, Im in a GMT timezone. Suggest a day and time and Ill try to make it.
cool @gordonmurray I'm GMT too, could you ping me an email to hugo@infracost.io and I'll reply back with some time. Thanks
Updates from today's debugging session with @gordonmurray, there are a few bugs here, some of which need further investigation to find out what is going on:
module
calls to a private modules hosted git. I'm wondering if there's some collision going on with filenames.Any update on this? I just discovered Infracost and am seeing the same issue still.
Name: Infracost
Id: Infracost.infracost
Description: Cloud cost estimates for Terraform in your editor
Version: 0.2.6
Publisher: Infracost
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=Infracost.infracost
Version: 1.76.1 (user setup)
Commit: 5e805b79fcb6ba4c2d23712967df89a089da575b
Date: 2023-03-08T16:32:00.131Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Windows_NT x64 10.0.19044
Sandboxed: Yes
Hey @jghal, so just to confirm your issues here's a few follow up questions:
Thanks
debug: setting context infracost:active to true
debug: setting context infracost:loggedIn to true
debug: initializing workspace
debug: running Infracost in project: /home/justin/Code/gitlab.com/ado-agent
debug: running Infracost breakdown
debug: setting context infracost:error to undefined
debug: providing codelens for file /home/justin/Code/gitlab.com/terraform-azure-provisioner/main.tf
debug: initializing workspace
debug: running Infracost in project: /home/justin/Code/gitlab.com/ado-agent
debug: running Infracost breakdown
debug: setting context infracost:error to undefined
debug: providing codelens for file /home/justin/Code/gitlab.com/terraform-azure-provisioner/main.tf
debug: providing codelens for file /home/justin/Code/gitlab.com/terraform-azure-provisioner/main.tf
I did try running infracost breakdown --path
like you suggested earlier in the thread, and that seems to work fine, but I did notice something interesting there. The projects I have in this workspace are the Git repos for the modules we write, rather than the Terraform workspace repos that would include calls to the modules. My goal is to have the module developers seeing the cost impact of the modules in their IDEs, and then also to use the CI integration to see the cost delta in their PRs. The infracost breakdown
command showed data from the tests folder where we have extra TF code to test the module (we use terratest), and not from the module's code itself. The IDE plugin is showing data from the module code, not the tests directory code. I haven't tried looking at a an actual Terraform workspace config project, where we call these modules. I will note that our modules are in private git repos, but we currently use the git repo url as the module source, and would have a Gti credential manager going so that a terraform init
doesn't prompt for pulling every module.
When I added a second Terraform module project to the workspace (so multiple projects, but all of them Terraform module sources), the Infracost overview view showed the added project's price data and not the one that was already present. This could have been just me not waiting long enough though, the extension status icon was showing the animated arrows circle.
I installed the extension this evening, on VS Code 1.68.1.
At first I didn't think it was working. I have a Workspace in VS Code with over a dozen Terraform projects.
I closed the workspace and opened just 1 Terraform project and it worked perfectly.
I added a second folder to the Workspace and it didn't work for the second project, but the first one was still ok, prices changed when appropriate.
My profile has a number of open Terraform projects if that helps debugging.