Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/linters/.powershell-psscriptanalyzer.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# PSScriptAnalyzerSettings.psd1
@{
Severity=@('Error','Warning')
# ExcludeRules=@('PSAvoidUsingCmdletAliases', 'PSAvoidUsingWriteHost')
}
1 change: 1 addition & 0 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
VALIDATE_JSON: true
VALIDATE_MARKDOWN: true
VALIDATE_POWERSHELL: true
POWERSHELL_CONFIG_FILE: ".github/linters/.powershell-psscriptanalyzer.psd1"
VALIDATE_YAML: true
VALIDATE_BASH: true
VALIDATE_EDITORCONFIG: true
Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/module-index-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Workflow for testing all module index CSVs
name: .Platform - Test Module Index CSVs

on:
pull_request:
paths:
- 'docs/static/module-indexes/**'
workflow_dispatch: {}

defaults:
run:
shell: pwsh

jobs:
Test-Module-Index-CSVs:
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Test BicepResourceModules.csv
shell: pwsh
run: |
$RepoRoot = $env:GITHUB_WORKSPACE

. (Join-Path $RepoRoot "utilities" "tools" "module-indexes" "Test-AvmModuleIndexCSVs.ps1") -CsvFiles $(Join-Path $RepoRoot "docs" "static" "module-indexes" "BicepResourceModules.csv")
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ always() }}


- name: Test BicepPatternModules.csv
shell: pwsh
run: |
$RepoRoot = $env:GITHUB_WORKSPACE

. (Join-Path $RepoRoot "utilities" "tools" "module-indexes" "Test-AvmModuleIndexCSVs.ps1") -CsvFiles $(Join-Path $RepoRoot "docs" "static" "module-indexes" "BicepPatternModules.csv")
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ always() }}

- name: Test BicepUtilityModules.csv
shell: pwsh
run: |
$RepoRoot = $env:GITHUB_WORKSPACE

. (Join-Path $RepoRoot "utilities" "tools" "module-indexes" "Test-AvmModuleIndexCSVs.ps1") -CsvFiles $(Join-Path $RepoRoot "docs" "static" "module-indexes" "BicepUtilityModules.csv")
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ always() }}

- name: Test TerraformResourceModules.csv
shell: pwsh
run: |
$RepoRoot = $env:GITHUB_WORKSPACE

. (Join-Path $RepoRoot "utilities" "tools" "module-indexes" "Test-AvmModuleIndexCSVs.ps1") -CsvFiles $(Join-Path $RepoRoot "docs" "static" "module-indexes" "TerraformResourceModules.csv")
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ always() }}


- name: Test TerraformPatternModules.csv
shell: pwsh
run: |
$RepoRoot = $env:GITHUB_WORKSPACE

. (Join-Path $RepoRoot "utilities" "tools" "module-indexes" "Test-AvmModuleIndexCSVs.ps1") -CsvFiles $(Join-Path $RepoRoot "docs" "static" "module-indexes" "TerraformPatternModules.csv")
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ always() }}

- name: Test TerraformUtilityModules.csv
shell: pwsh
run: |
$RepoRoot = $env:GITHUB_WORKSPACE

. (Join-Path $RepoRoot "utilities" "tools" "module-indexes" "Test-AvmModuleIndexCSVs.ps1") -CsvFiles $(Join-Path $RepoRoot "docs" "static" "module-indexes" "TerraformUtilityModules.csv")
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ always() }}
2 changes: 1 addition & 1 deletion docs/content/help-support/known-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Although, if you think a known issue is missing from this page please create an

### Bicep what-if compatibility with modules

[Bicep/ARM What-If](https://learn.microsoft.com/azure/azure-resource-manager/bicep/deploy-what-if) has a known issue today where it short-circuits whenever a runtime function is used in a nested template. And due to the way [Bicep modules](https://learn.microsoft.com/azure/azure-resource-manager/bicep/modules) work, all module declarations in a Bicep file end up as a resulting nested template deployment in the underlying generated ARM template, thereby invoking this known issue.
[Bicep/ARM What-If](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deploy-what-if) has a known issue today where it short-circuits whenever a runtime function is used in a nested template. And due to the way [Bicep modules](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/modules) work, all module declarations in a Bicep file end up as a resulting nested template deployment in the underlying generated ARM template, thereby invoking this known issue.

{{< hint type=note icon=gdoc_github title="GitHub Issue for Further Information & Discussion" >}}

Expand Down
57 changes: 57 additions & 0 deletions utilities/tools/module-indexes/Test-AvmModuleIndexCSVs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<#
.SYNOPSIS
This script tests the Azure Verified Modules (AVM) module index CSV file for correctness and completeness.

.DESCRIPTION
The Test-AvmModuleIndexCSVs.ps1 script is designed to validate the structure and content of the AVM module index CSV file.
It checks for required columns and values, validates data formats, and ensures there are no missing or duplicate entries, etc.

.PARAMETER CsvFilePath
The path to the CSV file that needs to be tested.

.EXAMPLE
.\Test-AvmModuleIndexCSVs.ps1
This command runs the script on the default, pre-specified CSV files.

.EXAMPLE
.\Test-AvmModuleIndexCSVs.ps1 -CsvFiles "C:\path\to\module-index.csv"
This command runs the script on the CSV file provided in the input paramter.

.EXAMPLE
.\Test-AvmModuleIndexCSVs.ps1 -CsvFiles "C:\path\to\module-index1.csv", C:\path\to\module-index2.csv"
This command runs the script on the CSV files provided in the input paramter.
#>

[CmdletBinding()]
param (
[Parameter(Mandatory = $false, Position = 0, HelpMessage = "Enter the full path to the CSV file.")]
[ValidateNotNullOrEmpty()]
[Alias("Path")]
[array]$CsvFiles = @(
$(Join-Path (Get-Item -Path $PSScriptRoot).parent.parent.parent.FullName "docs" "static" "module-indexes" "BicepResourceModules.csv"),
$(Join-Path (Get-Item -Path $PSScriptRoot).parent.parent.parent.FullName "docs" "static" "module-indexes" "BicepPatternModules.csv"),
$(Join-Path (Get-Item -Path $PSScriptRoot).parent.parent.parent.FullName "docs" "static" "module-indexes" "BicepUtilityModules.csv"),
$(Join-Path (Get-Item -Path $PSScriptRoot).parent.parent.parent.FullName "docs" "static" "module-indexes" "TerraformResourceModules.csv"),
$(Join-Path (Get-Item -Path $PSScriptRoot).parent.parent.parent.FullName "docs" "static" "module-indexes" "TerraformPatternModules.csv"),
$(Join-Path (Get-Item -Path $PSScriptRoot).parent.parent.parent.FullName "docs" "static" "module-indexes" "TerraformUtilityModules.csv")
)
)

$RepoRoot = (Get-Item -Path $PSScriptRoot).parent.parent.parent.FullName

$testFile = Join-Path $RepoRoot "utilities" "tools" "module-indexes" "module-index.tests.ps1"

foreach ($file in $csvFiles) {
$pesterConfiguration = @{
Run = @{
Container = New-PesterContainer -Path $testFile -Data @{
CsvFilePath = $file
}
PassThru = $true
}
Output = @{
Verbosity = 'Detailed'
}
}
Invoke-Pester -Configuration $pesterConfiguration
}
Loading