-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (48 loc) · 1.72 KB
/
opt-out-import-apply.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: opt-out-import apply terraform
on:
push:
branches:
- main
paths:
- .github/workflows/opt-out-import-apply.yml
- terraform/modules/bucket/**
- terraform/modules/key/**
- terraform/modules/function/**
- terraform/modules/queue/**
- terraform/modules/subnets/**
- terraform/modules/vpc/**
- terraform/services/opt-out-import/**
workflow_dispatch: # Allow manual trigger
jobs:
terraform-apply:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./terraform/services/opt-out-import
strategy:
fail-fast: false
matrix:
app: [ab2d, bcda, dpc]
env: [dev, test, prod]
env:
TF_VAR_app: ${{ matrix.app }}
TF_VAR_env: ${{ matrix.env }}
steps:
- uses: actions/checkout@v4
- uses: ./actions/setup-tfenv-terraform
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ matrix.app == 'ab2d' && secrets[format('{0}_{1}_ACCOUNT', matrix.app, matrix.env)] || secrets.BCDA_ACCOUNT }}:role/delegatedadmin/developer/${{ matrix.app }}-${{ matrix.env }}-github-actions
aws-region: ${{ vars.AWS_REGION }}
- run: terraform init -reconfigure -backend-config=../../backends/$TF_VAR_app-$TF_VAR_env.s3.tfbackend
- run: terraform apply -auto-approve
- uses: slackapi/slack-github-action@v1.26.0
if: ${{ failure() }}
with:
channel-id: 'C04UG13JF9B'
slack-message: "Terraform apply failure: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}