Skip to content

azurermSiteRecoveryHypervReplicationPolicyAssociation

Manages an Azure Site Recovery replication policy for HyperV within a Recovery Vault.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "East US",
    name: "example-rg",
  }
);
const azurermSiteRecoveryServicesVaultHypervSiteExample =
  new azurerm.siteRecoveryServicesVaultHypervSite.SiteRecoveryServicesVaultHypervSite(
    this,
    "example_1",
    {
      name: "example-site",
      recovery_vault_id: "${azurerm_recovery_services_vault.example.id}",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSiteRecoveryServicesVaultHypervSiteExample.overrideLogicalId("example");
const azurermRecoveryServicesVaultVault =
  new azurerm.recoveryServicesVault.RecoveryServicesVault(this, "vault", {
    location: azurermResourceGroupExample.location,
    name: "example-recovery-vault",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Standard",
  });
new azurerm.siteRecoveryHypervReplicationPolicy.SiteRecoveryHypervReplicationPolicy(
  this,
  "policy",
  {
    application_consistent_snapshot_frequency_in_hours: 1,
    name: "policy",
    recovery_point_retention_in_hours: 2,
    recovery_vault_name: azurermRecoveryServicesVaultVault.name,
    replication_interval_in_seconds: 300,
    resource_group_name: azurermResourceGroupExample.name,
  }
);
const azurermSiteRecoveryHypervReplicationPolicyAssociationExample =
  new azurerm.siteRecoveryHypervReplicationPolicyAssociation.SiteRecoveryHypervReplicationPolicyAssociation(
    this,
    "example_4",
    {
      hyperv_site_id: azurermSiteRecoveryServicesVaultHypervSiteExample.id,
      name: "example-association",
      policy_id:
        "${azurerm_site_recovery_hyperv_replication_policy.example.id}",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSiteRecoveryHypervReplicationPolicyAssociationExample.overrideLogicalId(
  "example"
);

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the replication policy association. Changing this forces a new association to be created.

  • hypervSiteId - (Required) The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.

  • policyId - (Required) The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.

Attributes Reference

In addition to the arguments above, the following attributes are exported:

  • id - The ID of the Site Recovery Replication Policy.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 60 minutes) Used when creating the Site Recovery Replication Policy Association.
  • read - (Defaults to 5 minutes) Used when retrieving the Site Recovery Replication Policy Association.
  • delete - (Defaults to 60 minutes) Used when deleting the Site Recovery Replication Policy Association.

Import

Site Recovery Replication Policies can be imported using the resourceId, e.g.

terraform import  azurerm_site_recovery_hyperv_replication_policy_association.mypolicy /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/replicationFabrics/site-name/replicationProtectionContainers/container-name/replicationProtectionContainerMappings/mapping-name