From ed22f49bb9a3f8d1ea9d9dfba6461ba6f4f403fd Mon Sep 17 00:00:00 2001 From: Michael Disaro <15191694+michaeldisaro@users.noreply.github.com> Date: Thu, 4 Apr 2024 14:54:40 +0200 Subject: [PATCH] added new sharded collection for reminder (#939) --- src/domains/messages-common/03_database.tf | 67 ++++++++++++++++++++++ src/domains/messages-common/README.md | 1 + 2 files changed, 68 insertions(+) diff --git a/src/domains/messages-common/03_database.tf b/src/domains/messages-common/03_database.tf index 461b6ae19..73338d7bb 100644 --- a/src/domains/messages-common/03_database.tf +++ b/src/domains/messages-common/03_database.tf @@ -132,6 +132,73 @@ module "mongdb_collection_reminder" { ] } +module "mongdb_collection_reminder_sharded" { + source = "git::https://github.com/pagopa/terraform-azurerm-v3//cosmosdb_mongodb_collection?ref=v7.69.1" + + name = "reminder-sharded" + resource_group_name = azurerm_resource_group.data_rg.name + + cosmosdb_mongo_account_name = module.cosmosdb_account_mongodb_reminder.name + cosmosdb_mongo_database_name = azurerm_cosmosdb_mongo_database.db_reminder.name + + shard_key = "shard" + + indexes = [ + { + keys = ["_id"] + unique = true + }, + { + keys = ["rptId"] + unique = false + }, + { + keys = ["shard"] + unique = false + }, + { + keys = ["readFlag"] + unique = false + }, + { + keys = ["paidFlag"] + unique = false + }, + { + keys = ["content_type"] + unique = false + }, + { + keys = ["maxReadMessageSend"] + unique = false + }, + { + keys = ["maxPaidMessageSend"] + unique = false + }, + { + keys = ["lastDateReminder"] + unique = false + }, + { + keys = ["dueDate"] + unique = false + }, + { + keys = ["insertionDate"] + unique = false + }, + { + keys = ["content_paymentData_noticeNumber", "content_paymentData_payeeFiscalCode"] + unique = false + }, + { + keys = ["content_paymentData_dueDate"] + unique = false + }, + ] +} + #tfsec:ignore:AZU023 resource "azurerm_key_vault_secret" "mongodb_connection_string_reminder" { name = "${module.cosmosdb_account_mongodb_reminder.name}-connection-string" diff --git a/src/domains/messages-common/README.md b/src/domains/messages-common/README.md index dcc484b57..05aa485bb 100644 --- a/src/domains/messages-common/README.md +++ b/src/domains/messages-common/README.md @@ -21,6 +21,7 @@ | [io-backend\_notification\_v2\_api\_v1](#module\_io-backend\_notification\_v2\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3//api_management_api | v7.69.1 | | [key\_vault](#module\_key\_vault) | git::https://github.com/pagopa/terraform-azurerm-v3//key_vault | v7.69.1 | | [mongdb\_collection\_reminder](#module\_mongdb\_collection\_reminder) | git::https://github.com/pagopa/terraform-azurerm-v3//cosmosdb_mongodb_collection | v7.69.1 | +| [mongdb\_collection\_reminder\_sharded](#module\_mongdb\_collection\_reminder\_sharded) | git::https://github.com/pagopa/terraform-azurerm-v3//cosmosdb_mongodb_collection | v7.69.1 | | [push\_notif\_beta\_storage](#module\_push\_notif\_beta\_storage) | git::https://github.com/pagopa/terraform-azurerm-v3//storage_account | v7.69.1 | | [push\_notifications\_storage](#module\_push\_notifications\_storage) | git::https://github.com/pagopa/terraform-azurerm-v3//storage_account | v7.69.1 | | [redis\_messages](#module\_redis\_messages) | github.com/pagopa/terraform-azurerm-v3//redis_cache | v7.63.0 |