Skip to content

Update to azurerm 4.7.0 #28

Update to azurerm 4.7.0

Update to azurerm 4.7.0 #28

#
# Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
#
name: PR compute-tests
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'compute_*'
- 'modules/compute/**'
- 'examples/compute/**'
- '.github/workflows/*compute.*'
env:
SCENARIO: standalone-compute.json
TF_VERSION: "1.8.4"
TF_LINT_VERSION: "v0.50.3"
jobs:
load_scenarios:
name: Load Test Scenarios Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.load_scenarios.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: load_scenarios
run: |
cases=$(cat ./.github/workflows/${{ env.SCENARIO }} | jq -c .)
echo "matrix=${cases}" >> $GITHUB_OUTPUT
mock_plan_scenarios:
name: ${{ matrix.config_files }}
runs-on: ubuntu-latest
needs: load_scenarios
strategy:
fail-fast: false
matrix: ${{fromJSON(needs.load_scenarios.outputs.matrix)}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create environment variables
run: |
cd ${GITHUB_WORKSPACE}/examples/${{ matrix.config_files }}
FILE_NAME=$(echo ${{ matrix.config_files }} | sed 's./..g' | xargs)
echo STATE_FILE=${HOME}/tfstates/${FILE_NAME}.tfstate >> $GITHUB_ENV
echo PLAN_FILE=${HOME}/tfstates/${FILE_NAME}.plan >> $GITHUB_ENV
echo CURRENT_FOLDER=${GITHUB_WORKSPACE}/examples/${{ matrix.config_files }} >> $GITHUB_ENV
echo PARAMETER_FILES=$(find ${GITHUB_WORKSPACE}/examples/${{ matrix.config_files }} | grep .tfvars | sed 's/.*/-var-file=&/' | xargs) >> $GITHUB_ENV
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TF_VERSION }}
- name: Configure Terraform plugin cache
run: |
echo "TF_PLUGIN_CACHE_DIR=$HOME/.terraform.d/plugin-cache" >>"$GITHUB_ENV"
mkdir --parents "$HOME/.terraform.d/plugin-cache"
- name: Cache Terraform
uses: actions/cache@v4
with:
path: |
~/.terraform.d/plugin-cache
key: ${{ runner.os }}-terraform-${{ hashFiles('**/.terraform.lock.hcl') }}
restore-keys: |
${{ runner.os }}-terraform-
- name: Terraform Init example
id: tf_init
run: |
terraform -chdir=examples \
init
- name: Terraform Test example
id: tf_test
run: |
terraform -chdir=examples \
test \
-test-directory=./tests/mock \
${{ env.PARAMETER_FILES }} \
-verbose