Skip to content

azurerm_network_manager_network_group - support for member_type property#30672

Merged
catriona-m merged 10 commits intohashicorp:mainfrom
teowa:ng-member
Dec 5, 2025
Merged

azurerm_network_manager_network_group - support for member_type property#30672
catriona-m merged 10 commits intohashicorp:mainfrom
teowa:ng-member

Conversation

@teowa
Copy link
Collaborator

@teowa teowa commented Sep 23, 2025

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

azurerm_network_manager_network_group - support for member_type property
azurerm_network_manager_static_member - now supports using a subnet as the target resource

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevant documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)
image

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes #28811

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the provider.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

Copy link
Collaborator

@gerrytan gerrytan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Some additional notes on my review:

  1. If you do an entire codebase search on network_manager_network_group over *test.go files, there are heaps more acctest that should be run. Please run them. Please use TeamCity and paste the link to be sure there are no diff with your local env. Also do consider using the acctest impact detection tool: https://github.com/WodansSon/terraform-terracorder.
  2. I see you bundled a bunch of test with a nested map on network_manager_resource_test.go, wouldn't this make test selection harder? I'm not sure about this pattern.
  3. Do not close the issue once this PR merges, there is another resource that needs to be dealt with: azurerm_network_manager_static_member.
  4. The change log needs to be updated: set the GH-00000 placeholder to the correct issue.

Type: pluginsdk.TypeString,
Optional: true,
Default: string(networkgroups.GroupMemberTypeVirtualNetwork),
ValidateFunc: validation.StringInSlice(networkgroups.PossibleValuesForGroupMemberType(), false),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this does not need ForceNew: true? If that's the case can you please add acctest to cover the update scenario

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test cases added

@teowa
Copy link
Collaborator Author

teowa commented Oct 14, 2025

Thanks for the PR. Some additional notes on my review:

  1. If you do an entire codebase search on network_manager_network_group over *test.go files, there are heaps more acctest that should be run. Please run them. Please use TeamCity and paste the link to be sure there are no diff with your local env. Also do consider using the acctest impact detection tool: https://github.com/WodansSon/terraform-terracorder.
  2. I see you bundled a bunch of test with a nested map on network_manager_resource_test.go, wouldn't this make test selection harder? I'm not sure about this pattern.
  3. Do not close the issue once this PR merges, there is another resource that needs to be dealt with: azurerm_network_manager_static_member.
  4. The change log needs to be updated: set the GH-00000 placeholder to the correct issue.

Thank you for your review!

  1. I will run additional tests; the Teamcity test result is still pending.
  2. Some tests have been split because the API now supports multiple Network Managers under one subscription.
  3. Changes have been made to the static member resource to support the feature requested in the issue.
  4. This has been updated.

@github-actions github-actions bot removed the size/M label Oct 14, 2025
@gerrytan
Copy link
Collaborator

Thank you, PR looks good to me except for acctest results in TeamCity.

@teowa
Copy link
Collaborator Author

teowa commented Oct 14, 2025

Tests can pass with
TEST_PREFIX = TestAccNetworkManagerNetworkGroup_|TestAccNetworkManagerNetworkGroupDataSource_|TestAccNetworkManagerStaticMember_, which should cover all the necessary tests.
image

group.Properties.Description = &model.Description
}

if model.MemberType != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since member_type has a default value, will it be an empty value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

}

if metadata.ResourceData.HasChange("member_type") {
if model.MemberType != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since member_type has a default value, will it be an empty value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@teowa
Copy link
Collaborator Author

teowa commented Nov 4, 2025

Hi @ms-zhenhua , Thank you for reviewing this. I've updated the code, could you please check it again? All tests pass except one, which is also failing on the main branch.
image

Copy link
Collaborator

@ms-zhenhua ms-zhenhua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM~

Copy link
Member

@catriona-m catriona-m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this @teowa, I left a couple of queries inline, but once those are addressed I can take another look. Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this file should be in here 🤔 does this pr need rebasing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebased

type ManagerNetworkGroupResource struct{}

func testAccNetworkManagerNetworkGroup_basic(t *testing.T) {
func TestAccNetworkManagerNetworkGroup_basic(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why these test should not be sequential anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, the at most 1 subscription only allowed a single network manager. Now, it supports multiple network managers with connection or routing types, but still limits to one securityAdmin network manager per subscription. This means we can now run tests with connection and routing network managers in parallel.

@teowa
Copy link
Collaborator Author

teowa commented Nov 9, 2025

Hi @catriona-m , thanks for reviewing this! Please take another look.

@teowa teowa requested a review from catriona-m November 20, 2025 06:19
Copy link
Member

@catriona-m catriona-m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @teowa LGTM!

@catriona-m catriona-m merged commit 241d5c1 into hashicorp:main Dec 5, 2025
35 checks passed
@github-actions github-actions bot added this to the v4.56.0 milestone Dec 5, 2025
catriona-m added a commit that referenced this pull request Dec 5, 2025
sreallymatt pushed a commit that referenced this pull request Dec 11, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Azure Virtual Network Manager Group with Subnet members

4 participants