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_dynamodb_table: Skip ResourceNotFoundException during deletion #11692

Merged
merged 1 commit into from
Feb 3, 2020

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Jan 21, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Release note for CHANGELOG:

* resource/aws_dynamodb_table: Skip `ResourceNotFoundException` error during deletion

Previously in the acceptance testing:

--- FAIL: TestAccAWSDynamoDbGlobalTable_multipleRegions (67.39s)
    testing.go:701: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: errors during apply: error deleting DynamoDB Table (tf-acc-test-tyuvv): Error deleting DynamoDB table: ResourceNotFoundException: Requested resource not found: Table: tf-acc-test-tyuvv not found

The prior code would wrap the awserr.Error in a fmt.Errorf() which meant the error was returned by value. The calling code already handles the error message context, so we remove the error wrapping so consumers can work with the AWS error type correctly. Another solution here would be instead using the Go 1.13 %w format verb, which will be part of a future linting check.

Output from acceptance testing:

--- PASS: TestAccAWSDynamoDbGlobalTable_basic (86.21s)
--- PASS: TestAccAWSDynamoDbGlobalTable_multipleRegions (106.17s)

--- PASS: TestAccAWSDynamoDbTable_attributeUpdate (463.78s)
--- PASS: TestAccAWSDynamoDbTable_attributeUpdateValidation (6.14s)
--- PASS: TestAccAWSDynamoDbTable_basic (27.57s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_GSI_PayPerRequestToProvisioned (57.72s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_GSI_ProvisionedToPayPerRequest (1149.43s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_PayPerRequestToProvisioned (45.62s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_ProvisionedToPayPerRequest (1325.53s)
--- PASS: TestAccAWSDynamoDbTable_disappears (19.40s)
--- PASS: TestAccAWSDynamoDbTable_disappears_PayPerRequestWithGSI (100.90s)
--- PASS: TestAccAWSDynamoDbTable_enablePitr (133.02s)
--- PASS: TestAccAWSDynamoDbTable_encryption (62.77s)
--- PASS: TestAccAWSDynamoDbTable_extended (195.41s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateCapacity (56.73s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateNonKeyAttributes (157.72s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateOtherAttributes (465.18s)
--- PASS: TestAccAWSDynamoDbTable_streamSpecification (67.08s)
--- PASS: TestAccAWSDynamoDbTable_streamSpecificationValidation (4.85s)
--- PASS: TestAccAWSDynamoDbTable_tags (36.51s)
--- PASS: TestAccAWSDynamoDbTable_Ttl_Disabled (41.27s)
--- PASS: TestAccAWSDynamoDbTable_Ttl_Enabled (29.97s)

…letion

Previously in the acceptance testing:

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

        Error: errors during apply: error deleting DynamoDB Table (tf-acc-test-tyuvv): Error deleting DynamoDB table: ResourceNotFoundException: Requested resource not found: Table: tf-acc-test-tyuvv not found
```

The prior code would wrap the `awserr.Error` in a `fmt.Errorf()` which meant the error was returned by value. The calling code already handles the error message context, so we remove the error wrapping so consumers can work with the AWS error type correctly. Another solution here would be instead using the Go 1.13 `%w` format verb, which will be part of a future linting check.

Output from acceptance testing:

```
--- PASS: TestAccAWSDynamoDbGlobalTable_basic (86.21s)
--- PASS: TestAccAWSDynamoDbGlobalTable_multipleRegions (106.17s)

--- PASS: TestAccAWSDynamoDbTable_attributeUpdate (463.78s)
--- PASS: TestAccAWSDynamoDbTable_attributeUpdateValidation (6.14s)
--- PASS: TestAccAWSDynamoDbTable_basic (27.57s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_GSI_PayPerRequestToProvisioned (57.72s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_GSI_ProvisionedToPayPerRequest (1149.43s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_PayPerRequestToProvisioned (45.62s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_ProvisionedToPayPerRequest (1325.53s)
--- PASS: TestAccAWSDynamoDbTable_disappears (19.40s)
--- PASS: TestAccAWSDynamoDbTable_disappears_PayPerRequestWithGSI (100.90s)
--- PASS: TestAccAWSDynamoDbTable_enablePitr (133.02s)
--- PASS: TestAccAWSDynamoDbTable_encryption (62.77s)
--- PASS: TestAccAWSDynamoDbTable_extended (195.41s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateCapacity (56.73s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateNonKeyAttributes (157.72s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateOtherAttributes (465.18s)
--- PASS: TestAccAWSDynamoDbTable_streamSpecification (67.08s)
--- PASS: TestAccAWSDynamoDbTable_streamSpecificationValidation (4.85s)
--- PASS: TestAccAWSDynamoDbTable_tags (36.51s)
--- PASS: TestAccAWSDynamoDbTable_Ttl_Disabled (41.27s)
--- PASS: TestAccAWSDynamoDbTable_Ttl_Enabled (29.97s)
```
@bflad bflad requested a review from a team January 21, 2020 18:11
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. service/dynamodb Issues and PRs that pertain to the dynamodb service. labels Jan 21, 2020
@bflad bflad added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 21, 2020
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@bflad bflad added this to the v2.48.0 milestone Feb 3, 2020
@bflad bflad merged commit 2b27d03 into master Feb 3, 2020
@bflad bflad deleted the td-aws_dynamodb_table-unwrap-deletion-awserr branch February 3, 2020 20:21
bflad added a commit that referenced this pull request Feb 3, 2020
@ghost
Copy link

ghost commented Feb 7, 2020

This has been released in version 2.48.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Mar 27, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/dynamodb Issues and PRs that pertain to the dynamodb service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants