Using Infracost
Pre-requisites
- Infracost binary installed into your CI pipeline (see Infracost docs)
- Infracost API key
Set up Infracost
Use the official setup-infracost action in your workflow file (README)
Breakdown
Use digger.yml like below to see infracost breakdown
output:
After the pipeline run finishes, you should see Infracost breakdown output appended to digger run report comment as additional output:
Diff
For infracost diff
we’d need to run Infracost twice: first to generate the breakdown on the main branch, then to generate diff on the PR branch. To help with that, Digger provides additional environment variables like $PROJECT_NAME
and $PR_BRANCH
(see custom commands). You can then configure your workflow in digger.yml to switch branch to main, generate base breakdown, switch back to PR branch, generate diff and finally show it via $DIGGER_OUT
, like below:
Then you’ll be able to see diff appended as comment like below: