Good afternoon, I'm trying to setup infracost bot...
# help
a
Good afternoon, I'm trying to setup infracost both within my IDE (VS Code) as well as for a comment within my PRs. Locally I run Windows, VSCode. Our git repos are in Azure DevOps and we use Azure Pipelines. For now I'm only interested in running infracost as the free plan. We are starting up to use Azure, but our costs are not very high yet, but they are expected to rise in the future so we're implementing basic finops measures, which could be extended later on. The terraform projects I'm running are using both modules from the repository as well as from AVM (so online). Not detecting projects In the root of my project I have statically defined my projects like this:
Copy code
version: 0.1
projects:
  - path: terraform/apps/conn
    name: conn
    terraform_var_files:
      - env/con-production.tfvars
  - path: terraform/apps/kko
    name: kko-startup
    terraform_var_files:
      - env/kko-startup.tfvars
  - path: terraform/apps/mgt
    name: mgt
    terraform_var_files:
      - env/mgt-production.tfvars
  - path: terraform/apps/szg
    name: szg-startup
    terraform_var_files:
      - env/szg-startup.tfvars
It looks like they are recognized during the scan, but not during the PR comment. In the PR comment I see a table with the projects like this: Changed project - Module path DevOpsOrg/DevOpsProject/Azure - terraform/apps/kko DevOpsOrg/DevOpsProject/Azure - terraform/apps/szg DevOpsOrg/DevOpsProject/Azure-production - terraform/apps/mgt DevOpsOrg/DevOpsProject/Azure/terraform/apps/kko - terraform/apps/kko DevOpsOrg/DevOpsProject/Azure/terraform/apps/mgt-production - terraform/apps/mgt DevOpsOrg/DevOpsProject/Azure/terraform/apps/szg - terraform/apps/szg The costs are being moved around, maybe that is because this is the first run, but it looks like the projects are being autodetected, which I also see in the output of the tasks: 2026-08-18T092928Z INFO Autodetected 4 Terraform projects across 4 root modules - Local scan in VS Code does not work When I run infracost scan locally all projects either error out with the error below, or the scan runs for hours and never finishes: 2026-08-18 110910.674 [error] time=2026-08-18T110910.671+02:00 level=ERROR msg="analyzeFullScan: project scan failed" name=szg-startup error="parsing: rpc error: code = DeadlineExceeded desc = context deadline exceeded" elapsed=1m0.3333715s In the meantime, the extension says it's scanning the workspace, which does not end. It just keeps on scanning without any output or error message. I've ran Infracost doctor: Infracost Doctor 2.16.2 - running 7 checks Authentication ✔️ Credentials found ✔️ Token valid ✔️ Organization accessible "hagaziekenhuis" ✔️ API reachable (385 ms) CLI ✔️ Version 2.16.2 (latest) Configuration ✔️ Config file valid ✔️ Default org set (hagaziekenhuis) ✔️ 7 passed An I've also cleaned up the cache: infracost cache clear ✓ Cache cleared. After clearing the cache, when running command below I get popups for GitHub, even though this is Azure Repos: infracost breakdown --path=. --format=json --out-file=./breakdown.json !
infracost breakdown
is deprecated, running
infracost scan
instead. ✔️ Plugins up to date ⡿ Scanning... ⣾ Scanning... ⣾ Scanning... ⣾ Scanning... ⢿ Scanning... - I also get messages in vscode that the ls has a new version, but when trying an update it says: 2026-08-18 115659.269 [error] time=2026-08-18T115659.268+02:00 level=ERROR msg="method error" method=infracost/update duration=1.0762821s error="replacing binary: rename C:\\Users\\sjoer\\.vscode\\extensions\\infracost.infracost-0.4.17-win32-x64\\bin\\.infracost-ls-update-1706734103 C\\Users\\sjoer\\.vscode\\extensions\\infracost.infracost 0.4.17 win32 x64\\bin\\infracost ls.exe Access is denied." - And a final additional question, is the cli within vscode included in the free edition? Because I don't see anything about that on the pricing page.
w
@adventurous-nail-5992 any ideas re the vscode issue? @astonishing-morning-76605 yes the CLI within the vscode is part of the free edition, though after the trial period only the cost estimates work (i.e. tagging policies, guardrails, finops policies will not show-up in vscode as those are part of the paid product)
a
@white-airport-8778, thank you, that is all that I want (for now), if I can get it working.
b
@astonishing-morning-76605 how have you setup the pipeline on ADO? Can you try explicitly pointing to the config file using the
--config-file
flag?
the timeout/hanging for hours has me wondering if it's running into a problem importing a module. Are there any modules that point to private repositories? Is there possibly a git credential manager dialog/popup hidden somewhere behind an open window?
If possible, adding the azure repos app in infracost cloud is the simplest way to get the PRs working.
a
@brash-barista-9591, when I do the config file flag it says unknown flag:
Copy code
infracost scan --config-file infracost.yml
Info: unknown flag: --config-file

