Skip to content

Update Terraform azurerm to v3.104.2 #196

Update Terraform azurerm to v3.104.2

Update Terraform azurerm to v3.104.2 #196

Workflow file for this run

name: Main Branch Workflow
on:
push:
branches:
- main
permissions:
pull-requests: write
id-token: write
contents: read
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Terraform format
uses: dflook/terraform-fmt@v1
- name: Status check
shell: bash
run: git diff --exit-code
lint-find-dirs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: set-matrix
run: |
matrix=$(find ./ -name '*.tf' \
-not -path '*/.terraform/*' \
-exec dirname {} \; \
| sort \
| uniq \
| jq --raw-input --slurp 'split("\n")| map(select(. != ""))')
echo "matrix=$(echo $matrix)" >> $GITHUB_OUTPUT
outputs:
tfdirs_matrix: ${{ steps.set-matrix.outputs.matrix }}
lint-init:
runs-on: ubuntu-latest
needs: lint-find-dirs
env:
TFLINT_PLUGIN_DIR: ${{ github.workspace }}/.tflint.d/plugins
TFLINT_PLUGINS: aws azurerm google
steps:
- name: Create TFLint Plugin Directory
run: mkdir -p ${{ env.TFLINT_PLUGIN_DIR }}
- name: Create temp empty folder
run: mkdir -p empty
- name: tflint init
uses: reviewdog/action-tflint@v1.21.0
with:
reporter: "local"
fail_on_error: false
tflint_rulesets: ${{ env.TFLINT_PLUGINS }}
tflint_init: true
working_directory: "./empty"
filter_mode: nofilter
tflint_version: "v0.49.0"
- name: cache tflint plugins
id: cache-plugins
uses: actions/cache@v3
with:
path: ${{ env.TFLINT_PLUGIN_DIR }}
key: tflint-plugins-${{ env.TODAY }}
lint:
runs-on: ubuntu-latest
needs: [lint-find-dirs, lint-init]
strategy:
fail-fast: false
matrix:
tfdir: ${{ fromJson(needs.lint-find-dirs.outputs.tfdirs_matrix) }}
env:
TFLINT_PLUGIN_DIR: ${{ github.workspace }}/.tflint.d/plugins
TFLINT_PLUGINS: aws azurerm google
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
- run: terraform init
working-directory: ${{ matrix.tfdir }}
- name: Set current date as env variable
run: echo "TODAY=$(date +'%Y-%b-%d' | awk '{print toupper($0)}')" >> $GITHUB_ENV
- name: Restore cached tflint plugins
id: cache-tflint-plugins-restore
uses: actions/cache/restore@v4
with:
path: ${{ env.TFLINT_PLUGIN_DIR }}
key: tflint-plugins-${{ env.TODAY }}
- name: tflint
uses: reviewdog/action-tflint@v1.21.0
with:
reporter: "local"
fail_on_error: true
tflint_rulesets: ${{ env.TFLINT_PLUGINS }}
tflint_init: false
working_directory: ${{ matrix.tfdir }}
filter_mode: nofilter
tflint_version: "v0.49.0"