Housekeeping - Destroy Demo Resources #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Housekeeping - Destroy Demo Resources | |
on: | |
workflow_dispatch: | |
permissions: | |
issues: write | |
id-token: write # This is required for requesting the JWT | |
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 |