# infracost/vscode-infracost: Terraform cost estimates in VS Code

> This TypeScript extension connects VS Code to Infracost's language server to display Terraform cost estimates, resource details, FinOps findings, and CloudFormation support. It suits infrastructure developers who want pricing feedback during editing, but it requires an Infracost account and offers only two editor commands.

**infracost/vscode-infracost** — See cost estimates for Terraform right in your editor💰📉

- Repository: https://github.com/infracost/vscode-infracost
- Website: https://www.infracost.io/
- Stars: 1,835 · Forks: 55
- Language: TypeScript
- License: Apache-2.0
- Published: 2026-10-16 · Updated: 2026-10-16 · Language: en
- Canonical page: https://hysenlabs.com/projects/infracost-vscode-infracost

## Why the Infracost extension exists in the editing loop

The extension addresses a timing problem in infrastructure cost estimation. A cloud bill can reveal expensive Terraform decisions only after deployment, while many teams do not inspect cost output until code has passed through a CI/CD workflow. This project moves that feedback into VS Code, placing estimates directly above Terraform resource definitions and updating them as the files change.

The intended user is an infrastructure developer or FinOps practitioner working primarily in VS Code with Terraform. The extension also activates for YAML and JSON, which supports its documented CloudFormation coverage. It does not present itself as a standalone Terraform validator. Its focus is cloud pricing, resource cost composition, policy findings, and tagging issues, including whether a FinOps violation is blocking.

This placement makes the extension more useful during small design decisions, such as choosing among resource configurations, but it also introduces a dependency on account access and pricing services. The README does not document offline behavior, quota limits, estimate precision, or the exact pricing data used for each provider. Those are material adoption boundaries because an editor estimate cannot be interpreted without knowing how current the underlying service response is.

## How VS Code reaches the Infracost language server

The repository is a TypeScript VS Code extension with its entry point at `./dist/extension.js`. It activates for `terraform`, `yaml`, `json`, and `hcl`, matching its Terraform and CloudFormation scope. Rather than calculating every cost inside the extension UI, the documented architecture centers on an Infracost language server binary.

By default, `infracost.serverPath` is empty, which tells the extension to use its bundled binary. A user can provide another path when the bundled server is unsuitable or when debugging is required. The extension starts this language server after authentication and workspace scanning. Its output is connected to code lenses above Terraform resources and to an Infracost webview in the Activity Bar.

Selecting a resource code lens opens a resource details panel. The README describes a full cost component breakdown there, together with FinOps policy violations and tag issues. Findings include risk, effort, potential savings, and blocking status. The Explorer view can optionally include resources originating in remote modules through `infracost.displayRemoteModulesInTree`, although those source files cannot be opened from the tree.

Network configuration is also part of the mechanism. The extension passes VS Code's `http.proxy` setting to the bundled language server unless `HTTP_PROXY` or `HTTPS_PROXY` is already set. The README does not expose the LSP protocol messages, cache schema, or exact request lifecycle, so those internals cannot be assessed from the available documentation.

## Installing and authenticating the extension

VS Code v1.100.0 or later and an Infracost account are required. The supported route is the Extensions view: open it with `Ctrl+Shift+X` on Windows and Linux or `Cmd+Shift+X` on macOS, search for Infracost, select the extension published by Infracost, and click Install.

The documented Quick Open installation command is shown below. It installs the extension identified as `Infracost.infracost`.

```bash
ext install Infracost.infracost
```

After installation, open the Infracost sidebar and click Login to Infracost. A browser window opens for authentication with an Infracost account. This account requirement is not optional according to the README, so an organization that prohibits browser-based authentication or does not issue accounts should rule out this extension before installation.

There is also a manual pre-release path. The README shows a platform-specific `.vsix` command using the filename `infracost-0.2.35-darwin-arm64.vsix`:

```sh
code --install-extension infracost-0.2.35-darwin-arm64.vsix
```

That filename belongs to the documented example and is not the current `v0.4.18` release listed in `package.json`. A user selecting the pre-release path should download the correct file from the latest pre-release rather than treating that example filename as a current package.

## Opening Terraform and reading resource findings

Open a VS Code workspace that contains Terraform files. Authentication allows the extension to start its language server and scan the project. The expected result is an Infracost code lens above each supported resource definition. Because activation also includes YAML and JSON, a CloudFormation workspace follows a related path, but the README does not state whether file detection distinguishes all YAML and JSON files from CloudFormation templates.

Clicking a code lens opens the resource details sidebar. That view is where a reader can inspect individual cost components instead of relying only on the inline total. The same view carries FinOps policy violations and tag policy issues, including risk, effort, potential savings, and whether a violation blocks. This is a meaningful difference from a simple annotation tool: the extension treats financial policy and metadata quality as adjacent concerns to cost.

Two settings affect this workflow. `infracost.currency` selects the estimate currency and defaults to `USD`. `infracost.runParamsCacheTTLSeconds` controls how long run parameters are cached between API calls, with a default of `300`; setting it to `0` disables that cache. The README does not say which results change when the TTL changes or whether policy findings use the same cache.

