DPC-3767 Add infrastructure for DPC WAF-sync lambda (#127) #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: api-waf-sync apply terraform | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- .github/workflows/api-waf-sync-apply.yml | |
- terraform/modules/bucket/** | |
- terraform/modules/key/** | |
- terraform/modules/function/** | |
- terraform/modules/queue/** | |
- terraform/modules/subnets/** | |
- terraform/modules/vpc/** | |
- terraform/services/api-waf-sync/** | |
workflow_dispatch: # Allow manual trigger | |
jobs: | |
terraform-apply: | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./terraform/services/api-waf-sync | |
strategy: | |
fail-fast: false | |
matrix: | |
env: [dev] | |
env: | |
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::${{ secrets.BCDA_ACCOUNT }}:role/delegatedadmin/developer/dpc-${{ matrix.env }}-github-actions | |
aws-region: ${{ vars.AWS_REGION }} | |
- run: terraform init -reconfigure -backend-config=../../backends/dpc-$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 }} | |