You do not have to define every attribute you want to use up front when creating your table.
attribute
blocks inside aws_dynamodb_table
resources are not defining which attributes you can use in your application. They are defining the key schema for the table and indexes.
For example, the following Terraform defines a table with only a hash key:
resource "aws_dynamodb_table" "test" {
name = "test-table-name"
read_capacity = 10
write_capacity = 10
hash_key = "Attribute1"
attribute {
name = "Attribute1"
type = "S"
}
}
Every item in this table has Attribute1
, but you can create additional attributes with your application
This means that you can have your 10+ attributes as long as you don't need to define them in an AttributeDefinition
, and since you say you don't need them to be indexed, you'll be fine.
For some discussion of the confusion (attribute
is confusing and doesn't match the DynamoDB API), see this pull request.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…