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

fix: Allow empty parameters in subnet avm/res/network/virtual-network #1772

Merged

Conversation

cloudchristoph
Copy link
Contributor

Description

You cannot provide the following parameters in your subnet parameter, if they are empty:

  • networkSecurityGroup
  • natGateway
  • routeTable

As soon as they are set, they have to have a correct resource id.

This PR implements additional checks for given, but empty, parameters.
I also added a new subnet definition in the max test to check for the correct behaviour.

Fixes #1681
Closes #1681

Pipeline Reference

Pipeline
avm.res.network.virtual-network

Type of Change

  • Update to CI Environment or utilities (Non-module effecting changes)
  • Azure Verified Module updates:
    • Bugfix containing backwards compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in version.json:
      • Someone has opened a bug report issue, and I have included "Closes #{bug_report_issue_number}" in the PR description.
      • The bug was found by the module author, and no one has opened an issue to report it yet.
    • Feature update backwards compatible feature updates, and I have bumped the MINOR version in version.json.
    • Breaking changes and I have bumped the MAJOR version in version.json.
    • Update to documentation

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • I have run Set-AVMModule locally to generate the supporting module files.
  • My corresponding pipelines / checks run clean and green without any errors or warnings

@cloudchristoph cloudchristoph requested review from a team as code owners April 29, 2024 09:44
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Triage 🔍 Maintainers need to triage still label Apr 29, 2024

Important

The "Needs: Triage 🔍" label must be removed once the triage process is complete!

Tip

For additional guidance on how to triage this issue/PR, see the BRM Issue Triage documentation.

Note

This label was added as per ITA06.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue label Apr 29, 2024

Note

The "Type: AVM 🅰️ ✌️ Ⓜ️" label was added as per ITA08BCP.

@elbatane
Copy link
Contributor

elbatane commented Apr 29, 2024

Hi @cloudchristoph , would you mind to add the !empty also for: privateEndpointNetworkPolicies and privateLinkServiceNetworkPolicies? To set the subnet within the vnet the same way we have inside the subnet module (

privateEndpointNetworkPolicies: !empty(privateEndpointNetworkPolicies) ? any(privateEndpointNetworkPolicies) : null
) . Thank you very much

@cloudchristoph
Copy link
Contributor Author

Hi @cloudchristoph , would you mind to add the !empty also for: privateEndpointNetworkPolicies and privateLinkServiceNetworkPolicies? To set the subnet within the vnet the same way we have inside the subnet module (

privateEndpointNetworkPolicies: !empty(privateEndpointNetworkPolicies) ? any(privateEndpointNetworkPolicies) : null

) . Thank you very much

Sure. But for this parameter and the others you're already allowed to give an empty array or null as value and it still works. This wasn't the case for the three changed parameters.

Correct me, if I'm wrong.

I would like to ask one more question:
What will be allowed as an as “not set parameter”? Now it is a mixture of '', null, and [].

@elbatane elbatane removed the Needs: Triage 🔍 Maintainers need to triage still label Apr 29, 2024
@AlexanderSehr
Copy link
Contributor

Hey @elbatane, the PR looks good to me. Please also take a look :)

@elbatane elbatane merged commit bf2f123 into Azure:main May 3, 2024
11 checks passed
@cloudchristoph cloudchristoph deleted the 1681_vnet_subnet_conditional_params branch May 30, 2024 21:55
hundredacres pushed a commit to hundredacres/bicep-registry-modules that referenced this pull request Jun 19, 2024
…k` (Azure#1772)

## Description

You cannot provide the following parameters in your subnet parameter, if
they are empty:

- networkSecurityGroup
- natGateway
- routeTable

As soon as they are set, they have to have a correct resource id. 

This PR implements additional checks for given, but empty, parameters.
I also added a new subnet definition in the `max` test to check for the
correct behaviour.

Fixes Azure#1681
Closes Azure#1681

## Pipeline Reference

| Pipeline |
| -------- |
|
[![avm.res.network.virtual-network](https://github.com/cloudchristoph/bicep-registry-modules/actions/workflows/avm.res.network.virtual-network.yml/badge.svg?branch=1681_vnet_subnet_conditional_params)](https://github.com/cloudchristoph/bicep-registry-modules/actions/workflows/avm.res.network.virtual-network.yml)
|

## Type of Change

- [ ] Update to CI Environment or utilities (Non-module effecting
changes)
- [x] Azure Verified Module updates:
- [x] Bugfix containing backwards compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [x] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [ ] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [x] Update to documentation

## Checklist

- [x] I'm sure there are no other open Pull Requests for the same
update/change
- [x] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [x] My corresponding pipelines / checks run clean and green without
any errors or warnings

<!-- Please keep up to day with the contribution guide at
https://aka.ms/avm/contribute/bicep -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[AVM Module Issue]: How to conditionally define network security group in subnets
3 participants