Skip to content

chore: update backend var #4

chore: update backend var

chore: update backend var #4

name: GHA Self-hosted Infra - Azure
on:
push:
paths:
- create-azure-infra/**
workflow_dispatch:
inputs:
confirm:
description: "Type 'yes' to confirm Terraform destroy"
required: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: dev
defaults:
run:
shell: bash
working-directory: create-azure-infra
steps:
- name: 'Checkout Azure Infra'
uses: actions/checkout@v4
with:
sparse-checkout:
create-azure-infra
- name: Authenticate with Azure
uses: azure/login@v2
with:
creds: '{"clientId":"${{ secrets.ARM_CLIENT_ID }}", "clientSecret":"${{ secrets.ARM_CLIENT_SECRET }}", "subscriptionId":"${{ secrets.ARM_SUBSCRIPTION_ID }}", "tenantId":"${{ secrets.ARM_TENANT_ID }}"}'
- name: "Terraform init"
run : |
pwd
terraform init -backend-config="${{ github.event.deployment_environment }}-backend-config="backend.config"
- name: Terraform Apply
if: github.event_name == 'push'
run: terraform apply -var-file=${{ github.event.deployment_environment }}.tfvars \
-auto-approve tfplan
- name: Terraform destroy plan
if: github.event.inputs.confirm == 'yes'
run: terraform plan -destroy -out=destroyplan
- name: Terraform destroy infra
if: github.event.inputs.confirm == 'yes'
run: terraform apply -destroy -out=destroyplan