Azure / Azure/Azure-Verified-Modules
[Module Proposal]: `avm-ptn-bcdr-vm-replication`
- Dominant language
- PowerShell
- Stars
- 580
- Forks
- 161
- Avg merge
- 11h 3m
- Merged PRs (30d)
- 15
Description
### Check for previous/existing GitHub issues/module proposals
- [X] I have checked for previous/existing GitHub issues/module proposals.
### Check this module doesn't already exist in the module indexes
- [X] I have checked for that this module doesn't already exist in the module indexes; or I'm proposing the module to be migrated from CARML/TFVM.
### Bicep or Terraform?
Terraform
### Module Classification?
Pattern Module
### Module Name
avm-ptn-bcdr-vm-replication
### Module Details
# **Azure Site Recovery VM Replication Module Description**
The `avm-ptn-bcdr-vm-replication` module is designed to simplify the deployment and configuration of Virtual Machine replication using Azure Site Recovery Services (ASR) within Azure. It abstracts the complexity involved in setting up a disaster recovery scenario by managing all necessary resources to replicate a VM from one Azure region to another, ensuring that in case of a regional outage, your VM can be quickly recovered in the secondary location.
## **Module Functionality**
Here's a high-level overview of what this module will manage:
1. **Resource Groups**: Create or reference existing resource groups in primary and secondary regions to host the ASR infrastructure and replicated VMs.
2. **Virtual Network**: Define or reference existing virtual networks in both primary and secondary sites with their respective subnets for consistent networking.
3. **Storage Accounts**: Provision or reference storage accounts required for replication caching and other ASR operations.
4. **Virtual Machines**: Reference and configure the primary Virtual Machine which needs to be replicated.
5. **Recovery Services Vault**: Create a Recovery Services Vault in the secondary region to manage and orchestrate replication and failover activities.
6. **Site Recovery Fabrics**: Set up primary and secondary ASR fabrics which are logical containers representing each site.
7. **Protection Containers**: Create or configure protection containers within fabrics which group together VMs for replication.
8. **Replication Policy**: Define replication policy settings such as frequency of replication and retention of recovery points.
9. **Network Mapping**: Manage the mapping of virtual networks between primary and secondary sites to ensure connectivity after failover.
10. **Replication**: Handle the replication of the specified VMs from the primary to the secondary site based on the defined replication policy.
11. **Optional Configuration**: Customize additional replication settings such as Target Availability Set, Proximity Placement Group, and encryption settings if required.
## **Example Module Usage**
Usage of this module could resemble the following:
hcl
```
module "avm-ptn-bcdr-vm-replication" {
source = "path/to/module/avm-ptn-bcdr-vm-replication"
// Required variables
primary_location = "West US"
secondary_location = "East US"
primary_vm_id = azurerm_virtual_machine.vm.id
primary_network_interface_id = azurerm_network_interface.vm.id
// Optional variables with their defaults
replication_policy_name = "default-replication-policy"
recovery_vault_sku = "Standard"
target_disk_type = "Premium_LRS"
failover_network_mappings = {
primary_subnet_id = azurerm_subnet.primary.id
secondary_subnet_id = azurerm_subnet.secondary.id17 }
// ... more configurations
}
```
## **Argument Reference**
The following arguments are supported:
- `primary_location`: (Required) The Azure region where the primary VM is located.
- `secondary_location`: (Required) The Azure region where the replicated VM will be located upon failover.
- `primary_vm_id`: (Required) The resource ID of the primary VM to be replicated.
- `primary_network_interface_id`: (Required) The ID of the primary network interface attached to the VM to be replicated.
- Additional optional arguments to configure aspects of the replication not covered by defaults.
### Do you want to be the owner of this module?
Yes
### Module Owner's GitHub Username (handle)
FreddyAyala
### (Optional) Secondary Module Owner's GitHub Username (handle)
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.