New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a --compare-to
flag to enable comparison between different runs
#1567
Comments
--compare-to
flag to enable comparison between branches--compare-to
flag to enable comparison between branches
--compare-to
flag to enable comparison between branches--compare-to
flag to enable comparison between different runs
I'm looking specifically at In root modules our use case is slightly different in that we have each environment setup as its own workflow and the only workflow that triggers on PR open, or sync is a sandbox environment. If all tests pass and code review is approved, we merge to main (we also have an option to destroy the sandbox on PR close if we want). The next workflow (let's say a acceptance environment) is triggered off that merge to main and the rest of the workflows (exploratory, production etc..) are triggered off the successful run of the previous workflow. If I understand correctly the functionality is already there for comparing plan diffs for my latter workflows so the combination of the two should get me where I need to go! This is an example of the workflows I describe a multi-region setup for google. It represents something similar to what I'm trying to get infracosts for. (This is just my open/playground area so I'm not building stuff that costs money :D ) For child modules we use kitchen-terraform and destroy after PR close so this action should work for us there too and give developers a clear understanding of how their change may impact costs. This is an example of what we'd use that action on. Not too different than what Google is doing with their public modules. Can't wait to mess around with it all! |
@brettcurtis, @MNThomson, @lemeurherve the |
Problem
Currently, Infracost enables users to see cost diffs between changes and the planned Terraform state. However, many Infracost users want to run cost diffs between branches or historical snapshots. See #1192 as an example of this.
Furthermore, Infracost parse HCL method currently is not supported by the
diff
command because parsing HCL does not use Terraform state. To support native HCL diffs we must allow users to provide a project state external to Terraform.Proposed solution
To solve these problems the Infracost team proposes to add a
--compare-to
flag to thebreakdown
,diff
andoutput
commands. Using this flag users can pass an Infracost JSON file (
--format json --out-file infracost-run.json
) to compare against. Below are some common scenarios using this interface.Note for community
Please 👍 if you'd like to upvote or receive updates. Add a comment if you have feedback or your use-case can't be handled with this proposal.
1. Compare cost estimates across branches for a single project
2. Compare cost estimates across branches for a multi-project setup
Multi-project setups include a config-file or Terragrunt being used.
3. Compare cost estimates across branches for a multi-project setup using a build matrix
Sometimes a build matrix is already being used, thus config-files are not an option (unlike case number 2).
4. Compare historical cost estimate snapshots
Assuming you have
infracost-last-month.json
andinfracost-last-week.json
files:Out of scope
We've decided that it's best to add the
--compare-to
flag tobreakdown
,diff
andoutput
commands, but not tocomment
. This has been done to keep thecomment
interface simpler to understand. Additionally, we believe there are very few use cases where users would want tocomment
on PRs comparing two historical snapshots. However, this is still possible by using a combination ofoutput
andcomment
:The text was updated successfully, but these errors were encountered: