Skip to content

use az login in v1 on ci-cd pipeline #4

use az login in v1 on ci-cd pipeline

use az login in v1 on ci-cd pipeline #4

name: 'Terraform CI-CD'
on:
workflow_dispatch:
push:
branches:
- main
jobs:
terraformValidation:
name: 'Validate configurations'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.7.5
- name: Azure login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Terraform Init and Validate
run: |
terraform init
terraform validate
terraformExecution:
name: 'Apply configurations'
needs: terraformValidation
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.7.5
- name: Azure login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Terraform Init, Plan and Apply
run: |
terraform init
terraform plan
terraform apply -auto-approve