diff --git a/azurerm/internal/services/netapp/netapp_volume_data_source.go b/azurerm/internal/services/netapp/netapp_volume_data_source.go index 868231058ca5..0ba4bbc9b07f 100644 --- a/azurerm/internal/services/netapp/netapp_volume_data_source.go +++ b/azurerm/internal/services/netapp/netapp_volume_data_source.go @@ -154,11 +154,8 @@ func dataSourceNetAppVolumeRead(d *schema.ResourceData, meta interface{}) error if err := d.Set("mount_ip_addresses", flattenNetAppVolumeMountIPAddresses(props.MountTargets)); err != nil { return fmt.Errorf("setting `mount_ip_addresses`: %+v", err) } - - if props.DataProtection.Replication != nil { - if err := d.Set("data_protection_replication", flattenNetAppVolumeDataProtectionReplication(props.DataProtection)); err != nil { - return fmt.Errorf("setting `data_protection_replication`: %+v", err) - } + if err := d.Set("data_protection_replication", flattenNetAppVolumeDataProtectionReplication(props.DataProtection)); err != nil { + return fmt.Errorf("setting `data_protection_replication`: %+v", err) } } diff --git a/azurerm/internal/services/netapp/netapp_volume_resource.go b/azurerm/internal/services/netapp/netapp_volume_resource.go index 19a9ae8ffc99..5dcd742f11c2 100644 --- a/azurerm/internal/services/netapp/netapp_volume_resource.go +++ b/azurerm/internal/services/netapp/netapp_volume_resource.go @@ -390,10 +390,8 @@ func resourceNetAppVolumeRead(d *schema.ResourceData, meta interface{}) error { if err := d.Set("mount_ip_addresses", flattenNetAppVolumeMountIPAddresses(props.MountTargets)); err != nil { return fmt.Errorf("setting `mount_ip_addresses`: %+v", err) } - if props.DataProtection.Replication != nil { - if err := d.Set("data_protection_replication", flattenNetAppVolumeDataProtectionReplication(props.DataProtection)); err != nil { - return fmt.Errorf("setting `data_protection_replication`: %+v", err) - } + if err := d.Set("data_protection_replication", flattenNetAppVolumeDataProtectionReplication(props.DataProtection)); err != nil { + return fmt.Errorf("setting `data_protection_replication`: %+v", err) } } @@ -789,7 +787,11 @@ func flattenNetAppVolumeMountIPAddresses(input *[]netapp.MountTargetProperties) } func flattenNetAppVolumeDataProtectionReplication(input *netapp.VolumePropertiesDataProtection) []interface{} { - if input == nil || input.Replication == nil || strings.ToLower(string(input.Replication.EndpointType)) != "dst" { + if input == nil || input.Replication == nil { + return []interface{}{} + } + + if strings.ToLower(string(input.Replication.EndpointType)) == "" || strings.ToLower(string(input.Replication.EndpointType)) != "dst" { return []interface{}{} }