Skip to content

SoftcatMS/terraform-azure-site-recovery

Repository files navigation

terraform-azure-site-recovery

Deploys Azure Site Recovery vault and configures replication for existing Azure VMs.

Prerequisite the subnets where the exisitng VMs reside must have the 'Microsoft.Storage' service endpoint enabled to allow access to the replication cache storage account

WARNING adding additional disks to a VM already replicated will destory the current replication first before the entire VM is re-replicated. This can take additional time to complete.

Usage Examples

Review the examples folder: examples

Deployment

Perform the following commands on the root folder:

  • terraform init to get the plugins
  • terraform plan to see the infrastructure plan
  • terraform apply to apply the infrastructure build
  • terraform destroy to destroy the built infrastructure

use terraform-docs to create Inputs and Outpus documentation terraform-docs

terraform-docs markdown .

Requirements

Name Version
terraform >=1.0.0
azurerm =2.97.0

Providers

Name Version
azurerm =2.97.0
random n/a

Modules

No modules.

Resources

Name Type
azurerm_public_ip.secondary resource
azurerm_recovery_services_vault.asr_vault resource
azurerm_resource_group.rg_secondary resource
azurerm_role_assignment.asr_contributor_assignment resource
azurerm_role_assignment.asr_storageblobdatacontributor_assignment resource
azurerm_site_recovery_fabric.primary resource
azurerm_site_recovery_fabric.secondary resource
azurerm_site_recovery_network_mapping.network-mapping resource
azurerm_site_recovery_protection_container.primary resource
azurerm_site_recovery_protection_container.secondary resource
azurerm_site_recovery_protection_container_mapping.container-mapping resource
azurerm_site_recovery_replicated_vm.vm-replication-no-pubip resource
azurerm_site_recovery_replicated_vm.vm-replication-pubip resource
azurerm_site_recovery_replication_policy.policy resource
azurerm_storage_account.primary resource
azurerm_subnet.secondary resource
azurerm_virtual_network.secondary resource
random_string.random_string resource

Inputs

Name Description Type Default Required
app_consistent_snapshot_frequency_minutes ASR policy setting. Sets the application consistent snapshot frequency in minutes number 240 no
asr_cache_resource_group_name Azure resource group name of where the storgae account for replication cache should be created string null no
asr_subnet_prefixes The address prefix to use for the subnets in the ASR replicated secondary location list(string)
[
"10.0.1.0/24"
]
no
asr_vault_name Azure ASR Vault Name string null no
asr_vnet_address_space The address space that is used by the virtual network setup in the ASR replicated secondary location
list(string)
[
"10.0.0.0/16"
]
no
existing_subnet_id Azure subnet id of the existing subnet where one the primary VM resides. Please ensure this subnet has the Microsoft.Storage service endpoint enabled string null no
existing_vm_networkinteface_id Azure network interface id of interface attached to existing VM string null no
existing_vm_primary Azure exisiting VMs information. The object 'vm_pubip' should be set to true if a public IP is required for the VM and the 'vm_datadisks' allows for multiple data disks to be specified
list(object({
vm_name = string
vm_id = string
vm_osdisk_id = string
vm_osdisk_type = string
vm_existing_nic_id = string
vm_pubip = bool
vm_datadisks = list(object({
id = string
type = string
}))
}))
[] no
existing_vnet_id_primary Azure vNet id of exisitng network where primary VM resides string null no
location_primary Azure location of where the exisiting VMs reside string null no
location_secondary Azure location of where the VMs will need to be replicated to string null no
recovery_point_retention_minutes ASR policy setting. Sets the recovery point retention in minutes number 1440 no
resource_group_name_secondary Azure resource group for secondary location of replicated resources string null no

Outputs

No outputs.