getmoto / moto

A library that allows you to easily mock out tests based on AWS infrastructure.
http://docs.getmoto.org/en/latest/
Apache License 2.0
7.58k stars 2.02k forks source link

Dynamo DB - Cannot use ARN in place of TableName across multiple methods #7843

Closed ncilfone closed 1 month ago

ncilfone commented 1 month ago

For instance, from the boto3 docs:

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/describe_table.html

Parameters:

TableName (string) –

[REQUIRED]

The name of the table to describe. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.

If you look at the moto implementation of describe_table you can see that only the table name can be used and not the ARN since self.table[name] is only in reference to the table name :

https://github.com/getmoto/moto/blob/1c8c0fe4d9c7f5481a40814a8a6459a5142707ff/moto/dynamodb/models/__init__.py#L165-L169

alexevansigg commented 1 month ago

I have the same issue using DynamoDB Resource and batch_get_item metthod... here in the requestItems argument the map keys are the ARN or Table Name.... when I use the ARN it doesn't mock correctly. (see doc)

bblommers commented 1 month ago

Hi @alexevansigg and @ncilfone, thanks for raising this! The attached PR fixes this, so ARN's are now allowed for all methods that take a TableName-parameter.