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

azurerm_site_recovery_replicated_vm - remove network_interface.is_primary #19997

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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