Fix createTable() with GlobalSecondaryIndexes #60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The plugin runs into errors when creating tables with GlobalSecondaryIndexes defined. This is because the AWS DynamoDB API describeTable() returns additional properties in the GSI ProvisionedThroughput object that are not expected when performing a createTable(). These extra properties are defined here https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ProvisionedThroughputDescription.html (eg. NumberOfDecreasesToday)
This fixes the issue noted in #18.
There is a conditional to add the ProvisionedThroughput property to the GSI because an empty object or undefined would throw and error since if this property exists then the API expects the Read/WriteCapacityUnits to be >=1 which doesn't handles cases where this property isn't used in a GSI and the Billing Mode is PAY_PER_REQUEST.