VirtualNetworkPeering

Manages a virtual network peering which allows resources to access other resources in the linked virtual network.

Note

Virtual Network peerings cannot be created, updated or deleted concurrently.

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var example = new Azure.Core.ResourceGroup("example", new Azure.Core.ResourceGroupArgs
        {
            Location = "West US",
        });
        var example_1VirtualNetwork = new Azure.Network.VirtualNetwork("example-1VirtualNetwork", new Azure.Network.VirtualNetworkArgs
        {
            ResourceGroupName = example.Name,
            AddressSpaces = 
            {
                "10.0.1.0/24",
            },
            Location = "West US",
        });
        var example_2VirtualNetwork = new Azure.Network.VirtualNetwork("example-2VirtualNetwork", new Azure.Network.VirtualNetworkArgs
        {
            ResourceGroupName = example.Name,
            AddressSpaces = 
            {
                "10.0.2.0/24",
            },
            Location = "West US",
        });
        var example_1VirtualNetworkPeering = new Azure.Network.VirtualNetworkPeering("example-1VirtualNetworkPeering", new Azure.Network.VirtualNetworkPeeringArgs
        {
            ResourceGroupName = example.Name,
            VirtualNetworkName = example_1VirtualNetwork.Name,
            RemoteVirtualNetworkId = example_2VirtualNetwork.Id,
        });
        var example_2VirtualNetworkPeering = new Azure.Network.VirtualNetworkPeering("example-2VirtualNetworkPeering", new Azure.Network.VirtualNetworkPeeringArgs
        {
            ResourceGroupName = example.Name,
            VirtualNetworkName = example_2VirtualNetwork.Name,
            RemoteVirtualNetworkId = example_1VirtualNetwork.Id,
        });
    }

}

Coming soon!

import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example", location="West US")
example_1_virtual_network = azure.network.VirtualNetwork("example-1VirtualNetwork",
    resource_group_name=example.name,
    address_spaces=["10.0.1.0/24"],
    location="West US")
example_2_virtual_network = azure.network.VirtualNetwork("example-2VirtualNetwork",
    resource_group_name=example.name,
    address_spaces=["10.0.2.0/24"],
    location="West US")
example_1_virtual_network_peering = azure.network.VirtualNetworkPeering("example-1VirtualNetworkPeering",
    resource_group_name=example.name,
    virtual_network_name=example_1_virtual_network.name,
    remote_virtual_network_id=example_2_virtual_network.id)
example_2_virtual_network_peering = azure.network.VirtualNetworkPeering("example-2VirtualNetworkPeering",
    resource_group_name=example.name,
    virtual_network_name=example_2_virtual_network.name,
    remote_virtual_network_id=example_1_virtual_network.id)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {location: "West US"});
const example_1VirtualNetwork = new azure.network.VirtualNetwork("example-1VirtualNetwork", {
    resourceGroupName: example.name,
    addressSpaces: ["10.0.1.0/24"],
    location: "West US",
});
const example_2VirtualNetwork = new azure.network.VirtualNetwork("example-2VirtualNetwork", {
    resourceGroupName: example.name,
    addressSpaces: ["10.0.2.0/24"],
    location: "West US",
});
const example_1VirtualNetworkPeering = new azure.network.VirtualNetworkPeering("example-1VirtualNetworkPeering", {
    resourceGroupName: example.name,
    virtualNetworkName: example_1VirtualNetwork.name,
    remoteVirtualNetworkId: example_2VirtualNetwork.id,
});
const example_2VirtualNetworkPeering = new azure.network.VirtualNetworkPeering("example-2VirtualNetworkPeering", {
    resourceGroupName: example.name,
    virtualNetworkName: example_2VirtualNetwork.name,
    remoteVirtualNetworkId: example_1VirtualNetwork.id,
});

Create a VirtualNetworkPeering Resource

def VirtualNetworkPeering(resource_name, opts=None, allow_forwarded_traffic=None, allow_gateway_transit=None, allow_virtual_network_access=None, name=None, remote_virtual_network_id=None, resource_group_name=None, use_remote_gateways=None, virtual_network_name=None, __props__=None);
name string
The unique name of the resource.
args VirtualNetworkPeeringArgs
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 VirtualNetworkPeeringArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args VirtualNetworkPeeringArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

VirtualNetworkPeering Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The VirtualNetworkPeering resource accepts the following input properties:

RemoteVirtualNetworkId string