For pull requests, the README directs users to separate Infracost CI/CD integrations. That distinction matters: the VS Code extension provides local editing feedback, while pull request reporting belongs to another product surface.

## Configuration limits and recovery paths

The extension has a narrow command surface. `Infracost: Login` handles authentication, and `Infracost: Restart Language Server` restarts the LSP if it becomes unresponsive. There are no documented commands for selecting resources, refreshing currency, exporting an estimate, changing policy sets, or configuring credentials from the Command Palette.

Developers can override the server with `infracost.serverPath`. The setting has machine scope, and untrusted workspaces have limited support with `infracost.serverPath` listed as a restricted configuration. `package.json` also defines `infracost.debug`, which defaults to `false` and enables debug mode with LSP trace output, although the README configuration table does not list that setting.

Remote module resources are hidden from the Explorer by default because `infracost.displayRemoteModulesInTree` is `false`. Enabling them makes the inventory broader, but the README explicitly says their source files cannot be opened from that tree. This is a navigation limitation rather than a statement that those resources cannot be priced.

The server-update path is documented as `infracost.checkForUpdates`, enabled by default. A deployment that sets `infracost.serverPath` may therefore have different update behavior from the bundled setup, although the README does not explain whether automatic updates apply to a custom binary. For diagnostics, the Output panel contains an Infracost channel with language server logs.

## Constraints of the VS Code cost-estimation approach

The clearest limitation is scope. Although the extension handles Terraform and CloudFormation, the README does not document support for other infrastructure-as-code languages. It also requires a hosted Infracost account and browser authentication. There is no documented anonymous mode, local pricing database, or offline workflow.

A second limitation is command depth. The extension is good for passive discovery while editing, but the documented interface does not support report export, estimate comparison, policy administration, or rollback from its two commands. Teams that need pull request estimates must configure separate CI/CD integrations. Teams that need broad lifecycle management within the editor may find the LSP useful but operationally narrow.

The README also does not identify the freshness guarantees of the pricing API, supported cloud regions beyond the repository topics, treatment of partial Terraform projects, or behavior when credentials, private modules, or network access fail. Remote modules can at least be shown in the tree, but source navigation is unavailable there. If a stale, incomplete, or unavailable API result is material to acceptance testing, that behavior needs verification outside this documentation.

A separate CI/CD integration is the clearest real alternative. Its approach places cost estimates into pull requests and therefore addresses review gates and shared visibility, while the VS Code extension places estimates at resource definitions during individual editing sessions. The two surfaces complement each other, but only the editor extension is the subject of this repository.

## Release cadence, maintenance signals, and Apache-2.0

The repository is not archived. Its last push was on 2026-10-05, and the listed releases include `v0.4.16` on 2026-07-29, `v0.4.17` on 2026-08-03, and `v0.4.18` on 2026-09-03. Those facts indicate recent release activity, but they do not by themselves document compatibility policy, support duration, migration effort, or response times for issues.

For ordinary users, the bundled server and `infracost.checkForUpdates` reduce the visible upgrade path to the extension and language server supplied with it. Contributors use the repository's TypeScript toolchain. The documented local setup installs dependencies with `npm install`, then launches an Extension Development Host with F5:

```bash
npm install
```

The repository is licensed under `Apache-2.0`. That identifies the project's license, but the README does not summarize obligations for redistribution or modification, and it does not explain terms for the Infracost account, hosted pricing API, CI/CD integrations, or third-party resources. Organizations should review the actual `LICENSE` file and the applicable service terms rather than treating the SPDX identifier as a complete compliance answer.

The codebase is organized around `src/`, `resources/`, the webpack build, and VS Code contribution metadata in `package.json`. Based on that layout, contributors will need Node dependencies, TypeScript compilation through the configured build, and a VS Code development environment to exercise language-server behavior.

## Conclusion

Adopt this extension if your team edits Terraform in VS Code and wants cloud cost feedback before code reaches CI/CD. Do not choose it if you need broad editor commands, offline operation, or independently verified estimates. Before adoption, authenticate with the intended Infracost account, open a representative Terraform workspace, confirm that estimates appear above resource blocks, and check the configured currency and `infracost.runParamsCacheTTLSeconds`.

## FAQ

### What does infracost/vscode-infracost require before it can estimate costs?

It requires VS Code v1.100.0 or later and an Infracost account. The README instructs users to authenticate through the Infracost sidebar and a browser window.

### Does infracost/vscode-infracost support CloudFormation?

Yes. The extension supports CloudFormation templates in YAML and JSON in addition to Terraform `.tf` files.

### Can infracost/vscode-infracost work without the bundled language server?

The `infracost.serverPath` setting accepts a path to an `lsp` binary. Leaving it empty uses the bundled binary, and `Infracost: Restart Language Server` can restart the LSP.

## Sources

- [infracost/vscode-infracost on GitHub](https://github.com/infracost/vscode-infracost)
- [License: Apache-2.0](https://github.com/infracost/vscode-infracost/blob/master/LICENSE)
- [Project website](https://www.infracost.io/)
- [README](https://github.com/infracost/vscode-infracost/blob/master/README.md)
- [Releases](https://github.com/infracost/vscode-infracost/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/infracost-vscode-infracost
