Azure Recovery Services Replication Policy

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

azurerm_site_recovery_replication_policy (Terraform)

The Replication Policy in Recovery Services can be configured in Terraform with the resource name azurerm_site_recovery_replication_policy. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

replication_policy.tf#L2
resource "azurerm_site_recovery_replication_policy" "policy" {
  depends_on = [azurerm_recovery_services_vault.asr, time_sleep.delay_create]
  for_each   = try(var.settings.replication_policies, {})

  name                                                 = each.value.name
  resource_group_name                                  = var.resource_group_name
main.tf#L7
resource "azurerm_site_recovery_replication_policy" "this" {
  application_consistent_snapshot_frequency_in_minutes = var.application_consistent_snapshot_frequency_in_minutes
  name                                                 = var.name
  recovery_point_retention_in_minutes                  = var.recovery_point_retention_in_minutes
  recovery_vault_name                                  = var.recovery_vault_name
  resource_group_name                                  = var.resource_group_name
replication_policy.tf#L4
resource "azurerm_site_recovery_replication_policy" "policy" {
  depends_on = [time_sleep.delay_create]
  for_each   = try(var.settings.replication_policies, {})

  name                                                 = each.value.name
  resource_group_name                                  = var.resource_group_name
replication_policy.tf#L2
resource "azurerm_site_recovery_replication_policy" "policy" {
  depends_on = [azurerm_recovery_services_vault.asr, time_sleep.delay_create]
  for_each   = try(var.settings.replication_policies, {})

  name                                                 = each.value.name
  resource_group_name                                  = var.resource_group_name
main.tf#L7
resource "azurerm_site_recovery_replication_policy" "this" {
  application_consistent_snapshot_frequency_in_minutes = var.application_consistent_snapshot_frequency_in_minutes
  name                                                 = var.name
  recovery_point_retention_in_minutes                  = var.recovery_point_retention_in_minutes
  recovery_vault_name                                  = var.recovery_vault_name
  resource_group_name                                  = var.resource_group_name
replication_policy.tf#L4
resource "azurerm_site_recovery_replication_policy" "policy" {
  depends_on = [time_sleep.delay_create]
  for_each   = try(var.settings.replication_policies, {})

  name                                                 = each.value.name
  resource_group_name                                  = var.resource_group_name
replication_policy.tf#L4
resource "azurerm_site_recovery_replication_policy" "policy" {
  depends_on = [time_sleep.delay_create]
  for_each   = try(var.settings.replication_policies, {})

  name                                                 = each.value.name
  resource_group_name                                  = var.resource_group_name
main.tf#L26
resource "azurerm_site_recovery_replication_policy" "policy" {
  name                                                 = "Default-VM-Policy"
  resource_group_name                                  = var.secondary_resource_group_name
  recovery_vault_name                                  = var.vault_name
  recovery_point_retention_in_minutes                  = 24 * 60
  application_consistent_snapshot_frequency_in_minutes = 4 * 60
main.tf#L47
resource "azurerm_site_recovery_replication_policy" "policy" {
  count                                                = signum(var.create ? 1 : 0)
  name                                                 = "policy"
  resource_group_name                                  = var.resource_group_name
  recovery_vault_name                                  = azurerm_recovery_services_vault.vault.*.name[0]
  recovery_point_retention_in_minutes                  = var.recovery_point_retention_in_minutes
main.tf#L47
resource "azurerm_site_recovery_replication_policy" "policy" {
  count                                                = signum(var.create ? 1 : 0)
  name                                                 = "policy"
  resource_group_name                                  = var.resource_group_name
  recovery_vault_name                                  = azurerm_recovery_services_vault.vault.*.name[0]
  recovery_point_retention_in_minutes                  = var.recovery_point_retention_in_minutes

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 Azure Site Recovery replication policy within a recovery vault. Replication policies define the frequency at which recovery points are created and how long they are stored.

Microsoft.RecoveryServices/vaults/replicationPolicies (Azure Resource Manager)

The vaults/replicationPolicies in Microsoft.RecoveryServices can be configured in Azure Resource Manager with the resource name Microsoft.RecoveryServices/vaults/replicationPolicies. 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 Replication Policy?

Azure Recovery Services Replication Policy 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 Replication Policy?

For Terraform, the davesee/terraform-caf-rover-breakout, kevinhead/azurerm and pkhuntia/aztfmod source code examples are useful. See the Terraform Example section for further details.