Skip to content

[CES-324] Added example and documentation for a develop environment with Core infra #33

[CES-324] Added example and documentation for a develop environment with Core infra

[CES-324] Added example and documentation for a develop environment with Core infra #33

Workflow file for this run

name: Test Terraform modules plan
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
branches:
- main
paths:
- "infra/modules/**"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
env:
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
ARM_USE_OIDC: true
ARM_USE_AZUREAD: true
ARM_STORAGE_USE_AZUREAD: true
jobs:
get-modified-modules:
uses: ./.github/workflows/get_modified_modules.yaml
name: Get Modified Modules
if: ${{ github.event_name != 'workflow_dispatch' }}
with:
from_ref: ${{ github.event.before }}
get-all-modules:
uses: ./.github/workflows/get_all_modules.yaml
name: Get All Modules
if: ${{ github.event_name == 'workflow_dispatch' }}
terraform-test:
runs-on: ubuntu-latest
needs: [get-modified-modules, get-all-modules]
if: always()
environment: dev-ci
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
module: ${{ fromJSON(needs.get-all-modules.outputs.modules || needs.get-modified-modules.outputs.modules) }}
env:
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Azure Login
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2
with:
client-id: ${{ env.ARM_CLIENT_ID }}
tenant-id: ${{ env.ARM_TENANT_ID }}
subscription-id: ${{ env.ARM_SUBSCRIPTION_ID }}
- name: Set Terraform Version
id: set-terraform-version
run: |
set -eu
terraform_version=$(cat .terraform-version)
printf "terraform_version=$terraform_version" >> "$GITHUB_OUTPUT"
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
name: Setup Terraform
with:
terraform_version: ${{ steps.set-terraform-version.outputs.terraform_version }}
- name: Terraform Init
working-directory: infra/modules/${{ matrix.module }}
run: |
set -euo
terraform init
- name: Terraform Test
working-directory: infra/modules/${{ matrix.module }}
run: |
set -euo
terraform test