Skip to content
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

feat: test cicd #5

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install tools using asdf
uses: asdf-vm/actions/[email protected]
Expand All @@ -28,31 +28,29 @@ jobs:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1

- name: Create Terraform plan on changed stacks
run: |
terramate run -- terraform init
terramate run -- terraform validate
terramate run --eval -- terraform plan -out ./out.tfplan


- name: Setup Infracost
uses: infracost/actions/setup@v2
with:
api-key: ${{ secrets.INFRACOST_API_KEY }}

- name: Create Terraform plan on changed stacks
run: |
terramate run terraform init
terramate run terraform validate
terramate run terraform plan -out ./out.tfplan

# Generate Infracost JSON file as the baseline.
- name: Generate Infracost cost estimate baseline
run: |
terramate run --eval -- infracost breakdown \
terramate run infracost breakdown \
--path ./out.tfplan \
--format=json \
--usage-file infracost-usage-medium.yml \
--out-file=./infracost-base.json

- name: Post Infracost comment
run: |
terramate run --eval -- infracost comment github \
terramate run infracost comment github \
--path=./infracost-base.json \
--repo=$GITHUB_REPOSITORY \
--github-token=${{github.token}} \
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ plan.json
tfplan.binary

out.tfplan
infracost-base.json
infracost-base.json
infracost.json