Skip to content

Commit

Permalink
Add housekeeping workflow to destroy demo resources and update stagin…
Browse files Browse the repository at this point in the history
…g environment notification
  • Loading branch information
tsviz committed Nov 5, 2024
1 parent 1d0a121 commit ddd05a5
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
with:
script: |
const issueTemplate = `
### [🚀 Staging Environment Ready for Testing 🚀](${process.env.CONTAINER_APP_URL})
### 🚀 Staging Environment Ready for Testing 🚀
The staging environment is ready for testing. Please verify that the following items are working as expected:
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/destroy-demo-resources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Housekeeping - Destroy Demo Resources

on:
workflow_dispatch:

permissions:
issues: write
contents: read
actions: write

jobs:
destroy-demo-resources-stage:
runs-on: ubuntu-latest
environment: STAGE

steps:
- name: Checkout code
uses: actions/[email protected]

- name: 'Az CLI Login via OIDC'
uses: azure/[email protected]
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Set up Terraform
uses: hashicorp/[email protected]

- name: Terraform Destroy
run: |
terraform init
terraform destroy -auto-approve -var 'sql_admin_password=${{ secrets.SA_PASSWORD }}'
working-directory: ./terraform/staging
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
ARM_USE_OIDC: true

destroy-demo-resources-prod:
runs-on: ubuntu-latest
environment: PROD

steps:
- name: Checkout code
uses: actions/[email protected]

- name: 'Az CLI Login via OIDC'
uses: azure/[email protected]
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Set up Terraform
uses: hashicorp/[email protected]

- name: Terraform Destroy
run: |
terraform init
terraform destroy -auto-approve -var 'sql_admin_password=${{ secrets.SA_PASSWORD }}'
working-directory: ./terraform/production
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
ARM_USE_OIDC: true

0 comments on commit ddd05a5

Please sign in to comment.