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,94 @@ projection_type = "ALL" } } + +resource "aws_dynamodb_table" "tunnelbroker-device-session-test" { + name = "tunnelbroker-device-session-test" + hash_key = "SessionId" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "SessionId" + type = "S" + } + + attribute { + name = "Expire" + type = "N" + } + + ttl { + attribute_name = "Expire" + enabled = true + } +} + +resource "aws_dynamodb_table" "tunnelbroker-verification-message-test" { + name = "tunnelbroker-verification-message-test" + hash_key = "DeviceId" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "DeviceId" + type = "S" + } + + attribute { + name = "Expire" + type = "N" + } + + ttl { + attribute_name = "Expire" + enabled = true + } +} + +resource "aws_dynamodb_table" "tunnelbroker-public-key-test" { + name = "tunnelbroker-public-key-test" + hash_key = "DeviceId" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "DeviceId" + type = "S" + } +} + +resource "aws_dynamodb_table" "tunnelbroker-message-test" { + name = "tunnelbroker-message-test" + hash_key = "MessageID" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "MessageID" + type = "S" + } + + attribute { + name = "ToDeviceID" + type = "S" + } + + attribute { + name = "Expire" + type = "N" + } + + 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,94 @@ projection_type = "ALL" } } + +resource "aws_dynamodb_table" "tunnelbroker-device-session" { + name = "tunnelbroker-device-session" + hash_key = "SessionId" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "SessionId" + type = "S" + } + + attribute { + name = "Expire" + type = "N" + } + + ttl { + attribute_name = "Expire" + enabled = true + } +} + +resource "aws_dynamodb_table" "tunnelbroker-verification-message" { + name = "tunnelbroker-verification-message" + hash_key = "DeviceId" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "DeviceId" + type = "S" + } + + attribute { + name = "Expire" + type = "N" + } + + ttl { + attribute_name = "Expire" + enabled = true + } +} + +resource "aws_dynamodb_table" "tunnelbroker-public-key" { + name = "tunnelbroker-public-key" + hash_key = "DeviceId" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "DeviceId" + type = "S" + } +} + +resource "aws_dynamodb_table" "tunnelbroker-message" { + name = "tunnelbroker-message" + hash_key = "MessageID" + write_capacity = 10 + read_capacity = 10 + + attribute { + name = "MessageID" + type = "S" + } + + attribute { + name = "ToDeviceID" + type = "S" + } + + attribute { + name = "Expire" + type = "N" + } + + global_secondary_index { + name = "ToDeviceID-index" + hash_key = "ToDeviceID" + write_capacity = 10 + read_capacity = 10 + projection_type = "ALL" + } + + ttl { + attribute_name = "Expire" + enabled = true + } +}