The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.

VirtualNetworkName string

The name of the virtual network. Changing this forces a new resource to be created.

AllowForwardedTraffic bool

Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.

AllowGatewayTransit bool

Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.

AllowVirtualNetworkAccess bool

Controls if the VMs in the remote virtual network can access VMs in the local virtual network. Defaults to true.

Name string

The name of the virtual network peering. Changing this forces a new resource to be created.

UseRemoteGateways bool

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

RemoteVirtualNetworkId string

The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.

VirtualNetworkName string

The name of the virtual network. Changing this forces a new resource to be created.

AllowForwardedTraffic bool

Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.

AllowGatewayTransit bool

Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.

AllowVirtualNetworkAccess bool

Controls if the VMs in the remote virtual network can access VMs in the local virtual network. Defaults to true.

Name string

The name of the virtual network peering. Changing this forces a new resource to be created.

UseRemoteGateways bool

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

remoteVirtualNetworkId string

The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.

virtualNetworkName string

The name of the virtual network. Changing this forces a new resource to be created.

allowForwardedTraffic boolean

Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.

allowGatewayTransit boolean

Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.

allowVirtualNetworkAccess boolean

Controls if the VMs in the remote virtual network can access VMs in the local virtual network. Defaults to true.

name string

The name of the virtual network peering. Changing this forces a new resource to be created.

useRemoteGateways boolean

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

remote_virtual_network_id str

The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.

virtual_network_name str

The name of the virtual network. Changing this forces a new resource to be created.

allow_forwarded_traffic bool

Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.

allow_gateway_transit bool

Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.

allow_virtual_network_access bool

Controls if the VMs in the remote virtual network can access VMs in the local virtual network. Defaults to true.

name str

The name of the virtual network peering. Changing this forces a new resource to be created.

use_remote_gateways bool

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

Outputs

All input properties are implicitly available as output properties. Additionally, the VirtualNetworkPeering resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing VirtualNetworkPeering Resource

Get an existing VirtualNetworkPeering resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

static get(resource_name, id, opts=None, allow_forwarded_traffic=None, allow_gateway_transit=None, allow_virtual_network_access=None, name=None, remote_virtual_network_id=None, resource_group_name=None, use_remote_gateways=None, virtual_network_name=None, __props__=None);
func GetVirtualNetworkPeering(ctx *Context, name string, id IDInput, state *VirtualNetworkPeeringState, opts ...ResourceOption) (*VirtualNetworkPeering, error)
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:

AllowForwardedTraffic bool

Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.

AllowGatewayTransit bool

Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.

AllowVirtualNetworkAccess bool

Controls if the VMs in the remote virtual network can access VMs in the local virtual network. Defaults to true.

Name string

The name of the virtual network peering. Changing this forces a new resource to be created.

RemoteVirtualNetworkId string

The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.

UseRemoteGateways bool

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

VirtualNetworkName string

The name of the virtual network. Changing this forces a new resource to be created.

AllowForwardedTraffic bool

Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.

AllowGatewayTransit bool

Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.

AllowVirtualNetworkAccess bool

Controls if the VMs in the remote virtual network can access VMs in the local virtual network. Defaults to true.

Name string

The name of the virtual network peering. Changing this forces a new resource to be created.

RemoteVirtualNetworkId string

The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.

UseRemoteGateways bool

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

VirtualNetworkName string

The name of the virtual network. Changing this forces a new resource to be created.

allowForwardedTraffic boolean

Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.

allowGatewayTransit boolean

Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.

allowVirtualNetworkAccess boolean

Controls if the VMs in the remote virtual network can access VMs in the local virtual network. Defaults to true.

name string

The name of the virtual network peering. Changing this forces a new resource to be created.

remoteVirtualNetworkId string

The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.

useRemoteGateways boolean

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

virtualNetworkName string

The name of the virtual network. Changing this forces a new resource to be created.

allow_forwarded_traffic bool

Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.

allow_gateway_transit bool

Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.

allow_virtual_network_access bool

Controls if the VMs in the remote virtual network can access VMs in the local virtual network. Defaults to true.

name str

The name of the virtual network peering. Changing this forces a new resource to be created.

remote_virtual_network_id str

The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.

use_remote_gateways bool

Controls if remote gateways can be used on the local virtual network. If the flag is set to true, and allow_gateway_transit on the remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. Defaults to false.

virtual_network_name str

The name of the virtual network. Changing this forces a new resource to be created.

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.