Infracost's VS Code extension shows you cost estimates for Terraform right in your editor! It also surfaces FinOps policies and tagging issues so you can catch problems before they reach production.
See cost estimates as code lenses directly above Terraform resource definitions. Costs update as you edit.
Click a code lens to open the resource details panel, showing a full cost component breakdown, FinOps policy violations, and tagging issues.
The extension highlights FinOps policy violations (with risk, effort, and potential savings) and tag policy issues directly in the sidebar. Blocking violations are clearly marked.
In addition to Terraform (.tf) files, the extension supports CloudFormation templates in YAML and JSON.
Note
Prerequisites: Make sure you have VS Code v1.75.0 or above and an Infracost account. See Requirements for details.
Open VS Code and go to the Extensions view (Ctrl+Shift+X / Cmd+Shift+X). Search for Infracost, select the extension published by Infracost, and click Install.
Alternatively, use the Quick Open command:
ext install Infracost.infracost
Installing a pre-release version
Download the .vsix file for your platform from the latest pre-release. Then install it manually:
code --install-extension infracost-0.2.35-darwin-arm64.vsixOr in VS Code: open the Command Palette (Cmd+Shift+P / Ctrl+Shift+P), run Extensions: Install from VSIX..., and select the downloaded file.
Tip
Using a different IDE? See the official installation docs for instructions on other supported editors.
Open the Infracost sidebar and click Login to Infracost. This will open a browser window to authenticate your editor with your Infracost account.
Open a workspace containing Terraform files. The extension will start the language server and begin scanning your project. Cost estimates will appear as code lenses above resource blocks.
Use our CI/CD integrations to add cost estimates to pull requests, giving your team visibility into cloud costs as part of your workflow.
- VS Code v1.75.0 or above
- An Infracost account
| Setting | Description | Default |
|---|---|---|
infracost.serverPath |
Path to the lsp binary. Leave empty to use the bundled binary. |
(bundled) |
infracost.runParamsCacheTTLSeconds |
How long (in seconds) to cache run parameters between API calls. Set to 0 to disable. | 300 |
| Command | Description |
|---|---|
Infracost: Login |
Authenticate with your Infracost account |
Infracost: Restart Language Server |
Restart the LSP if it gets into a bad state |
- Open the Output panel (View -> Output).
- Select Infracost from the dropdown to see language server logs.
If you're having issues, please start a thread in GitHub Discussions with as much log information as you can, along with your OS and VS Code version.
We welcome contributions! Please start by opening a thread in GitHub Discussions to discuss your idea before submitting a PR.
To set up a local development environment:
- Clone the repo.
npm installto install dependencies.- Open the repo in VS Code.
- Press F5 to launch the extension in a Development Host window.
- Open a Terraform project to see cost estimates above resource blocks.



