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

resource/aws_db_event_subscription: Handle SubscriptionNotFound errors during Read and Deletion #9371

Merged
merged 1 commit into from
Jul 18, 2019
Merged
Changes from all commits
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
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