Show a minimal GitHub Actions workflow for plan on PR.
BeginnerProductionCI/CD and Automation
Answer
on: pull_request
permissions: { id-token: write, contents: read, pull-requests: write }
jobs:
plan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with: { terraform_version: 1.9.8 }
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::111111111111:role/tf-plan
aws-region: ap-south-1
- run: terraform init -input=false
- run: terraform plan -input=false -out=tfplan
More on CI/CD and Automation
Why run Terraform from a pipeline instead of laptops?BeginnerWhat stages does a good Terraform pull-request pipeline have?BeginnerHow do you make sure the apply runs exactly what was reviewed?IntermediateHow do you serialize applies to the same stack in CI?AdvancedHow does OIDC authentication from GitHub Actions to AWS work?IntermediateWhat is Atlantis and how does the flow work?Beginner