Skip to content

Commit

Permalink
Fix issue when creating GSI with global_keys_only (ansible-collection…
Browse files Browse the repository at this point in the history
…s#1162)

Fix issue when creating GSI with global_keys_only

SUMMARY
fixes: ansible-collections#967
Undocumented requirement on NonKeyAttributes that it should be omitted rather than an empty list.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
dynamodb_table
ADDITIONAL INFORMATION
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Invalid length for parameter GlobalSecondaryIndexUpdates[0].Create.Projection.NonKeyAttributes, value: 0, valid min length: 1
fatal: [localhost]: FAILED! => {"boto3_version": "1.18.47", "botocore_version": "1.21.47", "changed": false, "msg": "Failed to update table: Parameter validation failed:\nInvalid length for parameter GlobalSecondaryIndexUpdates[0].Create.Projection.NonKeyAttributes, value: 0, valid min length: 1"}

Reviewed-by: Markus Bergholz <[email protected]>
  • Loading branch information
tremble authored May 26, 2022
1 parent 935f392 commit 370d4fe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dynamodb_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,8 @@ def _generate_index(index, include_throughput=True):
ProjectionType=index['type'],
)
if index['type'] != 'ALL':
projection['NonKeyAttributes'] = non_key_attributes
if non_key_attributes:
projection['NonKeyAttributes'] = non_key_attributes
else:
if non_key_attributes:
module.fail_json(
Expand Down

0 comments on commit 370d4fe

Please sign in to comment.