Skip to content

Commit

Permalink
add GSI
Browse files Browse the repository at this point in the history
  • Loading branch information
amancevice committed Oct 5, 2024
1 parent 6c332b5 commit 59b184c
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions blue/shared/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,38 @@ resource "aws_dynamodb_table" "table" {
read_capacity = 0
write_capacity = 0

attribute {
name = "Id"
type = "S"
}

attribute {
name = "Kind"
type = "S"
}

ttl {
attribute_name = "TTL"
enabled = true
}

global_secondary_index {
name = "Kind"
hash_key = "Kind"
range_key = "Id"
projection_type = "ALL"
read_capacity = 0
write_capacity = 0
dynamic "attribute" {
for_each = {
Id = "S"
Kind = "S"
Name = "S"
}

content {
name = attribute.key
type = attribute.value
}
}

dynamic "global_secondary_index" {
for_each = {
Kind = "Id"
Name = "Id"
}

content {
name = global_secondary_index.key
hash_key = global_secondary_index.key
range_key = global_secondary_index.value
projection_type = "ALL"
read_capacity = 0
write_capacity = 0
}
}
}

Expand Down

0 comments on commit 59b184c

Please sign in to comment.