Closed nick-zh closed 2 years ago
Files identified in the description:
plugins/modules/dynamodb_table.py
](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/plugins/modules/dynamodb_table.py)If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
cc @jillr @loia @markuman @s-hertel @tremble click here for bot help
I have the same issue with Ansible 5.8.0
, ansible-core 2.12.5
, collection community.aws 2.4
and Python 3.8.10
@Sonic0 Is there any chance you could create your intended DynamoDB table and provide the output of aws dynamodb describe-table --table-name <table_name>
I'm not particularly familiar with DynamoDB, but might be able to fix the issue if you're able to describe the end state.
@tremble i have done that on an example table (removed region and arn), i hope this is what you were looking for
{
"Table": {
"AttributeDefinitions": [
{
"AttributeName": "ProfileId",
"AttributeType": "S"
},
{
"AttributeName": "UserId",
"AttributeType": "S"
}
],
"TableName": "TestTable",
"KeySchema": [
{
"AttributeName": "UserId",
"KeyType": "HASH"
},
{
"AttributeName": "ProfileId",
"KeyType": "RANGE"
}
],
"TableStatus": "ACTIVE",
"CreationDateTime": "2022-05-25T16:40:34.413000+02:00",
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
},
"TableSizeBytes": 0,
"ItemCount": 0,
"TableArn": "arn:aws:dynamodb:<redacted>:<redacted>:table/TestTable",
"TableId": "<redacted>",
"GlobalSecondaryIndexes": [
{
"IndexName": "ProfileId-index",
"KeySchema": [
{
"AttributeName": "ProfileId",
"KeyType": "HASH"
}
],
"Projection": {
"ProjectionType": "KEYS_ONLY"
},
"IndexStatus": "CREATING",
"Backfilling": true,
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
},
"IndexSizeBytes": 0,
"ItemCount": 0,
"IndexArn": "arn:aws:dynamodb:<redacted>:<redacted>:table/TestTable/index/ProfileId-index"
}
]
}
}
@nick-zh Yup, that's what I needed.
Here are what the other index types look like, maybe that's helpful as well:
{
"Table": {
"AttributeDefinitions": [
{
"AttributeName": "ProfileId",
"AttributeType": "S"
},
{
"AttributeName": "UserId",
"AttributeType": "S"
}
],
"TableName": "TestTable",
"KeySchema": [
{
"AttributeName": "UserId",
"KeyType": "HASH"
},
{
"AttributeName": "ProfileId",
"KeyType": "RANGE"
}
],
"TableStatus": "ACTIVE",
"CreationDateTime": "2022-05-25T16:40:34.413000+02:00",
"ProvisionedThroughput": {
"LastDecreaseDateTime": "2022-05-25T16:53:38.830000+02:00",
"NumberOfDecreasesToday": 2,
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
},
"TableSizeBytes": 0,
"ItemCount": 0,
"TableArn": "arn:aws:dynamodb:<redacted>:<redacted>:table/TestTable",
"TableId": "<redacted>",
"GlobalSecondaryIndexes": [
{
"IndexName": "ProfileId-index",
"KeySchema": [
{
"AttributeName": "ProfileId",
"KeyType": "HASH"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"IndexStatus": "ACTIVE",
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
},
"IndexSizeBytes": 0,
"ItemCount": 0,
"IndexArn": "arn:aws:dynamodb:<redacted>:<redacted>:table/TestTable/index/ProfileId-index"
},
{
"IndexName": "ProfileId-index2",
"KeySchema": [
{
"AttributeName": "ProfileId",
"KeyType": "HASH"
}
],
"Projection": {
"ProjectionType": "INCLUDE",
"NonKeyAttributes": [
"UserId"
]
},
"IndexStatus": "ACTIVE",
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
},
"IndexSizeBytes": 0,
"ItemCount": 0,
"IndexArn": "arn:aws:dynamodb:<redacted>:<redacted>:table/TestTable/index/ProfileId-index2"
}
]
}
}
@nick-zh Any chance you could try #1162 ?
I was not sure what's the best way to do this, but i adjusted the fix of plugins/modules/dynamodb_table.py
to my local collection and i was able to successfully create a table with global_keys_only
:tada:
Many thanks @tremble :pray: (as always)
I applied the fix to the file plugins/modules/dynamodb_table.py
in my local collection and now it is working!!!
Many thanks @tremble! :partying_face: :partying_face:
Summary
I get an error when i create a GSI for dynamodb with
global_keys_only
From what i understand i don't need to include any attributes, but somehow creation gives an errorIssue Type
Bug Report
Component Name
dynamodb_table
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
No response
Steps to Reproduce
Expected Results
Table is created and i only need to add to add the non key attributes if use the modes
global_include
andinclude
as stated hereActual Results
Code of Conduct