Skip to content

Commit

Permalink
Merge pull request #9371 from terraform-providers/b-aws_db_event_subs…
Browse files Browse the repository at this point in the history
…cription-SubscriptionNotFound

resource/aws_db_event_subscription: Handle SubscriptionNotFound errors during Read and Deletion
  • Loading branch information
bflad authored Jul 18, 2019
2 parents 4b33b04 + 6977e9e commit 0959f39
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions aws/resource_aws_db_event_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ func resourceAwsDbEventSubscriptionRead(d *schema.ResourceData, meta interface{}

sub, err := resourceAwsDbEventSubscriptionRetrieve(d.Id(), conn)

if isAWSErr(err, rds.ErrCodeSubscriptionNotFoundFault, "") {
log.Printf("[WARN] RDS Event Subscription (%s) not found - removing from state", d.Id())
d.SetId("")
return nil
}

if err != nil {
return fmt.Errorf("error retrieving RDS Event Subscription (%s): %s", d.Id(), err)
}
Expand Down Expand Up @@ -386,6 +392,10 @@ func resourceAwsDbEventSubscriptionRefreshFunc(name string, conn *rds.RDS) resou
return func() (interface{}, string, error) {
sub, err := resourceAwsDbEventSubscriptionRetrieve(name, conn)

if isAWSErr(err, rds.ErrCodeSubscriptionNotFoundFault, "") {
return nil, "", nil
}

if err != nil {
return nil, "", err
}
Expand Down

0 comments on commit 0959f39

Please sign in to comment.