Skip to content

Delete Dev Environment #52

Delete Dev Environment

Delete Dev Environment #52

name: "Delete Dev Environment"
on:
workflow_dispatch:
defaults:
run:
shell: bash
env:
AWS_REGION: ca-central-1
AWS_NUKE_VERSION: 3.24.0
AWS_NUKE_CONFIG_PLACEHOLDER: SCRATCH_ACCOUNT_ID
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
ENVIRONMENT: dev
permissions:
id-token: write
contents: write
pull-requests: write
jobs:
delete-dev-environment:
if: |
always() &&
!contains(needs.*.result, 'cancelled')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: setup-terraform
uses: ./.github/actions/setup-terraform
with:
role_to_assume: arn:aws:iam::800095993820:role/notification-terraform-apply
role_session_name: NotifyTerraformDestroy
- name: Install AWS nuke
run: |
mkdir bin
curl -Lo aws-nuke.tar.gz https://github.com/ekristen/aws-nuke/releases/download/v${{ env.AWS_NUKE_VERSION }}/aws-nuke-v${{ env.AWS_NUKE_VERSION }}-linux-amd64.tar.gz
tar -xzf aws-nuke.tar.gz -C bin
chmod +x bin/*
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: Install 1Pass CLI
run: |
curl -o 1pass.deb https://downloads.1password.com/linux/debian/amd64/stable/1password-cli-amd64-latest.deb
sudo dpkg -i 1pass.deb
- name: Fetch secrets from 1Password
run: |
op read op://4eyyuwddp6w4vxlabrr2i2duxm/"TFVars - Dev"/notesPlain > aws/dev.tfvars
- name: Destroy notify dev environment
run: |
cd scripts
./deleteEnvironment.sh dev 800095993820