Skip to content

Commit

Permalink
fix: add missing tf deploy pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
mrickettsk committed Dec 16, 2024
1 parent e582dff commit 48a0877
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/deploy-terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Workflow will deploy the terraform configuration to Azure
name: Deploy to Azure

# Triggers for the workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
# Job to deploy the terraform configuration
terraform:
runs-on: ubuntu-latest
env:
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
BACKEND_RESOURCE_GROUP: ${{ secrets.BACKEND_RESOURCE_GROUP }}
BACKEND_STORAGE_ACCOUNT: ${{ secrets.BACKEND_STORAGE_ACCOUNT }}
BACKEND_CONTAINER_NAME: ${{ secrets.BACKEND_CONTAINER_NAME }}
SYSTEM_API_KEY: ${{ secrets.SYSTEM_API_KEY }}
DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}

TF_VERSION: 1.3.6

defaults:
run:
shell: bash
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4

# Create a blank .env file for make
- name: Create a blank .env for make
run: |
touch .env
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TF_VERSION }}

- name: 'Terraform Lint Check'
run: |
make tf-fmt
# Auto commit changes after formatting
- name: Auto Commit Changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Terraform fmt"
file_pattern: "*.tf"
commit_user_name: "github-actions[bot]"

- name: 'Terraform Init'
run: |
make tf-init
- name: 'Terraform Plan'
run: |
make tf-plan
- name: 'Terraform Apply'
if: github.event_name != 'pull_request'
run: |
make tf-apply

0 comments on commit 48a0877

Please sign in to comment.