Skip to content

Commit

Permalink
azurerm_site_recovery_replicated_vm - remove `network_interface.is_…
Browse files Browse the repository at this point in the history
…primary` (#19997)
  • Loading branch information
ziyeqf authored Jan 17, 2023
1 parent 0857caa commit 5ecee83
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/validate"
Expand Down Expand Up @@ -213,7 +214,7 @@ func resourceSiteRecoveryReplicatedVM() *pluginsdk.Resource {
}

func networkInterfaceResource() *pluginsdk.Resource {
return &pluginsdk.Resource{
out := &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"source_network_interface_id": {
Type: pluginsdk.TypeString,
Expand All @@ -239,13 +240,18 @@ func networkInterfaceResource() *pluginsdk.Resource {
ForceNew: false,
ValidateFunc: azure.ValidateResourceID,
},
"is_primary": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: false,
},
},
}

if !features.FourPointOhBeta() {
out.Schema["is_primary"] = &pluginsdk.Schema{
Deprecated: "this property is not used and will be removed in version 4.0 of the provider",
Type: pluginsdk.TypeBool,
Optional: true,
Default: false,
}
}
return out
}

func diskEncryptionResource() *pluginsdk.Resource {
Expand Down Expand Up @@ -435,10 +441,6 @@ func resourceSiteRecoveryReplicatedItemUpdateInternal(ctx context.Context, d *pl
targetStaticIp := vmNicInput["target_static_ip"].(string)
targetSubnetName := vmNicInput["target_subnet_name"].(string)
recoveryPublicIPAddressID := vmNicInput["recovery_public_ip_address_id"].(string)
isPrimary := vmNicInput["is_primary"].(bool)
if len(nicList) == 1 {
isPrimary = true
}

nicId := findNicId(state, sourceNicId)
if nicId == nil {
Expand All @@ -449,7 +451,7 @@ func resourceSiteRecoveryReplicatedItemUpdateInternal(ctx context.Context, d *pl
RecoverySubnetName: &targetSubnetName,
RecoveryStaticIPAddress: &targetStaticIp,
RecoveryPublicIPAddressId: &recoveryPublicIPAddressID,
IsPrimary: &isPrimary,
IsPrimary: utils.Bool(true), // currently we can only set one IPconfig for a nic, so we dont need to expose this to users.
},
}
vmNics = append(vmNics, replicationprotecteditems.VMNicInputDetails{
Expand Down
2 changes: 0 additions & 2 deletions website/docs/r/site_recovery_replicated_vm.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,6 @@ A `network_interface` block supports the following:

* `recovery_public_ip_address_id` - (Optional) Id of the public IP object to use when a failover is done.

* `is_primary` - (Optional) If this is the primary network interface used for failover. If there is only one `network_interface` block, this is automatically set to `true`.

---

The `target_disk_encryption` block supports:
Expand Down

0 comments on commit 5ecee83

Please sign in to comment.