Skip to content

PLT-338 Security group for internet access (#120) #1

PLT-338 Security group for internet access (#120)

PLT-338 Security group for internet access (#120) #1

name: service-security-groups apply terraform
on:
push:
branches:
- main
paths:
- .github/workflows/service-security-groups-apply.yml
- terraform/services/service-security-groups/**
workflow_dispatch: # Allow manual trigger
jobs:
terraform-apply:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./terraform/services/service-security-groups
strategy:
fail-fast: false
matrix:
app: [ab2d, bcda, dpc]
env: [dev, test, sbx, prod, mgmt]
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 -backend-config=../../backends/${{ matrix.app }}-${{ matrix.env }}.s3.tfbackend
- run: terraform apply -auto-approve
env:
TF_VAR_app: ${{ matrix.app }}
TF_VAR_env: ${{ matrix.env }}
- uses: slackapi/[email protected]
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 }}