forked from jpeedroza/gitops-example
-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (46 loc) · 1.36 KB
/
infracost.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
name: infracost
on:
push:
branches:
- "*"
- "*/*"
- "**"
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
jobs:
infracost:
name: Infracost
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: hashicorp/setup-terraform@v2
- name: Setup Infracost
uses: infracost/actions/setup@v2
with:
api-key: ${{ secrets.INFRACOST_API_KEY }}
path: |
.terraform/**
.terraform.lock.hcl
plan_cache.json
key: terraform-lock-${{ steps.extract_branch.outputs.branch }}
- name: Checkout base branch
uses: actions/checkout@v3
with:
ref: '${{ github.event.pull_request.base.ref }}'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY}}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY}}
aws-region: ${{ secrets.AWS_REGION }}
- name: Terraform Init
id: init
run: |
terraform init
terraform plan -no-color -out plan_cache.json
# Generate Infracost JSON file as the baseline.
- name: Generate Infracost cost estimate baseline
run: |
infracost breakdown --show-skipped --path plan_cache.json