Skip to content

Commit

Permalink
Add a workflow that runs terraform plan on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
offbyone committed Dec 1, 2023
1 parent 29fc462 commit 34a8ccd
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/pr-plan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'Terraform Plan'

permissions:
contents: read
id-token: write

on:
workflow_dispatch:
pull_request:
branches:
- 'main'
- mainline

jobs:
terraform:
name: 'Terraform Plan'
runs-on: ubuntu-latest

steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: "arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ROLE_NAME }}"
aws-region: us-west-2

- name: 'Setup Terraform'
uses: hashicorp/setup-terraform@v1
with:
terraform_version: '1.4.6' # Replace with your desired version

- name: 'Terraform Init'
id: init
run: terraform init

- name: 'Terraform Plan'
id: plan
run: terraform plan
# If the Terraform plan fails, the workflow will fail and stop executing further steps.

0 comments on commit 34a8ccd

Please sign in to comment.