Skip to content
Merged
Show file tree
Hide file tree
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
19 changes: 19 additions & 0 deletions infrastructure/modules/storage/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,25 @@ resource "azurerm_storage_queue" "queue" {
depends_on = [module.private_endpoint_queue_storage]
}

resource "azurerm_storage_object_replication" "object_replication" {
for_each = local.containers_with_replication

source_storage_account_id = azurerm_storage_account.storage_account.id
destination_storage_account_id = each.value.object_replication.destination_storage_account_id

rules {
source_container_name = each.value.object_replication.source_container_name
destination_container_name = each.value.object_replication.destination_container_name
}
}

locals {
containers_with_replication = {
for key, container in var.containers :
key => container
if container.object_replication != null
}
}

/* --------------------------------------------------------------------------------------------------
Private Endpoint Configuration
Expand Down
8 changes: 7 additions & 1 deletion infrastructure/modules/storage/tfdocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The following input variables are required:

### <a name="input_containers"></a> [containers](#input\_containers)

Description: Definition of Storage Containers configuration, including optional immutability policy settings.
Description: Definition of Storage Containers configuration, including optional immutability policy and object replication settings.

Type:

Expand All @@ -20,6 +20,11 @@ map(object({
protected_append_writes_all_enabled = optional(bool, false)
protected_append_writes_enabled = optional(bool, false)
}))
object_replication = optional(object({
source_container_name = string
destination_storage_account_id = string
destination_container_name = string
}), null)
}))
```

Expand Down Expand Up @@ -347,5 +352,6 @@ The following resources are used by this module:
- [azurerm_storage_account.storage_account](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_account) (resource)
- [azurerm_storage_container.container](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_container) (resource)
- [azurerm_storage_container_immutability_policy.policy](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_container_immutability_policy) (resource)
- [azurerm_storage_object_replication.object_replication](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_object_replication) (resource)
- [azurerm_storage_queue.queue](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_queue) (resource)
- [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config) (data source)
7 changes: 6 additions & 1 deletion infrastructure/modules/storage/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ variable "blob_properties_versioning_enabled" {
}

variable "containers" {
description = "Definition of Storage Containers configuration, including optional immutability policy settings."
description = "Definition of Storage Containers configuration, including optional immutability policy and object replication settings."
type = map(object({
container_name = string
container_access_type = string
Expand All @@ -64,6 +64,11 @@ variable "containers" {
protected_append_writes_all_enabled = optional(bool, false)
protected_append_writes_enabled = optional(bool, false)
}))
object_replication = optional(object({
source_container_name = string
destination_storage_account_id = string
destination_container_name = string
}), null)
}))
}

Expand Down
Loading