Skip to content

Commit 1780440

Browse files
committed
feat: [DTOSS-12476] added support for storage account object replication
1 parent 0abead1 commit 1780440

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

infrastructure/modules/storage/main.tf

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,25 @@ resource "azurerm_storage_queue" "queue" {
4242
depends_on = [module.private_endpoint_queue_storage]
4343
}
4444

45+
resource "azurerm_storage_object_replication" "object_replication" {
46+
for_each = local.containers_with_replication
47+
48+
source_storage_account_id = azurerm_storage_account.storage_account.id
49+
destination_storage_account_id = each.value.object_replication.destination_storage_account_id
50+
51+
rules {
52+
source_container_name = each.value.object_replication.source_container_name
53+
destination_container_name = each.value.object_replication.destination_container_name
54+
}
55+
}
56+
57+
locals {
58+
containers_with_replication = {
59+
for key, container in var.containers :
60+
key => container
61+
if container.object_replication != null
62+
}
63+
}
4564

4665
/* --------------------------------------------------------------------------------------------------
4766
Private Endpoint Configuration
@@ -140,7 +159,7 @@ module "diagnostic-settings-sa-resource" {
140159
source = "../diagnostic-settings"
141160

142161
name = "${azurerm_storage_account.storage_account.name}-diagnotic-setting-storage-account"
143-
target_resource_id = "${azurerm_storage_account.storage_account.id}"
162+
target_resource_id = azurerm_storage_account.storage_account.id
144163
log_analytics_workspace_id = var.log_analytics_workspace_id
145164
enabled_metric = var.monitor_diagnostic_setting_storage_account_resource_metrics
146165

infrastructure/modules/storage/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ variable "containers" {
6464
protected_append_writes_all_enabled = optional(bool, false)
6565
protected_append_writes_enabled = optional(bool, false)
6666
}))
67+
object_replication = optional(object({
68+
source_container_name = string
69+
destination_storage_account_id = string
70+
destination_container_name = string
71+
}))
6772
}))
6873
}
6974

0 commit comments

Comments
 (0)