azurermSiteRecoveryNetworkMapping
Manages a site recovery network mapping on Azure. A network mapping decides how to translate connected networks 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 azurermVirtualNetworkPrimary = new azurerm.virtualNetwork.VirtualNetwork(
this,
"primary_2",
{
address_space: ["192.168.1.0/24"],
location: azurermResourceGroupPrimary.location,
name: "network1",
resource_group_name: azurermResourceGroupPrimary.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.*/
azurermVirtualNetworkPrimary.overrideLogicalId("primary");
const azurermVirtualNetworkSecondary =
new azurerm.virtualNetwork.VirtualNetwork(this, "secondary_3", {
address_space: ["192.168.2.0/24"],
location: azurermResourceGroupSecondary.location,
name: "network2",
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.*/
azurermVirtualNetworkSecondary.overrideLogicalId("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_5", {
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_6", {
depends_on: [`\${${azurermSiteRecoveryFabricPrimary.fqn}}`],
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");
new azurerm.siteRecoveryNetworkMapping.SiteRecoveryNetworkMapping(
this,
"recovery-mapping",
{
name: "recovery-network-mapping-1",
recovery_vault_name: azurermRecoveryServicesVaultVault.name,
resource_group_name: azurermResourceGroupSecondary.name,
source_network_id: azurermVirtualNetworkPrimary.id,
source_recovery_fabric_name: "primary-fabric",
target_network_id: azurermVirtualNetworkSecondary.id,
target_recovery_fabric_name: "secondary-fabric",
}
);
Argument Reference
The following arguments are supported:
-
name
- (Required) The name of the network 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. -
sourceRecoveryFabricName
- (Required) Specifies the ASR fabric where mapping should be created. Changing this forces a new resource to be created. -
targetRecoveryFabricName
- (Required) The Azure Site Recovery fabric object corresponding to the recovery Azure region. Changing this forces a new resource to be created. -
sourceNetworkId
- (Required) The id of the primary network. Changing this forces a new resource to be created. -
targetNetworkId
- (Required) The id of the recovery network. Changing this forces a new resource to be created.
Attributes Reference
In addition to the arguments above, the following attributes are exported:
id
- The ID of the Site Recovery Network Mapping.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Site Recovery Network Mapping.update
- (Defaults to 30 minutes) Used when updating the Site Recovery Network Mapping.read
- (Defaults to 5 minutes) Used when retrieving the Site Recovery Network Mapping.delete
- (Defaults to 30 minutes) Used when deleting the Site Recovery Network Mapping.
Import
Site Recovery Network Mapping can be imported using the resourceId
, e.g.
terraform import azurerm_site_recovery_network_mapping.mymapping /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/replicationFabrics/primary-fabric-name/replicationNetworks/azureNetwork/replicationNetworkMappings/mapping-name