GithubHelp home page GithubHelp logo

isabella232 / vscode-infracost Goto Github PK

View Code? Open in Web Editor NEW

This project forked from infracost/vscode-infracost

0.0 0.0 0.0 4.98 MB

See cost estimates for Terraform right in your editor💰📉

Home Page: https://www.infracost.io/

License: Apache License 2.0

JavaScript 5.09% TypeScript 80.70% Handlebars 14.22%

vscode-infracost's Introduction

Infracost VSCode Extension

Infracost's VSCode extension shows you cost estimates for Terraform right in your editor! Prevent costly infrastructure changes before they get into production.

This helps with a few use-cases:

  • Compare configs, instance types, regions etc: copy/paste a code block, make changes and compare them.
  • Quick cost estimate: write a code block and get a cost estimate without having to use AWS, Azure or Google cost calculators, or read the long/complicated pricing web pages.
  • Catch costly typos: if you accidentally type 22 instead of 2 as the instance count, or 1000GB volume size instead of 100, the cost estimate will immediately pick that up and let you know.

Features

See cost estimates right above their Terraform definitions. Infracost's output updates on file save.

Works with resources and modules

Both resource and module blocks are supported. 3rd party module blocks are also supported!

See cost breakdown

If a simple monthly cost isn't enough for you, just click the overview to see a cost breakdown.

Navigate your projects by costs

See a tree overview of your Infrastructure costs. See which projects, files and blocks have the most impact to your budget.

Get started

1. Install Infracost CLI

Follow this step to install the Infracost CLI, which is used by this VSCode extension.

2. Get an API key

Follow this step to get a free API key that's used by the CLI to get prices from our Cloud Pricing API, e.g. get prices for instance types.

  • No cloud credentials or secrets are sent to the API and you can also self-host it.
  • Infracost does not make any changes to your Terraform state or cloud resources.

3. Install VSCode extension

Open VSCode and install the Infracost extension.

This will also install the the Hashicorp Terraform extension extension if you don't already have it.

4. Use extension

Navigate to any Terraform file, if you've done the prior steps correctly you'll see costs above supported blocks.

5. Cost estimates in pull requests

Use our CI/CD integrations to add cost estimates to pull requests. This provides your team with a safety net as people can understand cloud costs upfront, and discuss them as part of your workflow.

Requirements

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.

FAQs

How can I supply input variables to Infracost VSCode extension?

To supply input variables for your Terraform projects, you must include a var file called terraform.tfvars at the root level of your Terraform project. Alternatively, you can use several files with the suffix *.auto.tfvars, e.g. dev.auto.tfvars or prod.auto.tfvars. Both HCL and JSON var files are supported, JSON var files must include a .json suffix.

How can I configure the currency Infracost uses?

To set the currency, run infracost configure set currency EUR (or any other ISO 4217 currency code). This FAQ has more details.

Troubleshooting

Known Issues

  • 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.

Locating Infracost error logs

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:

  1. Open the extension terminal using the top menu (Terminal->New Terminal)
  2. Select Output and Infracost Debug from the dropdown.
  3. There are sometimes additional CLI logs hidden in the log (Window) output.

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.

Contributing

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.

  1. Clone the repo.
  2. yarn install all the dependencies.
  3. Open the repo in VSCode.
  4. Install the Terraform VSCode extension in VSCode.
  5. Inside the editor, press F5. VSCode will compile and run the extension in a new Development Host window.
  6. 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.

vscode-infracost's People

Contributors

hugorut avatar alikhajeh1 avatar aliscott avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.