Skip to content

Commit

Permalink
chore: Add destroy step to AWS deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nilgaar committed Jul 13, 2024
1 parent 221b22a commit ecf0a8e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/deploy_aws_vpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,19 @@ jobs:
cd ./IaC/aws/terraform/
tofu apply -auto-approve -var="AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -var="AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}"
destroy:
name: Destroy Infrastructure
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_INFRA_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_INFRA_KEY }}
steps:
- uses: actions/checkout@v3

- uses: opentofu/[email protected]
name: Setup OpenTofu

- name: Destroy VPC
if: always() && github.ref == 'refs/heads/develop'
run: |
cd ./IaC/aws/terraform/
tofu destroy -auto-approve -var="AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -var="AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}"

0 comments on commit ecf0a8e

Please sign in to comment.