Skip to content

Commit

Permalink
Add workflow to destroy non-prod environments at midnight
Browse files Browse the repository at this point in the history
  • Loading branch information
russdaygh committed Apr 29, 2024
1 parent 661e000 commit 4589110
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/DestroyNonProdEnvironments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Destroy non-production environments
on:
schedule:
- cron: 0 0 * * *

jobs:
destroy_environments:
runs-on: ubuntu-latest
strategy:
matrix:
env: ['dev', 'test', 'test2']
environment: ${{ matrix.env }}
defaults:
run:
working-directory: ./terraform
steps:
- uses: actions/checkout@v4
- name: Log in with Azure
uses: azure/login@v1
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
- run: terraform init -backend-config="key=${{ matrix.env }}.terraform.tfstate"
- run: terraform apply -auto-approve -var-file ../tfvars/${{ matrix.env }}.tfvars -var 'cloudflare_account_id=${{ secrets.CLOUDFLARE_ACCOUNT_ID }}'
env:
ARM_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}

0 comments on commit 4589110

Please sign in to comment.