Infracost's VSCode extension shows you cost estimates for Terraform right in your editor! Prevent costly infrastructure changes before they get into production.
Infracost's extension shows a snapshot of the total cost of resources right above their Terraform definitions. Infracost's output updates on file save.
Both resource
and module
blocks support showing cost estimates. Infracost's VSCode extension even supports showing prices on 3rd party module blocks!
If a simple monthly cost isn't enough for you, just click the overview to show a detailed breakdown of what components affect the price.
Check out the video below to see the Infracost extension in action!
Infracost.VSCode.extension.mp4
- Install Infracost CLI on your machine & register for an API key.
- Open VSCode and install the Infracost extension. This will also install the the Hashicorp Terraform extension extension if you don't already have it.
- Navigate to any Terraform file, if you've done the prior steps correctly you'll see costs above supported blocks.
The Infracost VSCode extension requires you to have:
- VSCode v1.67.0 or above.
- Infracost CLI version v0.10.6 or above installed and registered with a valid API key.
- The Terraform VSCode extension installed and enabled in VSCode.
-
When opening a workspace with a large number of Terraform projects for the first time. Infracost will evaluate all the projects and download any required modules. This means that it might take some time before pricing information is available. If you're worried that Infracost VSCode extension isn't working in your workspace but haven't got any error messages, it is likely that Infracost is still indexing your workspace. The extension has a status bar on the right-hand side of the editor which will show a loading state when Infracost is running.
-
Terragrunt is not supported. Follow this issue for more information for future updates about Terragrunt support.
-
Infracost usage files are not yet supported. This means that resources that solely use usage costs will have a
0.00
cost shown:Follow this issue to receive updates on usage file support.
-
Diff functionality is not yet supported. Follow this issue to receive updates on diff support.
-
VSCode Infracost does not yet work with Infracost config files. Multi project support is available using Infracost native auto-detection. This means that the first time running in a multi-project workspace might be quite slow. Follow this issue to receive updates on config file support.
If you're having problems with the extension and your problem isn't any of the known issues above, you can find the Infracost extension logs using the following method:
- Open the extension terminal using the top menu (Terminal->New Terminal)
- Select Output and log (Window) from the dropdown
The log there might give you more information for a problem you can fix on your own, e.g. syntax errors. If it's something more ominous please raise an issue, so that we can identify and fix the problem. Please include as much of the log information as you can and any other helpful information like OS and VSCode workspace size.
We love any contribution, big or small. If you want to change the Infracost VSCode extension, we recommend you use VSCode to build and develop the extension locally.
- Clone the repo.
yarn
install all the dependencies.- Open the repo in VSCode.
- Install the Terraform VSCode extension in VSCode.
- Inside the editor, press F5. VSCode will compile and run the extension in a new Development Host window.
- Open a Terraform project, and navigate to a valid file. If all the previous steps have been followed correctly, you should see Infracost cost estimates above supported resource blocks.
Once you're finished with your work, open a PR, and we'll be happy to review it as soon as possible.