Skip to content

Releases: infracost/actions

v3.0.0

28 Feb 11:14
Compare
Choose a tag to compare

What's Changed

Full Changelog: v2.1.0...v3.0.0

v2.1.0

13 Jan 14:00
0d27b73
Compare
Choose a tag to compare

What's Changed

  • The Setup Infracost action infracost/actions/setup@v2 now uses node 16.
  • Depdencies have been updated.
  • Many documentation improvements and fixes.

New Contributors

Full Changelog: v2.0.0...v2.1.0

v2.0.0

24 May 11:26
Compare
Choose a tag to compare

Migration guide

See the GitHub Actions migration guide in the docs for migrating the Infracost GitHub Action v1 to v2.

What's new?

Back in February 2022, we started an experiment to estimate costs by parsing Terraform HCL code directly. We're excited to announce that the experiment worked! So in v0.10 we've removed the experimental --terraform-parse-hcl flag and made HCL parsing the default behavior.

Going forward, we'll support two ways to run Infracost with Terraform via --path:

  1. Parsing HCL code (directory): this is the default and recommended option as it has the following 4 key benefits.
    # Terraform variables can be set using --terraform-var-file or --terraform-var
    infracost breakdown --path /code
  2. Parsing plan JSON file: this will continue to work as before.
    cd /code
    terraform init
    terraform plan -out tfplan.binary
    terraform show -json tfplan.binary > plan.json
    
    infracost breakdown --path plan.json

1. Faster CLI

Infracost can now generate cost estimates without needing a Terraform plan. This removes our dependency on the Terraform binary altogether, which means no more terraform init or terraform plan.

That, in turn, means a super-fast CLI: Infracost used to take around 50 seconds to run on our internal Terraform mono-repo, that's now reduced to 2 seconds. 馃殌

2. No cloud creds needed

Running terraform plan requires users to have cloud credentials and Terraform secrets. The main reason we created the Infracost CLI first, instead of a web API, was so it could parse the Terraform plan JSON locally to extract cost-related parameters (e.g. instance type). Thus credentials and secrets were not sent anywhere.

Whilst this worked and was safe, it still posed a question: is there a way to avoid setting credentials or secrets altogether? Removing our dependency on terraform plan gave us a way to do that.

3. Cost estimates everywhere

Not needing cloud credentials, or even knowledge of how to generate a Terraform plan, means that any engineer who has access to code repos can generate cost estimates!

This also opens the door for cost estimates to be put everywhere: Infra-as-Code repo readmes, Terraform module readmes, Visual Studio, and even in continuous integration systems where a Terraform plan does not exist (not everyone runs Terraform via continuous deployment systems).

To make infracost diff work without a Terraform plan, we introduced a new --compare-to infracost-base.json flag. This enables a git-based cost diff to be produced, e.g.:

git checkout main
infracost breakdown --path /code --format json --out-file infracost-base.json

git checkout my-branch
infracost diff --path /code --compare-to infracost-base.json

4. Compare Infracost runs

The infracost diff command can now also be used to compare Infracost runs. Assuming you generated the files infracost-last-week.json and infracost-today.json using the infracost breakdown --path /code --format json command, you can compare them using:

infracost diff --path infracost-today.json --compare-to infracost-last-week.json

5. Detect multi-project repos

Setting the --path flag to a top-level repo directory will now attempt to process all projects automatically by:

  1. Looking at the specified path or in any of the subdirectories with a depth less than 5.
  2. Processing Terraform variable files with the .auto.tfvars extension (similar to what Terraform does).
  3. Processing environment variables with a TF_VAR_ prefix (similar to what Terraform does).

If this does not work for your use-case, use a config-file and run infracost breakdown --config-file=infracost.yml, for example:

# infracost.yml
version: 0.1
projects:
  - path: prod
    terraform_var_files:
      - prod.tfvars
      - us-east.tfvars

  - path: dev
    terraform_var_files:
      - dev.tfvars

Removed functionality

If you previously used the following two options to see the cost breakdown of the current Terraform state, you can now just run infracost breakdown --path /code against the already-deployed branch.

  1. The --terraform-use-state flag has been removed.
  2. Running Infracost against a Terraform state JSON file is no longer supported.

If you previously ran Infracost with a Terraform plan binary file, you should now generate a plan JSON file and use that instead:

terraform show -json tfplan.binary > plan.json

infracost breakdown --path plan.json

Known issues

  1. The INFRACOST_TERRAGRUNT_FLAGS environment variable is no longer supported as Infracost parses HCL code directly. Comment on this issue if you'd like a way to exclude certain directories.
  2. HCL parsing does not work with private remote modules, subscribe to this issue for updates.

As a workaround you can still generate plan JSONs for these projects and pass the plan JSON to Infracost to get a cost estimate. We are looking to fix these issues in upcoming patch releases.

Full Changelog: v1...v2.0.0

v1.1.2

20 Apr 17:03
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.1.1...v1.1.2

v1.1.1

15 Feb 19:34
38d5801
Compare
Choose a tag to compare

What's Changed

This release includes small documentation and example fixes (listed below), the only behavior change is:

  • fix: log CLI version with .info not .notice by @tim775 in #48

  • Add example AWS creds to multi project examples by @aliscott in #46
  • fix: correct opa path for examples by @hugorut in #47
  • docs: Update examples to use open-policy-agent/setup-opa by @tim775 in #49
  • fix: Update examples' golden files by @vdmgolub in #50
  • chore: clarify using same API key by @alikhajeh1 in #51

New Contributors

Full Changelog: v1.1.0...v1.1.1

v1.1.0

04 Jan 11:31
7604421
Compare
Choose a tag to compare

What's Changed

Features

Example/docs changes

New Contributors

Full Changelog: v1.0.2...v1.1.0

v1.0.2

15 Dec 15:34
9a2bca1
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.0.1...v1.0.2

v1.0.1

30 Nov 18:01
dc9f4f1
Compare
Choose a tag to compare

This is the intial release of our improved GitHub actions library which includes 馃殌:

  • infracost/actions/setup to install Infracost CLI which can then be used to perform cost breakdowns, diffs, and output formatting.
  • infracost/actions/comment for posting cost estimation reports as pull request comments
  • The infracost/actions/examples library which shows common ways to use Infracost with GitHub actions, including multi-project, terragrunt, thresholds, and more. Contribute your own example!

If you used the old infracost-gh-actions repo, we recommend you follow our migration guide to use this new repo.

Thanks to the many users who gave us feedback on our old GitHub Action especially 鉂わ笍 :