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

Fixes bug #10773 #10795

Merged
merged 2 commits into from
Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -155,7 +155,7 @@ func dataSourceNetAppVolumeRead(d *schema.ResourceData, meta interface{}) error
return fmt.Errorf("setting `mount_ip_addresses`: %+v", err)
}

if props.DataProtection.Replication != nil {
if props.DataProtection != nil && props.DataProtection.Replication != nil {
paulomarquesc marked this conversation as resolved.
Show resolved Hide resolved
if err := d.Set("data_protection_replication", flattenNetAppVolumeDataProtectionReplication(props.DataProtection)); err != nil {
return fmt.Errorf("setting `data_protection_replication`: %+v", err)
}
Expand Down
8 changes: 6 additions & 2 deletions azurerm/internal/services/netapp/netapp_volume_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ 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 props.DataProtection != nil && props.DataProtection.Replication != nil {
if err := d.Set("data_protection_replication", flattenNetAppVolumeDataProtectionReplication(props.DataProtection)); err != nil {
paulomarquesc marked this conversation as resolved.
Show resolved Hide resolved
return fmt.Errorf("setting `data_protection_replication`: %+v", err)
}
Expand Down Expand Up @@ -789,7 +789,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{}{}
}

Expand Down