Azure / PSRule.Rules.Azure

Rules to validate Azure resources and infrastructure as code (IaC) using PSRule.
https://azure.github.io/PSRule.Rules.Azure/
MIT License
394 stars 86 forks source link

Template parameter does not use the required format with nested modules as Bicep v0.13.x #1930

Closed tyconsulting closed 1 year ago

tyconsulting commented 1 year ago

Description of the issue

When a bicep template is compiled into an ARM template (.json) using the latest bicep release v0.13.1, PSRule cannot parse the compiled ARM .json template and complained certain parameters are not in the required format

To Reproduce

Steps to reproduce the issue: i.e. when using the SQL Database CARML module , the database Sku cannot be calculated by PSRule.

Expected behaviour

PSRule should successfully scan the compiled ARM template. PSRule CAN successfully scan it if the ARM template is compiled using previous bicep version v0.12.40.

Error output

[ERROR] Unable to expand resources because the template 'main2.json' was not valid with parameters 'main2.parameters.json'. The template parameter 'skuTier' does not use the required format

Module in use and version:

Captured output from $PSVersionTable:

Name                           Value
----                           -----
PSVersion                      7.3.0
PSEdition                      Core
GitCommitId                    7.3.0
OS                             Darwin 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Additional context

I cannot publicly share the templates I used to reproduce the error, but I have emailed @BernieWhite the templates

ahmadabdalla commented 1 year ago

Cc @AlexanderSehr @eriqua

BernieWhite commented 1 year ago

Thanks @tyconsulting. I see the issue. Some of the structure of nested deployments (module) has changed. We should be able to release a fix for this.

BernieWhite commented 1 year ago

This should be fixed by v1.22.1.