Terraform plan dev by @alismx #227
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ad-hoc Terraform Plan | |
run-name: Terraform plan ${{ inputs.env }} by @${{ github.actor }} | |
on: | |
workflow_dispatch: | |
inputs: | |
env: | |
description: 'What to plan against' | |
required: true | |
type: choice | |
options: | |
- dev | |
- dev2 | |
- dev3 | |
- dev4 | |
- dev5 | |
- dev6 | |
- pentest | |
- test | |
- demo | |
- training | |
- stg | |
- prod | |
- all_environments | |
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 | |
uses: ./.github/actions/matrix-prep | |
with: | |
env: ${{ inputs.env }} | |
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@v2 | |
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 }} | |
- name: Terraform key replacement plan | |
run: make plan-key-replacement-${{ matrix.env }} |