infracost --version
infracost version 2.16.2
Note that I'm on Windows in a powershell. > Are there any modules that point to private repositories? No, we only use modules from AVM and modules that are in the repo itself, under terraform/modules > Is there possibly a git credential manager dialog/popup hidden somewhere behind an open window? Not as far as I could tell, after days of trying I think I should have seen that. > If possible, adding the azure repos app in infracost cloud is the simplest way to get the PRs working. Actually I did install that. When in the dashboard I go to repos I still only see the auto-detected projects, not the defined projects from my static file. Note that the PRs are working technically, it's just not seeing the projects correctly, making it look weird. My biggest issues is that: • the projects are not detected correctly and that the static file is not being recognized/picked up. • infracost is not working locally in my vscode
b
Hey @astonishing-morning-76605 just wanted to let you know we've not forgotten about this. There's a couple of windows-specific bugs you've caught in VSCode here that the team is fixing, I'll let you know when an update has shipped and you can update (unlikely to happen before next week).
I wanted to clarify something though as I think we talked past each other. With you CICD setup, did you add it by clicking one of the buttons in the Infracost Cloud web interface like below?
Or did you wire it into a pipeline yourself?
a
@brash-barista-9591, good to hear from you. I'm patient, let me know when I can test. The CICD part is a pipeline I created myself based on the documentation example.
b
That's what I thought. Which explains some of the confusion too, as our custom CI pipeline for Azure is not yet compatible with the v2.x of our CLI and needs to continue using the 0.10.x versions. So for the PR comment you'll need to use the older version, which will accept the config file argument that I previously mentioned.
a
@brash-barista-9591 The older version? Where do I get that one for local use, and how do I install that for the pipeline. For local use I did
choco install infracost
and in the pipeline I have:
Copy code
- task: InfracostSetup@2
        displayName: Setup Infracost
        inputs:
          apiKey: $(infracostApiKey)
          currency: EUR
b
Here's the 0.10.45 releases: github.com/infracost/infracost/releases. How are you currently getting it installed in the pipeline? choco there too or some other package manager?
a
@brash-barista-9591, in the pipeline I use the task I've set above:
Copy code
- task: InfracostSetup@2
        displayName: Setup Infracost
        inputs:
          apiKey: $(infracostApiKey)
          currency: EUR
@brash-barista-9591, I've installed the infracost 0.10.45 version. When running
infracost breakdown --config-file infracost.yml
which detects the correct projects and analyzes the costs. I need to check some things but it mostly seems to work. So, local run is now ok. Extension in VS code The extension in VS code does not work. It does now recognize the correct projects, however, all scans still timeout, with basically this error:
Copy code
2026-09-04 15:46:48.886 [error] time=2026-09-04T15:46:48.885+02:00 level=ERROR msg="parse: Parse failed" error="rpc error: code = DeadlineExceeded desc = context deadline exceeded"
2026-09-04 15:46:48.933 [error] time=2026-09-04T15:46:48.932+02:00 level=ERROR msg="loadConfigAndScan: project scan failed" name=kko-startup error="parsing: rpc error: code = DeadlineExceeded desc = context deadline exceeded" elapsed=10m0.0469097s
Any help on that? CICD I still need to check the cicd, but could you check on how to get the correct version into the pipeline when using the task 'InfracostSetup'? Thanx, I appreciate the help.
b
@astonishing-morning-76605 apologies for the delay on this. You've highlighted this is messy enough on Azure that we're going to fix the CICD experience for Azure so it can use our latest tooling properly. Engineers are working on it as we speak, I'll circle back the moment it lands so we can get you on the new stuff ASAP.
a
@brash-barista-9591 Ah good to hear, so you're basically saying, don't touch the CICD stuff, we'll fix it?
b
Yep! I'm doing some QA on it this afternoon, so it's close!
@astonishing-morning-76605 I've gone through the Azure docs a few times now and we've ironed out the remaining issues. They're now public and should be able to get you setup with the > 2.0 version of Infracost: infracost.io/docs/integrations/azure_pipelines
a
@brash-barista-9591 Wow, I had scheduled to ask about the status for today as I have to continue this tomorrow 🙂 . I'll let you know how it goes!
🎉 1
b
The new version has coverage for a lot more resources than the previous one you were trying to get running, and if you're an infracost customer (or using the free trial) will also automatically pull any tagging policies, finops policies, guardrails, etc. and block the build if you have those setting enabled.
a
@brash-barista-9591, yes this one works. I have a few notes though: • The pipeline needs v2 CLI tokens, which is not mentioned in the documentation. • I think I found a bug regarding the Tagging policy check. We use the free edition, but I still got notified for not complying with the tagging policy. I checked the dashboard but the tagging policy is not available to us. Thanx so far!
🙌 2
b
I'll get the team to look at both, really appreciate the feedback. Thank you 🙂