Skip to content

Merge pull request #2 from sumanmanna134/actions #5

Merge pull request #2 from sumanmanna134/actions

Merge pull request #2 from sumanmanna134/actions #5

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Terraform
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: ['main']
pull_request:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
terraform:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
ARM_CLIENT_ID: ${{secrets.AZURE_AD_CLIENT_ID}}
ARM_CLIENT_SECRET: ${{secrets.AZURE_AD_CLIENT_SECRET}}
ARM_SUBSCRIPTION_ID: ${{secrets.AZURE_SUBSCRIPTION_ID}}
ARM_TENANT_ID: ${{secrets.AZURE_AD_TENANT_ID}}
defaults:
run:
shell: bash
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# Runs a single command using the runners shell
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: '1.8.3'
- name: Terraform fmt
id: fmt
run: terraform fmt -check
- name: Terraform init
id: init
run: terraform init
- name: Terraform plan
id: plan
run: terraform plan --var-file="https://terraformstorageazaction.blob.core.windows.net/vars/terraform.tfvars?st=2024-07-26T09:55:06Z&se=2024-07-26T17:55:06Z&si=readvar&spr=https&sv=2022-11-02&sr=b&sig=8U%2B0VOnAPQfCvxsNOfoGgSkxCsDKosTdHpKUpaPCAr8%3D" -out azinfra.tfplan -no-color
- name: Terraform apply
id: apply
if: github.ref == 'refs/heads/"main"' && github.event_name == 'push'
run: terraform apply azinfra.tfplan -auto-approve