Skip to content

GitHub Action for Terraform Plan on PRs #6

GitHub Action for Terraform Plan on PRs

GitHub Action for Terraform Plan on PRs #6

name: PR Terraform Plan
on: [pull_request]
permissions:
contents: read
pull-requests: write
jobs:
changed-files:
name: Get changed files
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.changed-files.outputs.all_changed_files }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
with:
files: |
'terraform-incubator/**.tf'
json: true
quotepath: false
escape_json: false
- name: List all changed files
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
plan:
runs-on: ubuntu-latest
name: Create terraform plan
needs: [changed-files]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{secrets.INCUBATOR_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.INCUBATOR_AWS_SECRET_ACCESS_KEY}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: terraform plan
uses: dflook/terraform-plan@v1
with:
path: terraform-incubator/people-depot/dev