NetworkMapping
Manages a site recovery network mapping on Azure. A network mapping decides how to translate connected netwroks when a VM is migrated from one region to another.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var primaryResourceGroup = new Azure.Core.ResourceGroup("primaryResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West US",
});
var secondaryResourceGroup = new Azure.Core.ResourceGroup("secondaryResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "East US",
});
var vault = new Azure.RecoveryServices.Vault("vault", new Azure.RecoveryServices.VaultArgs
{
Location = secondaryResourceGroup.Location,
ResourceGroupName = secondaryResourceGroup.Name,
Sku = "Standard",
});
var primaryFabric = new Azure.SiteRecovery.Fabric("primaryFabric", new Azure.SiteRecovery.FabricArgs
{
ResourceGroupName = secondaryResourceGroup.Name,
RecoveryVaultName = vault.Name,
Location = primaryResourceGroup.Location,
});
var secondaryFabric = new Azure.SiteRecovery.Fabric("secondaryFabric", new Azure.SiteRecovery.FabricArgs
{
ResourceGroupName = secondaryResourceGroup.Name,
RecoveryVaultName = vault.Name,
Location = secondaryResourceGroup.Location,
});
// Avoids issues with crearing fabrics simultainusly
var primaryVirtualNetwork = new Azure.Network.VirtualNetwork("primaryVirtualNetwork", new Azure.Network.VirtualNetworkArgs
{
ResourceGroupName = primaryResourceGroup.Name,
AddressSpaces =
{
"192.168.1.0/24",
},
Location = primaryResourceGroup.Location,
});
var secondaryVirtualNetwork = new Azure.Network.VirtualNetwork("secondaryVirtualNetwork", new Azure.Network.VirtualNetworkArgs
{
ResourceGroupName = secondaryResourceGroup.Name,
AddressSpaces =
{
"192.168.2.0/24",
},
Location = secondaryResourceGroup.Location,
});
var recovery_mapping = new Azure.SiteRecovery.NetworkMapping("recovery-mapping", new Azure.SiteRecovery.NetworkMappingArgs
{
ResourceGroupName = secondaryResourceGroup.Name,
RecoveryVaultName = vault.Name,
SourceRecoveryFabricName = "primary-fabric",
TargetRecoveryFabricName = "secondary-fabric",
SourceNetworkId = primaryVirtualNetwork.Id,
TargetNetworkId = secondaryVirtualNetwork.Id,
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/network"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/recoveryservices"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/siterecovery"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primaryResourceGroup, err := core.NewResourceGroup(ctx, "primaryResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West US"),
})
if err != nil {
return err
}
secondaryResourceGroup, err := core.NewResourceGroup(ctx, "secondaryResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("East US"),
})
if err != nil {
return err
}
vault, err := recoveryservices.NewVault(ctx, "vault", &recoveryservices.VaultArgs{
Location: secondaryResourceGroup.Location,
ResourceGroupName: secondaryResourceGroup.Name,
Sku: pulumi.String("Standard"),
})
if err != nil {
return err
}
primaryFabric, err := siterecovery.NewFabric(ctx, "primaryFabric", &siterecovery.FabricArgs{
ResourceGroupName: secondaryResourceGroup.Name,
RecoveryVaultName: vault.Name,
Location: primaryResourceGroup.Location,
})
if err != nil {
return err
}
_, err = siterecovery.NewFabric(ctx, "secondaryFabric", &siterecovery.FabricArgs{
ResourceGroupName: secondaryResourceGroup.Name,
RecoveryVaultName: vault.Name,
Location: secondaryResourceGroup.Location,
})
if err != nil {
return err
}
primaryVirtualNetwork, err := network.NewVirtualNetwork(ctx, "primaryVirtualNetwork", &network.VirtualNetworkArgs{
ResourceGroupName: primaryResourceGroup.Name,
AddressSpaces: pulumi.StringArray{
pulumi.String("192.168.1.0/24"),
},
Location: primaryResourceGroup.Location,
})
if err != nil {
return err
}
secondaryVirtualNetwork, err := network.NewVirtualNetwork(ctx, "secondaryVirtualNetwork", &network.VirtualNetworkArgs{
ResourceGroupName: secondaryResourceGroup.Name,
AddressSpaces: pulumi.StringArray{
pulumi.String("192.168.2.0/24"),
},
Location: secondaryResourceGroup.Location,
})
if err != nil {
return err
}
_, err = siterecovery.NewNetworkMapping(ctx, "recovery-mapping", &siterecovery.NetworkMappingArgs{
ResourceGroupName: secondaryResourceGroup.Name,
RecoveryVaultName: vault.Name,
SourceRecoveryFabricName: pulumi.String("primary-fabric"),
TargetRecoveryFabricName: pulumi.String("secondary-fabric"),
SourceNetworkId: primaryVirtualNetwork.ID(),
TargetNetworkId: secondaryVirtualNetwork.ID(),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_azure as azure
primary_resource_group = azure.core.ResourceGroup("primaryResourceGroup", location="West US")
secondary_resource_group = azure.core.ResourceGroup("secondaryResourceGroup", location="East US")
vault = azure.recoveryservices.Vault("vault",
location=secondary_resource_group.location,
resource_group_name=secondary_resource_group.name,
sku="Standard")
primary_fabric = azure.siterecovery.Fabric("primaryFabric",
resource_group_name=secondary_resource_group.name,
recovery_vault_name=vault.name,
location=primary_resource_group.location)
secondary_fabric = azure.siterecovery.Fabric("secondaryFabric",
resource_group_name=secondary_resource_group.name,
recovery_vault_name=vault.name,
location=secondary_resource_group.location)
# Avoids issues with crearing fabrics simultainusly
primary_virtual_network = azure.network.VirtualNetwork("primaryVirtualNetwork",
resource_group_name=primary_resource_group.name,
address_spaces=["192.168.1.0/24"],
location=primary_resource_group.location)
secondary_virtual_network = azure.network.VirtualNetwork("secondaryVirtualNetwork",
resource_group_name=secondary_resource_group.name,
address_spaces=["192.168.2.0/24"],
location=secondary_resource_group.location)
recovery_mapping = azure.siterecovery.NetworkMapping("recovery-mapping",
resource_group_name=secondary_resource_group.name,
recovery_vault_name=vault.name,
source_recovery_fabric_name="primary-fabric",
target_recovery_fabric_name="secondary-fabric",
source_network_id=primary_virtual_network.id,
target_network_id=secondary_virtual_network.id)import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const primaryResourceGroup = new azure.core.ResourceGroup("primaryResourceGroup", {location: "West US"});
const secondaryResourceGroup = new azure.core.ResourceGroup("secondaryResourceGroup", {location: "East US"});
const vault = new azure.recoveryservices.Vault("vault", {
location: secondaryResourceGroup.location,
resourceGroupName: secondaryResourceGroup.name,
sku: "Standard",
});
const primaryFabric = new azure.siterecovery.Fabric("primaryFabric", {
resourceGroupName: secondaryResourceGroup.name,
recoveryVaultName: vault.name,
location: primaryResourceGroup.location,
});
const secondaryFabric = new azure.siterecovery.Fabric("secondaryFabric", {
resourceGroupName: secondaryResourceGroup.name,
recoveryVaultName: vault.name,
location: secondaryResourceGroup.location,
});
// Avoids issues with crearing fabrics simultainusly
const primaryVirtualNetwork = new azure.network.VirtualNetwork("primaryVirtualNetwork", {
resourceGroupName: primaryResourceGroup.name,
addressSpaces: ["192.168.1.0/24"],
location: primaryResourceGroup.location,
});
const secondaryVirtualNetwork = new azure.network.VirtualNetwork("secondaryVirtualNetwork", {
resourceGroupName: secondaryResourceGroup.name,
addressSpaces: ["192.168.2.0/24"],
location: secondaryResourceGroup.location,
});
const recovery_mapping = new azure.siterecovery.NetworkMapping("recovery-mapping", {
resourceGroupName: secondaryResourceGroup.name,
recoveryVaultName: vault.name,
sourceRecoveryFabricName: "primary-fabric",
targetRecoveryFabricName: "secondary-fabric",
sourceNetworkId: primaryVirtualNetwork.id,
targetNetworkId: secondaryVirtualNetwork.id,
});Create a NetworkMapping Resource
new NetworkMapping(name: string, args: NetworkMappingArgs, opts?: CustomResourceOptions);def NetworkMapping(resource_name, opts=None, name=None, recovery_vault_name=None, resource_group_name=None, source_network_id=None, source_recovery_fabric_name=None, target_network_id=None, target_recovery_fabric_name=None, __props__=None);func NewNetworkMapping(ctx *Context, name string, args NetworkMappingArgs, opts ...ResourceOption) (*NetworkMapping, error)public NetworkMapping(string name, NetworkMappingArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args NetworkMappingArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args NetworkMappingArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkMappingArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
NetworkMapping Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The NetworkMapping resource accepts the following input properties:
- Recovery
Vault stringName The name of the vault that should be updated.
- Resource
Group stringName Name of the resource group where the vault that should be updated is located.
- Source
Network stringId The id of the primary network.
- Source
Recovery stringFabric Name Specifies the ASR fabric where mapping should be created.
- Target
Network stringId The id of the recovery network.
- Target
Recovery stringFabric Name The Azure Site Recovery fabric object corresponding to the recovery Azure region.
- Name string
The name of the network mapping.
- Recovery
Vault stringName The name of the vault that should be updated.
- Resource
Group stringName Name of the resource group where the vault that should be updated is located.
- Source
Network stringId The id of the primary network.
- Source
Recovery stringFabric Name Specifies the ASR fabric where mapping should be created.
- Target
Network stringId The id of the recovery network.
- Target
Recovery stringFabric Name The Azure Site Recovery fabric object corresponding to the recovery Azure region.
- Name string
The name of the network mapping.
- recovery
Vault stringName The name of the vault that should be updated.
- resource
Group stringName Name of the resource group where the vault that should be updated is located.
- source
Network stringId The id of the primary network.
- source
Recovery stringFabric Name Specifies the ASR fabric where mapping should be created.
- target
Network stringId The id of the recovery network.
- target
Recovery stringFabric Name The Azure Site Recovery fabric object corresponding to the recovery Azure region.
- name string
The name of the network mapping.
- recovery_
vault_ strname The name of the vault that should be updated.
- resource_
group_ strname Name of the resource group where the vault that should be updated is located.
- source_
network_ strid The id of the primary network.
- source_
recovery_ strfabric_ name Specifies the ASR fabric where mapping should be created.
- target_
network_ strid The id of the recovery network.
- target_
recovery_ strfabric_ name The Azure Site Recovery fabric object corresponding to the recovery Azure region.
- name str
The name of the network mapping.
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkMapping resource produces the following output properties:
Look up an Existing NetworkMapping Resource
Get an existing NetworkMapping resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: NetworkMappingState, opts?: CustomResourceOptions): NetworkMappingstatic get(resource_name, id, opts=None, name=None, recovery_vault_name=None, resource_group_name=None, source_network_id=None, source_recovery_fabric_name=None, target_network_id=None, target_recovery_fabric_name=None, __props__=None);func GetNetworkMapping(ctx *Context, name string, id IDInput, state *NetworkMappingState, opts ...ResourceOption) (*NetworkMapping, error)public static NetworkMapping Get(string name, Input<string> id, NetworkMappingState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Name string
The name of the network mapping.
- Recovery
Vault stringName The name of the vault that should be updated.
- Resource
Group stringName Name of the resource group where the vault that should be updated is located.
- Source
Network stringId The id of the primary network.
- Source
Recovery stringFabric Name Specifies the ASR fabric where mapping should be created.
- Target
Network stringId The id of the recovery network.
- Target
Recovery stringFabric Name The Azure Site Recovery fabric object corresponding to the recovery Azure region.
- Name string
The name of the network mapping.
- Recovery
Vault stringName The name of the vault that should be updated.
- Resource
Group stringName Name of the resource group where the vault that should be updated is located.
- Source
Network stringId The id of the primary network.
- Source
Recovery stringFabric Name Specifies the ASR fabric where mapping should be created.
- Target
Network stringId The id of the recovery network.
- Target
Recovery stringFabric Name The Azure Site Recovery fabric object corresponding to the recovery Azure region.
- name string
The name of the network mapping.
- recovery
Vault stringName The name of the vault that should be updated.
- resource
Group stringName Name of the resource group where the vault that should be updated is located.
- source
Network stringId The id of the primary network.
- source
Recovery stringFabric Name Specifies the ASR fabric where mapping should be created.
- target
Network stringId The id of the recovery network.
- target
Recovery stringFabric Name The Azure Site Recovery fabric object corresponding to the recovery Azure region.
- name str
The name of the network mapping.
- recovery_
vault_ strname The name of the vault that should be updated.
- resource_
group_ strname Name of the resource group where the vault that should be updated is located.
- source_
network_ strid The id of the primary network.
- source_
recovery_ strfabric_ name Specifies the ASR fabric where mapping should be created.
- target_
network_ strid The id of the recovery network.
- target_
recovery_ strfabric_ name The Azure Site Recovery fabric object corresponding to the recovery Azure region.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.