Releases: infracost/actions
v3.0.1
v3.0.0
v2.1.0
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
- @Tutuviz made their first contribution in #70
- @gsuresh92 made their first contribution in #72
- @davidjeddy made their first contribution in #86
- @Octogonapus made their first contribution in #87
Full Changelog: v2.0.0...v2.1.0
v2.0.0
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
:
- 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
- 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:
- Looking at the specified path or in any of the subdirectories with a depth less than 5.
- Processing Terraform variable files with the
.auto.tfvars
extension (similar to what Terraform does). - 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.
- The
--terraform-use-state
flag has been removed. - 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
- 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. - 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
What's Changed
- Update comment action to use infracost-comment by @hugorut in #57
- Bump dependencies by @dependabot in #58 and #61
Full Changelog: v1.1.1...v1.1.2
v1.1.1
What's Changed
This release includes small documentation and example fixes (listed below), the only behavior change is:
- 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
What's Changed
Features
- Add enable-dashboard option to actions/setup by @vdmgolub in #42
- Re-enable parallelism by @aliscott in #45
Example/docs changes
- Add OPA example by @tim775 in #39
- Add Sentinel example by @tim775 in #40
- Fix minor typo in TFC example by @fcjr in #44
- Comments should always be posted if there's no past cost by @aliscott in #41
- Add note about GitHub token permissions by @alikhajeh1 in #38
New Contributors
Full Changelog: v1.0.2...v1.1.0
v1.0.2
What's Changed
- Fix broken link to slack example by @dinoshauer in #33
- Add conftest+infracost example by @tim775 in #34
- Use correct name for IOPS policy by @tim775 in #36
- Add
tag
input for comment action by @aliscott in #35 - Disable parallelism until we have fixed race conditions by @aliscott in #37
New Contributors
- @dinoshauer made their first contribution in #33
Full Changelog: v1.0.1...v1.0.2
v1.0.1
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 ❤️ :
- Jon Leemon, Sushant Pradhan and Semjon Bibow for highlighting the issues with the diff.sh bash script.
- AJ Bowen and Didier Caron for pointing us in the right direction about pull request commenting behaviors.
- Frank Chiarulli Jr. for inspiring the comment summary table.