Skip to content

Commit

Permalink
resource/aws_db_event_subscription: Handle SubscriptionNotFound error…
Browse files Browse the repository at this point in the history
…s during Read and Deletion

Reference: #9368

Previously (in us-gov-west-1 and us-east-1):

```
--- FAIL: TestAccAWSDBEventSubscription_basicUpdate (1228.44s)
    testing.go:629: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: errors during apply: error waiting for RDS Event Subscription (tf-acc-test-rds-event-subs-2201031712637090321) deletion: SubscriptionNotFound: Event Subscription tf-acc-test-rds-event-subs-2201031712637090321 not found.
```

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSDBEventSubscription_withPrefix (535.76s)
--- PASS: TestAccAWSDBEventSubscription_importBasic (537.39s)
--- PASS: TestAccAWSDBEventSubscription_withSourceIds (539.77s)
--- PASS: TestAccAWSDBEventSubscription_disappears (543.52s)
--- PASS: TestAccAWSDBEventSubscription_categoryUpdate (944.42s)
--- PASS: TestAccAWSDBEventSubscription_basicUpdate (945.75s)
```

Output from acceptance testing in AWS GovCloud (US):

```
--- PASS: TestAccAWSDBEventSubscription_withPrefix (622.68s)
--- PASS: TestAccAWSDBEventSubscription_importBasic (623.98s)
--- PASS: TestAccAWSDBEventSubscription_withSourceIds (628.56s)
--- PASS: TestAccAWSDBEventSubscription_disappears (631.20s)
--- PASS: TestAccAWSDBEventSubscription_basicUpdate (978.81s)
--- PASS: TestAccAWSDBEventSubscription_categoryUpdate (978.91s)
```
  • Loading branch information
bflad committed Jul 16, 2019
1 parent f945137 commit 6977e9e
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 6977e9e

Please sign in to comment.