All Attributes Must Be Indexed. Unused Attributes
In your case, just like the error message suggested, simply remove the unused attributes and problem should solved. Resource aws_dynamodb_table dynamodb_table { name = asset_db_tf hash_key = product read_capacity = 1 write_capacity = 1 server_side_encryption { enabled = true } attribute = { name = product type = s } } This error will occur when you have defined an array of attributes and have not used them in your partition or range key of your table or indexes. Here's how to resolve it. To solve the error, only define attributes that will be used in an index or in a table as a key schema attribute.
Const userstable = new table(stack, 'users', { fields: 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. I want to create a terraform configuration for dynamodb table with multiple (> 10) attributes. And i have no need to add all attributes as an index to global_secondary_index or local_secondary_index. But when i run terraform plan command i have next error: All attributes must be indexed. Learn how to leverage terraform to efficiently index all attributes in your dynamodb tables for optimal query performance. Dynamodb enforces a strict requirement that all attributes in a table must be part of either the primary key or a secondary index. Each declared attribute need an explicit index hence the error all attributes must be indexed.
Each declared attribute need an explicit index hence the error all attributes must be indexed.