-
Notifications
You must be signed in to change notification settings - Fork 11
/
action.yml
59 lines (59 loc) · 4.19 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Infracost
description: Show cloud cost estimate changes for Terraform in pull requests.
author: infracost
branding:
icon: trending-up
color: yellow
inputs:
path:
description: Path to the Terraform directory or JSON/plan file. Either `path` or `config_file` is required.
required: false
terraform_plan_flags:
description: 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.
required: false
terraform_workspace:
description: 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".
required: false
usage_file:
description: 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.
required: false
config_file:
description: 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.
required: false
percentage_threshold:
description: (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%.
required: false
post_condition:
description: |
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.
required: false
default: '{"update": true}'
show_skipped:
description: Show unsupported resources, some of which might be free, at the bottom of the Infracost output.
required: false
sync_usage_file:
description: Sync usage-file with missing resources. This requires the usage_file input to be set.
required: false
outputs:
total_monthly_cost:
description: The new total monthly cost estimate.
past_total_monthly_cost:
description: The past total monthly cost estimate.
runs:
using: docker
image: docker://infracost/infracost:latest # Use a specific version instead of latest if locking is preferred
entrypoint: /scripts/ci/diff.sh # Do not change, this script lives in the Docker image and runs the GitHub Action logic
args:
- ${{ inputs.path }}
- ${{ inputs.terraform_plan_flags }}
- ${{ inputs.terraform_workspace }}
- ${{ inputs.usage_file }}
- ${{ inputs.config_file }}
- ${{ inputs.percentage_threshold }}
- ${{ inputs.post_condition }}
- ${{ inputs.show_skipped }}
- ${{ inputs.sync_usage_file }}