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: Improve update handling #7453

Merged
merged 1 commit into from
Feb 11, 2019

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Feb 5, 2019

Fixes #5471
Fixes #7447

Changes:

  • tests/resource/aws_dynamodb_table: Ensure acceptance testing covers all scenarios involving billing_mode updates with and without global secondary indexes
  • tests/resource/aws_dynamodb_table: Update testAccCheckDynamoDbTableHasBilling_Provisioned to handle missing BillingModeSummary
  • resource/aws_dynamodb_table: Consolidate UpdateTable calls to prevent error when switching billing_mode from PAY_PER_REQUEST to PROVISIONED when global secondary indexes are present and reduce API traffic
  • resource/aws_dynamodb_table: Utilize customizable update timeout in global secondary index update operations
  • resource/aws_dynamodb_table: Increase default update timeout from 10 minutes to 60 minutes since even 30 minutes can trigger timeouts with no table data

Previous output from acceptance testing:

--- FAIL: TestAccAWSDynamoDbTable_BillingMode_GSI_PayPerRequestToProvisioned (142.20s)
    testing.go:538: Step 1 error: Error applying: 1 error occurred:
        	* aws_dynamodb_table.basic-dynamodb-table: 1 error occurred:
        	* aws_dynamodb_table.basic-dynamodb-table: Error updating DynamoDB Table (TerraformTestTable--132444596974972667) billing mode: ValidationException: One or more parameter values were invalid: ProvisionedThroughput must be specified for index: TestTableGSI

Output from acceptance testing:

--- PASS: TestAccAWSDynamoDbTable_attributeUpdate (441.98s)
--- PASS: TestAccAWSDynamoDbTable_attributeUpdateValidation (3.00s)
--- PASS: TestAccAWSDynamoDbTable_basic (108.09s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_GSI_PayPerRequestToProvisioned (158.73s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_GSI_ProvisionedToPayPerRequest (1027.81s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_PayPerRequestToProvisioned (127.56s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_ProvisionedToPayPerRequest (917.15s)
--- PASS: TestAccAWSDynamoDbTable_disappears (17.37s)
--- PASS: TestAccAWSDynamoDbTable_disappears_PayPerRequestWithGSI (181.60s)
--- PASS: TestAccAWSDynamoDbTable_enablePitr (286.99s)
--- PASS: TestAccAWSDynamoDbTable_encryption (222.91s)
--- PASS: TestAccAWSDynamoDbTable_extended (286.03s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateCapacity (178.27s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateNonKeyAttributes (416.57s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateOtherAttributes (661.25s)
--- PASS: TestAccAWSDynamoDbTable_importBasic (137.95s)
--- PASS: TestAccAWSDynamoDbTable_importTags (170.40s)
--- PASS: TestAccAWSDynamoDbTable_importTimeToLive (138.59s)
--- PASS: TestAccAWSDynamoDbTable_streamSpecification (127.55s)
--- PASS: TestAccAWSDynamoDbTable_streamSpecificationValidation (1.05s)
--- PASS: TestAccAWSDynamoDbTable_tags (144.68s)
--- PASS: TestAccAWSDynamoDbTable_ttl (139.86s)

@bflad bflad added bug Addresses a defect in current functionality. service/dynamodb Issues and PRs that pertain to the dynamodb service. labels Feb 5, 2019
@bflad bflad requested a review from a team February 5, 2019 20:13
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. labels Feb 5, 2019
References:

* #7447
* #5471

Changes:

* tests/resource/aws_dynamodb_table: Ensure acceptance testing covers all scenarios involving billing_mode updates with and without global secondary indexes
* tests/resource/aws_dynamodb_table: Update testAccCheckDynamoDbTableHasBilling_Provisioned to handle missing BillingModeSummary
* resource/aws_dynamodb_table: Consolidate UpdateTable calls to prevent error when switching billing_mode from PAY_PER_REQUEST to PROVISIONED when global secondary indexes are present and reduce API traffic
* resource/aws_dynamodb_table: Utilize customizable update timeout in global secondary index update operations
* resource/aws_dynamodb_table: Increase default update timeout from 10 minutes to 60 minutes since even 30 minutes can trigger timeouts with no table data

Previous output from acceptance testing:

```
--- FAIL: TestAccAWSDynamoDbTable_BillingMode_GSI_PayPerRequestToProvisioned (142.20s)
    testing.go:538: Step 1 error: Error applying: 1 error occurred:
        	* aws_dynamodb_table.basic-dynamodb-table: 1 error occurred:
        	* aws_dynamodb_table.basic-dynamodb-table: Error updating DynamoDB Table (TerraformTestTable--132444596974972667) billing mode: ValidationException: One or more parameter values were invalid: ProvisionedThroughput must be specified for index: TestTableGSI
```

Output from acceptance testing:

```
--- PASS: TestAccAWSDynamoDbTable_attributeUpdate (441.98s)
--- PASS: TestAccAWSDynamoDbTable_attributeUpdateValidation (3.00s)
--- PASS: TestAccAWSDynamoDbTable_basic (108.09s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_GSI_PayPerRequestToProvisioned (158.73s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_GSI_ProvisionedToPayPerRequest (1027.81s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_PayPerRequestToProvisioned (127.56s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_ProvisionedToPayPerRequest (917.15s)
--- PASS: TestAccAWSDynamoDbTable_disappears (17.37s)
--- PASS: TestAccAWSDynamoDbTable_disappears_PayPerRequestWithGSI (181.60s)
--- PASS: TestAccAWSDynamoDbTable_enablePitr (286.99s)
--- PASS: TestAccAWSDynamoDbTable_encryption (222.91s)
--- PASS: TestAccAWSDynamoDbTable_extended (286.03s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateCapacity (178.27s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateNonKeyAttributes (416.57s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateOtherAttributes (661.25s)
--- PASS: TestAccAWSDynamoDbTable_importBasic (137.95s)
--- PASS: TestAccAWSDynamoDbTable_importTags (170.40s)
--- PASS: TestAccAWSDynamoDbTable_importTimeToLive (138.59s)
--- PASS: TestAccAWSDynamoDbTable_streamSpecification (127.55s)
--- PASS: TestAccAWSDynamoDbTable_streamSpecificationValidation (1.05s)
--- PASS: TestAccAWSDynamoDbTable_tags (144.68s)
--- PASS: TestAccAWSDynamoDbTable_ttl (139.86s)
```
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

Nicely Done 👍 I verified that the issues called out in the description have been resolved and/or addressed.

There is a slight white space issue in one of the existing test configs but this is otherwise good to go.

@bflad
Copy link
Contributor Author

bflad commented Feb 11, 2019

There is a slight white space issue in one of the existing test configs but this is otherwise good to go.

Great catch. I'll update that right now. We can discuss out of band some tooling we have been playing with to automatically fix/catch these for pull requests.

@bflad bflad added this to the v1.59.0 milestone Feb 11, 2019
@bflad bflad merged commit 4431e3d into master Feb 11, 2019
@bflad bflad deleted the b-aws_dynamodb_table-billing_mode-gsi branch February 11, 2019 15:24
bflad added a commit that referenced this pull request Feb 11, 2019
@bflad
Copy link
Contributor Author

bflad commented Feb 14, 2019

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

@ghost
Copy link

ghost commented Mar 31, 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 31, 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. documentation Introduces or discusses updates to documentation. service/dynamodb Issues and PRs that pertain to the dynamodb service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
2 participants