infracost/Infracost
Show cloud cost estimate changes for Terraform in pull requests.
View on GitHubTrust Signals
- Scorecard Score
- not yet scored
- Maintenance Recency
- Stale
- License
- None
Inputs
| name | description | required | default |
|---|---|---|---|
| path | Path to the Terraform directory or JSON/plan file. Either `path` or `config_file` is required. | no | — |
| terraform_plan_flags | Flags to pass to the 'terraform plan' command, e.g. `"-var-file=my.tfvars -var-file=other.tfvars"`. Applicable when path is a Terraform directory. | no | — |
| terraform_workspace | The Terraform workspace to use. Applicable when path is a Terraform directory. Only set this for multi-workspace deployments, otherwise it might result in the Terraform error "workspaces not supported". | no | — |
| usage_file | Path to Infracost usage file (https://www.infracost.io/docs/usage_based_resources) that specifies values for usage-based resources, see https://github.com/infracost/infracost/blob/master/infracost-usage-example.yml for the available options. | no | — |
| config_file | If your repo has multiple Terraform projects or workspaces, define them in a config file (https://www.infracost.io/docs/config_file/) and set this input to its path. Their results will be combined into the same diff output. Cannot be used with path, terraform_plan_flags or usage_file inputs. | no | — |
| percentage_threshold | (percentage_threshold is deprecated, use post_condition instead) The absolute percentage threshold that triggers a pull request comment with the diff. Defaults to 0, meaning that a comment is posted if the cost estimate changes. For example, set to 5 to post a comment if the cost estimate changes by more than plus or minus 5%. | no | — |
| post_condition | A JSON string describing the condition that triggers pull request comments, can be one of these: - `'{"update": true}'`: we suggest you start with this option. When a commit results in a change in cost estimates vs earlier commits, the integration will create **or update** a PR comment (not commit comments). The GitHub comments UI can be used to see when/what was changed in the comment. PR followers will only be notified on the comment create (not update), and the comment will stay at the same location in the comment history. This is the default behavior for GitHub, please let us know if you'd like to see this for GitLab and BitBucket. - `'{"has_diff": true}'`: a commit comment is put on the first commit with a Terraform change (i.e. there is a diff) and on every subsequent commit (regardless of whether or not there is a Terraform change in the particular commit). This is the current default for GitLab, BitBucket and Azure Repos (git). - `'{"always": true}'`: a commit comment is put on every commit. - `'{"percentage_threshold": 0}'`: absolute percentage threshold that triggers a comment. For example, set to 1 to post a comment if the cost estimate changes by more than plus or minus 1%. A commit comment is put on every commit with a Terraform change that results in a cost diff that is bigger than the threshold. | no | {"update": true} |
| show_skipped | Show unsupported resources, some of which might be free, at the bottom of the Infracost output. | no | — |
| sync_usage_file | Sync usage-file with missing resources. This requires the usage_file input to be set. | no | — |
Outputs
| name | description |
|---|---|
| total_monthly_cost | The new total monthly cost estimate. |
| past_total_monthly_cost | The past total monthly cost estimate. |