Skip to content

Terraform plan dev by @alismx #144

Terraform plan dev by @alismx

Terraform plan dev by @alismx #144

Workflow file for this run

name: Ad-hoc Terraform Plan
run-name: Terraform plan ${{ inputs.env }} by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
env:
description: 'The environment to deploy to'
required: true
type: choice
options:
- dev
- dev2
- dev3
- dev4
- dev5
- dev6
- dev7
- pentest
- test
- demo
- training
- stg
- prod
- all
env:
ARM_CLIENT_ID: ${{ secrets.TERRAFORM_ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.TERRAFORM_ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.TERRAFORM_ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.TERRAFORM_ARM_TENANT_ID }}
OKTA_API_TOKEN: ${{ secrets.OKTA_API_TOKEN_NONPROD }}
jobs:
matrix_prep:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set_matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set_matrix
run: |
if [[ "${{ inputs.env }}" == "all" ]]; then
matrix=[{\"env\":\"dev\"},{\"env\":\"dev2\"},{\"env\":\"dev3\"},{\"env\":\"dev4\"},{\"env\":\"dev5\"},{\"env\":\"dev6\"},{\"env\":\"dev7\"},{\"env\":\"pentest\"},{\"env\":\"test\"},{\"env\":\"demo\"},{\"env\":\"training\"},{\"env\":\"stg\"},{\"env\":\"prod\"}]
else
matrix=[{\"env\":\"${{ inputs.env }}\"}]
fi
echo "matrix={\"include\":$(echo $matrix)}" >> $GITHUB_OUTPUT
terraform_plan:
needs: matrix_prep
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
defaults:
run:
working-directory: ./ops
steps:
- uses: actions/checkout@v4
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Use prod Okta token if required
if: ${{ matrix.env == 'prod' || matrix.env == 'stg' || matrix.env == 'training' }}
run: |
echo "OKTA_API_TOKEN=${{ secrets.OKTA_API_TOKEN }}" >> "$GITHUB_ENV"
- uses: hashicorp/[email protected]
with:
terraform_version: 1.3.3
- name: Terraform Init
run: make init-${{ matrix.env }}
- name: Build ReportStream function app
uses: ./.github/actions/build-reportstream-functions
with:
deploy-env: ${{ matrix.env }}
- name: Terraform plan
run: make plan-${{ matrix.env }}