Skip to content

Commit

Permalink
Merge branch 'AL-updatep' of github.com:arnaudlh/terraform-azurerm-ca…
Browse files Browse the repository at this point in the history
…f into arnaudlh-AL-updatep
  • Loading branch information
arnaudlh committed Jun 3, 2024
2 parents 078b101 + a58c5dd commit 1083b00
Show file tree
Hide file tree
Showing 38 changed files with 705 additions and 901 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
# Licensed under the MIT License.
#

name: PR Dispatch Workflow
name: PR Tflint

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]

env:
TF_VERSION: "1.8.4"
TF_LINT_VERSION: "v0.50.3"

jobs:
linting:
name: Format and Lint Checks
Expand All @@ -35,29 +37,10 @@ jobs:
with:
tflint_version: ${{ env.TF_LINT_VERSION }}


- name: Run TFLint with reviewdog
uses: reviewdog/action-tflint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check
level: info
tflint_init: true

dispatch:
runs-on: ubuntu-latest
strategy:
matrix:
scenario:
- standalone-scenarios-azuread.json
- standalone-scenarios.json
- standalone-compute.json
- standalone-networking.json
- standalone-scenarios-longrunners.json

steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
event-type: pr-${{ matrix.scenario }}
client-payload: '{"scenario": "${{ (matrix.scenario) }}", "sha": "${{ github.event.pull_request.head.sha }}"}'
96 changes: 96 additions & 0 deletions .github/workflows/pr_tests-azuread.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#
# Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
#

name: PR azuread-tests

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'azuread*'
- 'modules/azuread/**'
- 'examples/azuread/**'
- '.github/workflows/*azuread.*'

env:
SCENARIO: standalone-azuread.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
96 changes: 96 additions & 0 deletions .github/workflows/pr_tests-compute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#
# 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
102 changes: 102 additions & 0 deletions .github/workflows/pr_tests-dataplat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#
# Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
#

name: PR dataplat-tests

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'mssql*'
- 'modules/analytics/**'
- 'modules/databases/**'
- 'modules/data_factory/**'
- 'modules/purview/**'
- 'examples/analytics/**'
- 'examples/databases/**'
- 'examples/data_factory/**'
- 'examples/purview/**'
- '.github/workflows/*dataplat.*'

env:
SCENARIO: standalone-dataplat.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
Loading

0 comments on commit 1083b00

Please sign in to comment.