Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Null parameter overrides default value #2795

Closed
krbar opened this issue Apr 2, 2024 · 1 comment · Fixed by #2799
Closed

[BUG] Null parameter overrides default value #2795

krbar opened this issue Apr 2, 2024 · 1 comment · Fixed by #2799
Assignees
Labels
bug Something isn't working feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep.
Milestone

Comments

@krbar
Copy link

krbar commented Apr 2, 2024

Existing rule

Azure.PublicIP.StandardSKU

Description of the issue

I'm trying to fix the WAF-Reliability (Azure.Pillar.Reliability) of the AVM module avm/res/network/bastion-host and the tests are failing on following rules:

AZR-000158: Azure.PublicIP.StandardSKU. Public IP addresses should be deployed with Standard SKU for production workloads.
AZR-000395: Azure.PublicIP.MigrateStandard. Use the Standard SKU for Public IP addresses as the Basic SKU will be retired.

Scenario:

Error messages

[info] Using Version: 2.9.0
[info] Using Action: __self_2
[info] Using Workspace: /home/runner/work/bicep-registry-modules/bicep-registry-modules
[info] Using PWD: /home/runner/work/bicep-registry-modules/bicep-registry-modules
[info] Using Path: /home/runner/work/bicep-registry-modules/bicep-registry-modules
[info] Using Source: /home/runner/work/bicep-registry-modules/bicep-registry-modules/avm/utilities/pipelines/staticValidation/psrule/.ps-rule/
[info] Using Baseline: Azure.Pillar.Reliability
[info] Using Conventions: 
[info] Using InputType: repository
[info] Using InputPath: /home/runner/work/bicep-registry-modules/bicep-registry-modules/avm/res/network/bastion-host/tests/e2e/defaults/main.test.bicep
[info] Using Option: /home/runner/work/bicep-registry-modules/bicep-registry-modules/avm/utilities/pipelines/staticValidation/psrule/ps-rule.yaml
[info] Using Outcome: 
[info] Using OutputFormat: Csv
[info] Using OutputPath: avm/res/network/bastion-host/tests/e2e/defaults/main.test.bicep-PSRule-output.csv
[info] Using Summary: false

---
    ____  _____ ____        __
   / __ \/ ___// __ \__  __/ /__
  / /_/ /\__ \/ /_/ / / / / / _ \
 / ____/___/ / _, _/ /_/ / /  __/
/_/    /____/_/ |_|\__,_/_/\___/

Using PSRule v2.9.0
Using PSRule.Rules.Azure v1.35.0

----------------------------
Explore documentation: https://aka.ms/ps-rule
Contribute and find source: https://github.com/microsoft/PSRule
Report issues: https://github.com/microsoft/PSRule/issues
PSRule.Rules.Azure: https://aka.ms/ps-rule-azure
----------------------------

From repository: https://github.com/krbar/bicep-registry-modules
  on : users/krbar/bastionWAF
  at : 808f50005afdbcc7f503e3bc92112371db0e13fe

 -> ***nbhmin001-pip : Microsoft.Network/publicIPAddresses [0/1]

    [FAIL] Azure.PublicIP.StandardSKU (AZR-000158)
    | Template: avm/res/network/bastion-host/tests/e2e/defaults/main.test.bicep:1107:40

    | RECOMMEND:
    | Consider using Standard SKU for Public IP addresses deployed in production.

    | REASON:
    | - Path sku.name: The field 'sku.name' does not exist.

    | HELP:
    | - https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.PublicIP.StandardSKU/

Error: AZR-000158: ***nbhmin001-pip failed Azure.PublicIP.StandardSKU. Public IP addresses should be deployed with Standard SKU for production workloads.


Rules processed: 1, failed: 1, errored: 0
Run krbar/bicep-registry-modules/85[205](https://github.com/krbar/bicep-registry-modules/actions/runs/8520500847/job/23336745635#step:4:210)00847 completed in 00:00:05.9216107
Output written to the following file: '/home/runner/work/bicep-registry-modules/bicep-registry-modules/avm/res/network/bastion-host/tests/e2e/defaults/main.test.bicep-PSRule-output.csv'
Error: One or more assertions failed. One or more rules reported failure.

---
Error: Process completed with exit code 1.

Reproduction

Perform the PS Rule validation on the file avm/res/network/bastion-host/tests/e2e/defaults/main.test.bicep

Link to the module root folder: https://github.com/krbar/bicep-registry-modules/tree/users/krbar/bastionWAF/avm/res/network/bastion-host

Version of PSRule

2.9.0

Version of PSRule for Azure

1.35.0

Additional context

No response

@krbar krbar added bug Something isn't working Needs: Triage 🔍 Needs attention from the team. labels Apr 2, 2024
@BernieWhite BernieWhite self-assigned this Apr 2, 2024
@BernieWhite BernieWhite added feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep. and removed Needs: Triage 🔍 Needs attention from the team. labels Apr 2, 2024
@BernieWhite
Copy link
Collaborator

@krbar Thanks for reporting the issue. This appears to be a problem with expansion passing null instead of the parameter default.

@BernieWhite BernieWhite changed the title [BUG] PSRule does not to recognize the SKU of the Public IP properly [BUG] Null parameter overrides default value Apr 3, 2024
@BernieWhite BernieWhite added this to the v1.35.1 milestone Apr 3, 2024
BernieWhite added a commit to BernieWhite/PSRule.Rules.Azure that referenced this issue Apr 3, 2024
This was referenced Apr 3, 2024
BernieWhite added a commit that referenced this issue Apr 3, 2024
* Fixes null parameter overrides default #2795 (#2797)

* Release v1.35.1 (#2798)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants