Skip to content

Commit

Permalink
Merge pull request #2791 from Nmishin/fix/2790
Browse files Browse the repository at this point in the history
cloudflare_notification_policy: re-create manually deleted policy
  • Loading branch information
jacobbednarz authored Sep 24, 2023
2 parents de6d173 + 0c30f56 commit ab08ebd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/2791.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/cloudflare_notification_policy: handle manually deleted policies by removing them from state
```
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sdkv2provider

import (
"context"
"errors"
"fmt"
"strings"
"time"
Expand Down Expand Up @@ -56,6 +57,11 @@ func resourceCloudflareNotificationPolicyRead(ctx context.Context, d *schema.Res

name := d.Get("name").(string)
if err != nil {
var notFoundError *cloudflare.NotFoundError
if errors.As(err, &notFoundError) {
d.SetId("")
return nil
}
return diag.FromErr(fmt.Errorf("error retrieving notification policy %s: %w", name, err))
}

Expand Down

0 comments on commit ab08ebd

Please sign in to comment.