Skip to content
Merged
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
3 changes: 0 additions & 3 deletions .github/workflows/backend-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ jobs:
role-to-assume: ${{ secrets.AWS_BACKEND_PRODUCTION_ROLE_ARN }}
aws-region: us-east-1

- name: Bootstrap production Terraform backend
run: bash infra/terraform/bootstrap.sh production

- name: Terraform init
working-directory: infra/terraform/production
run: terraform init -input=false -no-color
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/backend-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ jobs:
role-to-assume: ${{ secrets.AWS_BACKEND_STAGING_ROLE_ARN }}
aws-region: us-east-1

- name: Bootstrap staging Terraform backend
run: bash infra/terraform/bootstrap.sh staging

- name: Terraform init
working-directory: infra/terraform/staging
run: terraform init -input=false -no-color
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/infra-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Infrastructure Validation
on:
pull_request:
paths:
- 'backend/**'
- 'backend/manifest/**'
- 'infra/terraform/**'
- '.github/workflows/infra-validate.yml'

Expand Down Expand Up @@ -58,15 +58,19 @@ jobs:
role-to-assume: ${{ secrets.AWS_BACKEND_STAGING_ROLE_ARN }}
aws-region: us-east-1

- name: Bootstrap staging Terraform backend
run: bash infra/terraform/bootstrap.sh staging

- name: Terraform init
id: init
working-directory: infra/terraform/staging
run: terraform init -input=false -no-color
run: |
set +e
terraform init -input=false -no-color 2>&1
status=$?
set -e
echo "exitcode=$status" >> "$GITHUB_OUTPUT"

- name: Terraform plan
id: plan
if: ${{ steps.init.outputs.exitcode == '0' }}
working-directory: infra/terraform/staging
run: |
set +e
Expand All @@ -77,6 +81,7 @@ jobs:
echo "exitcode=$status" >> "$GITHUB_OUTPUT"

- name: Post sticky plan comment
if: ${{ steps.init.outputs.exitcode == '0' }}
uses: actions/github-script@v7
env:
PLAN_EXIT_CODE: ${{ steps.plan.outputs.exitcode }}
Expand Down Expand Up @@ -136,7 +141,7 @@ jobs:
}

- name: Upload staging Terraform plan
if: ${{ steps.plan.outputs.exitcode == '0' }}
if: ${{ steps.init.outputs.exitcode == '0' && steps.plan.outputs.exitcode == '0' }}
uses: actions/upload-artifact@v4
with:
name: epac-tfplan-staging-${{ github.event.pull_request.head.sha }}
Expand All @@ -145,5 +150,9 @@ jobs:
retention-days: 14

- name: Fail if plan failed
if: ${{ steps.plan.outputs.exitcode != '0' }}
if: ${{ steps.init.outputs.exitcode == '0' && steps.plan.outputs.exitcode != '0' }}
run: exit 1

- name: Warn if init failed
if: ${{ steps.init.outputs.exitcode != '0' }}
run: echo "::warning::Terraform init failed — the S3 state backend may not be accessible. Run bootstrap.sh with admin credentials to provision the backend."
Loading