Azure Recovery Services Replicated Vm

This page shows how to write Terraform and Azure Resource Manager for Recovery Services Replicated Vm and write them securely.

azurerm_site_recovery_replicated_vm (Terraform)

The Replicated Vm in Recovery Services can be configured in Terraform with the resource name azurerm_site_recovery_replicated_vm. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L7
resource "azurerm_site_recovery_replicated_vm" "this" {
  managed_disk                              = var.managed_disk
  name                                      = var.name
  recovery_replication_policy_id            = var.recovery_replication_policy_id
  recovery_vault_name                       = var.recovery_vault_name
  resource_group_name                       = var.resource_group_name
main.tf#L7
resource "azurerm_site_recovery_replicated_vm" "this" {
  managed_disk                              = var.managed_disk
  name                                      = var.name
  recovery_replication_policy_id            = var.recovery_replication_policy_id
  recovery_vault_name                       = var.recovery_vault_name
  resource_group_name                       = var.resource_group_name
recovery.tf#L2
resource "azurerm_site_recovery_replicated_vm" "vm-replication" {
  for_each = { for vm in azurerm_virtual_machine.vm : vm.id => vm
    if local.enable_recovery
  }

  name = format("%s-replication", each.value.name)
recovery.tf#L2
resource "azurerm_site_recovery_replicated_vm" "vm-replication" {
  for_each = { for vm in azurerm_virtual_machine.vm : vm.id => vm
    if local.enable_recovery
  }

  name = format("%s-replication", each.value.name)
main.tf#L86
resource "azurerm_site_recovery_replicated_vm" "vm-replication" {
  name                                      = var.replicated_vm_name
  resource_group_name                       = var.rg_second_name
  recovery_vault_name                       = azurerm_recovery_services_vault.vault.name
  source_recovery_fabric_name               = azurerm_site_recovery_fabric.primary.name
  source_vm_id                              = var.source_vm_id

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a VM replicated using Azure Site Recovery (Azure to Azure only). A replicated VM keeps a copiously updated image of the VM in another region in order to be able to start the VM in that region in case of a disaster.

Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems (Azure Resource Manager)

The vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems in Microsoft.RecoveryServices can be configured in Azure Resource Manager with the resource name Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Frequently asked questions

What is Azure Recovery Services Replicated Vm?

Azure Recovery Services Replicated Vm is a resource for Recovery Services of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Recovery Services Replicated Vm?

For Terraform, the niveklabs/azurerm, kevinhead/azurerm and rohrerb/terraform-eiac source code examples are useful. See the Terraform Example section for further details.