Skip to content

Conversation

ziyeqf
Copy link
Collaborator

@ziyeqf ziyeqf commented Sep 5, 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

As the IP configuration for a nic could be a list, we only supported one before. There is a issue with high thumbs up asking for supporting for secondary ip configuration. To support it, invovled a new block network_interface.ip_configuration and deprecate the old ones.

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

These failed ones are also failing on main branch, shall be not related to this PR.

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 #28773

Note

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

@ziyeqf
Copy link
Collaborator Author

ziyeqf commented Sep 8, 2025

convert to draft since working on tests

Copy link
Collaborator

@sreallymatt sreallymatt left a comment

Choose a reason for hiding this comment

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

Thanks @ziyeqf, I've left a couple comments inline

@@ -294,18 +295,20 @@ func resourceSiteRecoveryReplicatedVM() *pluginsdk.Resource {
},

"network_interface": {
Type: pluginsdk.TypeSet, // use set to avoid diff caused by different orders.
Type: pluginsdk.TypeList,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we changing this?

ValidateFunc: azure.ValidateResourceID,
},

"is_primary": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you rename this to primary? Following our documented naming conventions of avoiding redundant verbs (ref)

Suggested change
"is_primary": {
"primary": {


"recovery_public_ip_address_id": {
if !features.FivePointOh() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you also add ConflictsWith to ensure users don't use the deprecated args in combination with the new ip_configuration block?

nicSchema.Schema["ip_configuration"].Computed = true

nicSchema.Schema["failover_test_static_ip"] = &pluginsdk.Schema{
Deprecated: "this property has been deprecated in favour of `network_interface.ip_configuration`",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you update each of these deprecation messages to point to the exact replacement property, and to include that they will be removed in 5.0?

Suggested change
Deprecated: "this property has been deprecated in favour of `network_interface.ip_configuration`",
Deprecated: "this property has been deprecated in favour of `network_interface.ip_configuration.failover_test_static_ip` and will be removed in v5.0 of the AzureRM provider",

Comment on lines +405 to +413
nicSchema.Schema["failover_test_subnet_name"] = &pluginsdk.Schema{
Deprecated: "this property has been deprecated in favour of `network_interface.ip_configuration`",
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringIsNotEmpty,
}

nicSchema.Schema["failover_test_subnet_name"] = &pluginsdk.Schema{
Copy link
Collaborator

Choose a reason for hiding this comment

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

These appear to be duplicates

### `azurerm_site_recovery_replicated_vm`

* The property `network_interface.target_static_ip` has been removed in favour of the `network_interface.ip_configuration.target_statc_ip` property.
* The property `network_interface.target_subnet_name` has been removed in favour of the `network_interface.ip_configuration.target_static_ip` property.
Copy link
Collaborator

Choose a reason for hiding this comment

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

mismatched props

Suggested change
* The property `network_interface.target_subnet_name` has been removed in favour of the `network_interface.ip_configuration.target_static_ip` property.
* The property `network_interface.target_subnet_name` has been removed in favour of the `network_interface.ip_configuration.target_subnet_name` property.

* The property `network_interface.recovery_load_balancer_backend_address_pool_ids` has been removed in favour of the `network_interface.ip_configuration.recovery_load_balancer_backend_address_pool_ids` property.
* The property `network_interface.recovery_public_ip_address_id` has been removed in favour of the `network_interface.ip_configuration.recovery_public_ip_address_id` property.
* The property `network_interface.ip_configuration.name` is a new required property, it must be as same as the name of the ip configuration of network interface from the source VM.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is missing some of the deprecated items

@@ -306,6 +307,16 @@ A `network_interface` block supports the following:

* `source_network_interface_id` - (Optional) (Required if the network_interface block is specified) Id source network interface.

* `ip_configuration` - (Optional) IP configuration to assign when a failover is done. One or more `ip_configuration` block as defined below.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* `ip_configuration` - (Optional) IP configuration to assign when a failover is done. One or more `ip_configuration` block as defined below.
* `ip_configuration` - (Optional) IP configuration to assign when a failover is done. One or more `ip_configuration` blocks as defined below.


The `ip_configuration` block supports the following:

* `name` - (Required) Name of the IP configuration, must be consistent with the name of IP configuration of source VM.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit

Suggested change
* `name` - (Required) Name of the IP configuration, must be consistent with the name of IP configuration of source VM.
* `name` - (Required) Name of the IP configuration, must be consistent with the name of the IP configuration of the source virtual machine.


* `name` - (Required) Name of the IP configuration, must be consistent with the name of IP configuration of source VM.

* `is_primary` - (Optional) Whether this IP configuration is primary? Must be specified if there is more than 1 `ip_configuration`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Previously isPrimary was hardcoded to true since only 1 IP config could could be specified, what's the behaviour if only 1 ip_configuration block is specified without setting is_primary = true?

I noticed in the tests that all of them have marked at least 1 ip_configuration block with is_primary = true but since it's optional we should confirm whether omitting it entirely is possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

azurerm_site_recovery_replicated_vm second IP configuration for Nic
2 participants