Skip to content
Merged
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
39 changes: 35 additions & 4 deletions .github/workflows/tf-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,40 @@ name: Terraform Plan (PR)

on:
pull_request:
paths:
- src/tf/**
- .github/workflows/tf-plan.yml

permissions:
contents: read
id-token: write
pull-requests: write

jobs:
changes:
runs-on: ubuntu-latest
outputs:
terraform: ${{ steps.changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v7

- name: Detect Terraform changes
id: changed-files
uses: tj-actions/changed-files@v47
with:
files: |
src/tf/**
.github/workflows/tf-plan.yml

validate:
needs: changes
if: ${{ needs.changes.outputs.terraform == 'true' }}
uses: glitchedmob/infra-gha/.github/workflows/tf-validate.yml@v0.7.4
with:
init-backend: false

plan:
needs: validate
needs:
- changes
- validate
if: ${{ needs.changes.outputs.terraform == 'true' }}
uses: glitchedmob/infra-gha/.github/workflows/tf-plan-apply.yml@v0.7.4
with:
plan-only: true
Expand All @@ -27,3 +44,17 @@ jobs:
export TF_VAR_github_app_pem="${{ secrets.TF_VAR_GITHUB_APP_PEM }}"
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
output_encryption_key: ${{ secrets.OUTPUT_ENCRYPTION_KEY }}

result:
name: Terraform checks
if: ${{ always() }}
needs:
- changes
- validate
- plan
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
with:
allowed-skips: validate, plan
jobs: ${{ toJSON(needs) }}