Skip to content

tf-snyk-integration plan #13

tf-snyk-integration plan

tf-snyk-integration plan #13

name: tf-snyk-integration
run-name: tf-snyk-integration ${{ (inputs.apply || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && 'apply' || 'plan' }}
on:
push:
paths:
- .github/workflows/tf-snyk-integration-integration.yml
- terraform/services/snyk-integration/**
workflow_dispatch:
inputs:
apply:
required: false
type: boolean
description: "Apply the terraform?"
jobs:
check-fmt:
runs-on: codebuild-cdap-${{github.run_id}}-${{github.run_attempt}}
steps:
- uses: actions/checkout@v4
- uses: ./actions/setup-tfenv-terraform
- run: terraform fmt -check -diff -recursive terraform/services/snyk-integration
plan-apply:
needs: check-fmt
permissions:
contents: read
id-token: write
runs-on: codebuild-cdap-${{github.run_id}}-${{github.run_attempt}}
defaults:
run:
working-directory: ./terraform/services/snyk-integration
strategy:
fail-fast: false
matrix:
app: [bcda]
env: [test, prod]
steps:
- uses: actions/checkout@v4
- uses: ./actions/setup-tfenv-terraform
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ contains(fromJSON('["dev", "test"]'), matrix.env) && secrets.NON_PROD_ACCOUNT || secrets.PROD_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 }}-gf.s3.tfbackend
- run: terraform plan -out=tf.plan
- if: inputs.apply || (github.event_name == 'push' && github.ref == 'refs/heads/main')
run: terraform apply -auto-approve tf.plan