Dispatch - Delete Leaf Stack #5
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: Dispatch - Delete Leaf Stack | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: "The leaf stack to DESTROY" | |
type: environment | |
required: true | |
env: | |
EXAMPLES_PATH: ./Examples # No trailing slash plz! | |
jobs: | |
cdk-destroy-leaf: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
environment: "${{ inputs.environment }}" | |
steps: | |
- uses: actions/checkout@v4 | |
## Install Everything / Setup Env Vars: | |
- name: Setup CDK | |
uses: ./.github/workflows/composite-setup-cdk | |
with: | |
secrets: ${{ toJson(secrets) }} | |
vars: ${{ toJson(vars) }} | |
## Log into AWS: | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: "${{ vars.AWS_REGION }}" | |
role-to-assume: "arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ vars.AWS_DEPLOY_ROLE }}" | |
## Destroy the Leaf Stack: | |
- name: "Destroying: ${{ inputs.environment }}" | |
run: | | |
make cdk-destroy-leaf \ | |
config-file="${{ env.EXAMPLES_PATH }}/${{ inputs.environment }}" \ | |
container-id=$(echo "${{ inputs.environment }}" | sed -E 's/-example\.ya?ml$//i') |