Skip to content

Destroy Azure Deployment #1

Destroy Azure Deployment

Destroy Azure Deployment #1

name: Destroy Azure Deployment
on:
workflow_dispatch:
jobs:
destroy_azure_deployment:
runs-on: ubuntu-latest
env:
TF_VAR_azure_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
TF_VAR_azure_tenant_id: ${{ secrets.AZURE_TENANT_ID }}
TF_VAR_azure_client_id: ${{ secrets.AZURE_CLIENT_ID }}
TF_VAR_azure_client_secret: ${{ secrets.AZURE_CLIENT_SECRET }}
TF_VAR_ghcr_username: ${{ secrets.GHCR_USERNAME }}
TF_VAR_ghcr_access_token: ${{ secrets.GHCR_ACCESS_TOKEN }}
TF_VAR_docker_image: dgataz-aks-application:latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Download Encrypted Artifact & Decrypt Artifact
uses: badgerhobbs/terraform-state@v1
with:
encryption_key: ${{ secrets.ENCRYPTION_KEY }}
operation: download
location: artifact
directory: ./Terraform
github_token: ${{ secrets.GH_ACCESS_TOKEN }}
continue-on-error: true
- name: Generate SSH key
run: ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa
- name: Configure Terraform
uses: hashicorp/setup-terraform@v2
- name: Initialize Terraform
run: terraform -chdir="./Terraform" init
- name: Deploy to Azure
run: |
terraform -chdir="./Terraform" destroy -auto-approve
- name: Encrypt Artifact & Upload Encrypted Artifact
uses: badgerhobbs/terraform-state@v1
with:
encryption_key: ${{ secrets.ENCRYPTION_KEY }}
operation: upload
location: artifact
directory: ./Terraform
github_token: ${{ secrets.GH_ACCESS_TOKEN }}