From bc9d3132bf6ace77b927a9536e1d1a25289d2df9 Mon Sep 17 00:00:00 2001 From: henglu Date: Tue, 22 Jun 2021 22:47:31 +0800 Subject: [PATCH] fix bug --- .../data_protection_backup_instance_postgresql_resource.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/azurerm/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource.go b/azurerm/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource.go index 4c5c5dec9e1d5..c380fe73793f5 100644 --- a/azurerm/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource.go +++ b/azurerm/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource.go @@ -6,7 +6,6 @@ import ( "log" "time" - "github.com/hashicorp/go-azure-helpers/response" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" @@ -200,9 +199,6 @@ func resourceDataProtectionBackupInstancePostgreSQLDelete(d *schema.ResourceData future, err := client.Delete(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) if err != nil { - if response.WasNotFound(future.Response()) { - return nil - } return fmt.Errorf("deleting DataProtection BackupInstance (%q): %+v", id, err) } @@ -218,6 +214,9 @@ func policyProtectionStateRefreshFunc(ctx context.Context, client *dataprotectio if err != nil { return nil, "", fmt.Errorf("retrieving DataProtection BackupInstance (%q): %+v", id, err) } + if res.Properties == nil || res.Properties.ProtectionStatus == nil { + return nil, "", fmt.Errorf("error reading DataProtection BackupInstance (%q) protection status: %+v", id, err) + } return res, string(res.Properties.ProtectionStatus.Status), nil }