Skip to content

Commit

Permalink
resource/aws_dynamodb_table: Fix table creation in GovCloud (US) and …
Browse files Browse the repository at this point in the history
…China due to missing BillingMode support

Previous output from acceptance testing (AWS GovCloud (US), all aws_dynamodb_table tests):

```
--- FAIL: TestAccAWSDynamoDbTable_basic (0.39s)
    testing.go:538: Step 0 error: Error applying: 1 error occurred:
        	* aws_dynamodb_table.basic-dynamodb-table: 1 error occurred:
        	* aws_dynamodb_table.basic-dynamodb-table: ValidationException: One or more parameter values were invalid: Unsupported input parameter BillingMode
```

Output from acceptance testing (AWS GovCloud (US), no new failures from pre-BillingMode):

```
--- PASS: TestAccAWSDynamoDbTable_streamSpecificationValidation (3.64s)
--- PASS: TestAccAWSDynamoDbTable_attributeUpdateValidation (5.13s)
--- FAIL: TestAccAWSDynamoDbTable_encryption (5.43s)
    testing.go:538: Step 0 error: Error applying: 1 error occurred:
        	* aws_dynamodb_table.basic-dynamodb-table: 1 error occurred:
        	* aws_dynamodb_table.basic-dynamodb-table: error creating DynamoDB Table: ValidationException: One or more parameter values were invalid: Unsupported input parameter SSESpecification
        	status code: 400, request id: F6OSK8MN7T1JOG2S5E30GSHN4VVV4KQNSO5AEMVJF66Q9ASUAAJG

--- PASS: TestAccAWSDynamoDbTable_basic (25.22s)
--- PASS: TestAccAWSDynamoDbTable_streamSpecification (41.12s)
--- PASS: TestAccAWSDynamoDbTable_importTags (47.65s)
--- PASS: TestAccAWSDynamoDbTable_ttl (56.96s)
--- FAIL: TestAccAWSDynamoDbTable_enablePitr (61.74s)
    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: UnknownOperationException: Unknown operation exception
        	status code: 400, request id: 0DN6K5DCG70T8SFDVEH7B0GJ9BVV4KQNSO5AEMVJF66Q9ASUAAJG

--- PASS: TestAccAWSDynamoDbTable_tags (72.81s)
--- PASS: TestAccAWSDynamoDbTable_importBasic (74.31s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateCapacity (105.10s)
--- PASS: TestAccAWSDynamoDbTable_importTimeToLive (106.13s)
--- FAIL: TestAccAWSDynamoDbTable_BillingMode (116.25s)
    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 creating DynamoDB Table: ValidationException: One or more parameter values were invalid: Missing required parameter in input: "ProvisionedThroughput"
        	status code: 400, request id: 2BEOP0E6AD39707F43EEMDED1FVV4KQNSO5AEMVJF66Q9ASUAAJG

--- PASS: TestAccAWSDynamoDbTable_gsiUpdateNonKeyAttributes (289.91s)
--- PASS: TestAccAWSDynamoDbTable_extended (292.16s)
--- PASS: TestAccAWSDynamoDbTable_attributeUpdate (586.40s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateOtherAttributes (589.72s)
```
  • Loading branch information
bflad committed Jan 8, 2019
1 parent b38299d commit 5e5762c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion aws/resource_aws_dynamodb_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,19 @@ func resourceAwsDynamoDbTableCreate(d *schema.ResourceData, meta interface{}) er
if isAWSErr(err, dynamodb.ErrCodeLimitExceededException, "indexed tables that can be created simultaneously") {
return resource.RetryableError(err)
}
// AWS GovCloud (US) and others may reply with the following until their API is updated:
// ValidationException: One or more parameter values were invalid: Unsupported input parameter BillingMode
if isAWSErr(err, "ValidationException", "Unsupported input parameter BillingMode") {
req.BillingMode = nil
return resource.RetryableError(err)
}

return resource.NonRetryableError(err)
}
return nil
})
if err != nil {
return err
return fmt.Errorf("error creating DynamoDB Table: %s", err)
}

d.SetId(*output.TableDescription.TableName)
Expand Down

0 comments on commit 5e5762c

Please sign in to comment.