diff --git a/services/terraform/.terraform.lock.hcl b/services/terraform/.terraform.lock.hcl --- a/services/terraform/.terraform.lock.hcl +++ b/services/terraform/.terraform.lock.hcl @@ -6,6 +6,7 @@ constraints = "~> 4.9.0" hashes = [ "h1:OWIIlbMZl/iQ8qR1U7Co3sGjNHL1HJtgNRnnV1kXNuI=", + "h1:gx4ni9ZxacUusjZdfLmRVgoMVn1o3CVo0xklOQA2zA8=", "zh:084b83aef3335ad4f5e4b8323c6fe43c1ff55e17a7647c6a5cad6af519f72b42", "zh:132e47ce69f14de4523b84b213cedf7173398acda14245b1ffe7747aac50f050", "zh:2068baef7dfce3613f3b4f27314175e971f8db68d9cde9ec30b5659f80c68c6c", diff --git a/services/terraform/dynamodb-test.tf b/services/terraform/dynamodb-test.tf --- a/services/terraform/dynamodb-test.tf +++ b/services/terraform/dynamodb-test.tf @@ -85,3 +85,79 @@ projection_type = "ALL" } } + +resource "aws_dynamodb_table" "tunnelbroker-device-sessions-test" { + name = "tunnelbroker-device-sessions-test" + hash_key = "SessionId" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "SessionId" + type = "S" + } + + ttl { + attribute_name = "Expire" + enabled = true + } +} + +resource "aws_dynamodb_table" "tunnelbroker-verification-messages-test" { + name = "tunnelbroker-verification-messages-test" + hash_key = "DeviceId" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "DeviceId" + type = "S" + } + + ttl { + attribute_name = "Expire" + enabled = true + } +} + +resource "aws_dynamodb_table" "tunnelbroker-public-keys-test" { + name = "tunnelbroker-public-keys-test" + hash_key = "DeviceId" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "DeviceId" + type = "S" + } +} + +resource "aws_dynamodb_table" "tunnelbroker-messages-test" { + name = "tunnelbroker-messages-test" + hash_key = "MessageID" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "MessageID" + type = "S" + } + + attribute { + name = "ToDeviceID" + type = "S" + } + + global_secondary_index { + name = "ToDeviceID-index" + hash_key = "ToDeviceID" + write_capacity = 10 + read_capacity = 10 + projection_type = "ALL" + } + + ttl { + attribute_name = "Expire" + enabled = true + } +} diff --git a/services/terraform/dynamodb.tf b/services/terraform/dynamodb.tf --- a/services/terraform/dynamodb.tf +++ b/services/terraform/dynamodb.tf @@ -85,3 +85,79 @@ projection_type = "ALL" } } + +resource "aws_dynamodb_table" "tunnelbroker-device-sessions" { + name = "tunnelbroker-device-sessions" + hash_key = "SessionId" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "SessionId" + type = "S" + } + + ttl { + attribute_name = "Expire" + enabled = true + } +} + +resource "aws_dynamodb_table" "tunnelbroker-verification-messages" { + name = "tunnelbroker-verification-messages" + hash_key = "DeviceId" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "DeviceId" + type = "S" + } + + ttl { + attribute_name = "Expire" + enabled = true + } +} + +resource "aws_dynamodb_table" "tunnelbroker-public-keys" { + name = "tunnelbroker-public-keys" + hash_key = "DeviceId" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "DeviceId" + type = "S" + } +} + +resource "aws_dynamodb_table" "tunnelbroker-messages" { + name = "tunnelbroker-messages" + hash_key = "MessageID" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "MessageID" + type = "S" + } + + attribute { + name = "ToDeviceID" + type = "S" + } + + global_secondary_index { + name = "ToDeviceID-index" + hash_key = "ToDeviceID" + write_capacity = 10 + read_capacity = 10 + projection_type = "ALL" + } + + ttl { + attribute_name = "Expire" + enabled = true + } +}