Terraform Tasks:
- create below resources
- modules
- vm
- storage account & container
- vmss
- image template
- use above module and deploy resources
- configure backend
- modules
create git repo and add all configurtion
name: Azure Terraform Deploy
on:
push:
branches:
- main
jobs:
terraform:
runs-on: ubuntu-latest
steps:
# Checkout repo
- name: Checkout
uses: actions/checkout@v4
# Setup Terraform
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.8.5
# Azure Login
- name: Azure Login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
# Terraform Init
- name: Terraform Init
run: terraform init
# Terraform Plan
- name: Terraform Plan
run: terraform plan -out=tfplan
# Terraform Apply
- name: Terraform Apply
if: github.ref == 'refs/heads/main'
run: terraform apply -auto-approve tfplan
