Skip to content

Commit

Permalink
init commit: testing delete action to help keep aws accounts clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameronsplaze committed Nov 1, 2024
1 parent 8eafcd7 commit f8e8437
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/dispatch-delete-leaf-stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Dispatch - Delete Leaf Stack

on:
workflow_dispatch:
inputs:
environment:
description: "The leaf stack to delete"
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')

0 comments on commit f8e8437

Please sign in to comment.