I am unable to create local secondary index in terraform. getting below error.
error creating DynamoDB Table: ValidationException: One or more parameter values were invalid: ProjectionType is INCLUDE, but NonKeyAttributes is not specified
status code: 400, request id: 5CEKG1JU2HAQH51L0APBB8G0QFVV4KQNSO5AEMVJF66Q9ASUAAJG
Code is:
resource “aws_dynamodb_table” “GroupTable” {
name = “${var.dynamo_environment}-group-table”
billing_mode = “PAY_PER_REQUEST”
attribute {
name = "owner_instance_id"
type = "S"
}
attribute {
name = "id"
type = "S"
}
attribute {
name = "lower_group_name"
type = "S"
}
attribute {
name = "spec_hash"
type = "S"
}
hash_key = “owner_instance_id”
range_key = “id”
local_secondary_index {
name = "InstanceIdGroupNameIndex"
range_key = "lower_group_name"
projection_type = "INCLUDE"
non_key_attributes = ["id"]
}
local_secondary_index {
name = "InstanceIdSpecHashIndex"
range_key = "spec_hash"
projection_type = "INCLUDE"
non_key_attributes = ["id"]
}
point_in_time_recovery {
enabled = true
}
Can someone help?