azurermSiteRecoveryProtectionContainerMapping
Manages a Azure recovery vault protection container mapping. A protection container mapping decides how to translate the protection container when a VM is migrated from one region to another.
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 azurermResourceGroupPrimary = new azurerm.resourceGroup.ResourceGroup(
this,
"primary",
{
location: "West US",
name: "tfex-network-mapping-primary",
}
);
const azurermResourceGroupSecondary = new azurerm.resourceGroup.ResourceGroup(
this,
"secondary",
{
location: "East US",
name: "tfex-network-mapping-secondary",
}
);
const azurermRecoveryServicesVaultVault =
new azurerm.recoveryServicesVault.RecoveryServicesVault(this, "vault", {
location: azurermResourceGroupSecondary.location,
name: "example-recovery-vault",
resource_group_name: azurermResourceGroupSecondary.name,
sku: "Standard",
});
const azurermSiteRecoveryFabricPrimary =
new azurerm.siteRecoveryFabric.SiteRecoveryFabric(this, "primary_3", {
location: azurermResourceGroupPrimary.location,
name: "primary-fabric",
recovery_vault_name: azurermRecoveryServicesVaultVault.name,
resource_group_name: azurermResourceGroupSecondary.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSiteRecoveryFabricPrimary.overrideLogicalId("primary");
const azurermSiteRecoveryFabricSecondary =
new azurerm.siteRecoveryFabric.SiteRecoveryFabric(this, "secondary_4", {
location: azurermResourceGroupSecondary.location,
name: "secondary-fabric",
recovery_vault_name: azurermRecoveryServicesVaultVault.name,
resource_group_name: azurermResourceGroupSecondary.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSiteRecoveryFabricSecondary.overrideLogicalId("secondary");
const azurermSiteRecoveryProtectionContainerPrimary =
new azurerm.siteRecoveryProtectionContainer.SiteRecoveryProtectionContainer(
this,
"primary_5",
{
name: "primary-protection-container",
recovery_fabric_name: azurermSiteRecoveryFabricPrimary.name,
recovery_vault_name: azurermRecoveryServicesVaultVault.name,
resource_group_name: azurermResourceGroupSecondary.name,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSiteRecoveryProtectionContainerPrimary.overrideLogicalId("primary");
const azurermSiteRecoveryProtectionContainerSecondary =
new azurerm.siteRecoveryProtectionContainer.SiteRecoveryProtectionContainer(
this,
"secondary_6",
{
name: "secondary-protection-container",
recovery_fabric_name: azurermSiteRecoveryFabricSecondary.name,
recovery_vault_name: azurermRecoveryServicesVaultVault.name,
resource_group_name: azurermResourceGroupSecondary.name,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSiteRecoveryProtectionContainerSecondary.overrideLogicalId("secondary");
const azurermSiteRecoveryReplicationPolicyPolicy =
new azurerm.siteRecoveryReplicationPolicy.SiteRecoveryReplicationPolicy(
this,
"policy",
{
application_consistent_snapshot_frequency_in_minutes: "${4 * 60}",
name: "policy",
recovery_point_retention_in_minutes: "${24 * 60}",
recovery_vault_name: azurermRecoveryServicesVaultVault.name,
resource_group_name: azurermResourceGroupSecondary.name,
}
);
new azurerm.siteRecoveryProtectionContainerMapping.SiteRecoveryProtectionContainerMapping(
this,
"container-mapping",
{
name: "container-mapping",
recovery_fabric_name: azurermSiteRecoveryFabricPrimary.name,
recovery_replication_policy_id:
azurermSiteRecoveryReplicationPolicyPolicy.id,
recovery_source_protection_container_name:
azurermSiteRecoveryProtectionContainerPrimary.name,
recovery_target_protection_container_id:
azurermSiteRecoveryProtectionContainerSecondary.id,
recovery_vault_name: azurermRecoveryServicesVaultVault.name,
resource_group_name: azurermResourceGroupSecondary.name,
}
);
Argument Reference
The following arguments are supported:
-
name
- (Required) The name of the protection container mapping. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created. -
recoveryVaultName
- (Required) The name of the vault that should be updated. Changing this forces a new resource to be created. -
recoveryFabricName
- (Required) Name of fabric that should contains the protection container to map. Changing this forces a new resource to be created. -
recoverySourceProtectionContainerName
- (Required) Name of the source protection container to map. Changing this forces a new resource to be created. -
recoveryTargetProtectionContainerId
- (Required) Id of target protection container to map to. Changing this forces a new resource to be created. -
recoveryReplicationPolicyId
- (Required) Id of the policy to use for this mapping. Changing this forces a new resource to be created. -
automaticUpdate
- (Optional) aautomaticUpdate
block defined as below.
An automaticUpdate
block supports the following:
enabled
- (Optional) Should the Mobility service installed on Azure virtual machines be automatically updated. Defaults tofalse
.
\~> Note: The setting applies to all Azure VMs protected in the same container. For more details see this document
automationAccountId
- (Optional) The automation account ID which holds the automatic update runbook and authenticates to Azure resources.
\~> Note: automationAccountId
is required when enabled
is sepcified.
Attributes Reference
In addition to the arguments above, the following attributes are exported:
id
- The ID of the Site Recovery Protection Container Mapping.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Site Recovery Protection Container Mapping.update
- (Defaults to 30 minutes) Used when updating the Site Recovery Protection Container Mapping.read
- (Defaults to 5 minutes) Used when retrieving the Site Recovery Protection Container Mapping.delete
- (Defaults to 30 minutes) Used when deleting the Site Recovery Protection Container Mapping.
Import
Site Recovery Protection Container Mappings can be imported using the resourceId
, e.g.
terraform import azurerm_site_recovery_protection_container_mapping.mymapping /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/replicationFabrics/fabric1/replicationProtectionContainers/container1/replicationProtectionContainerMappings/mapping1