Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add global secondary index in dynamodb.tf #52

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions terraform/persistent/dynamodb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ variable "dynamodb" {
name = string
type = optional(string, "S")
}))
global_secondary_indexes = optional(map(object({
hash_key = object({
name = string
type = optional(string, "S")
})
range_key = optional(object({
name = string
type = optional(string, "S")
}))
projection_type = optional(string, "KEYS_ONLY")
non_key_attributes = optional(set(string))
provisioned_capacity = optional(object({
read = number
write = number
}))
})))
deletion_protection_enabled = optional(bool, true)
})
)
Expand All @@ -22,9 +38,10 @@ module "dynamodb" {
for_each = var.dynamodb
source = "git::https://github.com/skyleague/aws-dynamodb.git?ref=v3.0.0"

name = each.value.name
hash_key = each.value.hash_key
range_key = coalesce(each.value.range_key, null)
name = each.value.name
hash_key = each.value.hash_key
range_key = coalesce(each.value.range_key, null)
global_secondary_index = coalesce(each.value.global_secondary_index, null)

deletion_protection_enabled = each.value.deletion_protection_enabled
}
Expand Down