Show / Hide Table of Contents

Class VirtualNetworkPeering

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

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,
    });
}

}

Note

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

Inheritance
System.Object
Resource
CustomResource
VirtualNetworkPeering
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Azure.Network
Assembly: Pulumi.Azure.dll
Syntax
public class VirtualNetworkPeering : CustomResource

Constructors

View Source

VirtualNetworkPeering(String, VirtualNetworkPeeringArgs, CustomResourceOptions)

Create a VirtualNetworkPeering resource with the given unique name, arguments, and options.

Declaration
public VirtualNetworkPeering(string name, VirtualNetworkPeeringArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

VirtualNetworkPeeringArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

AllowForwardedTraffic

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

Declaration
public Output<bool> AllowForwardedTraffic { get; }
Property Value
Type Description
Output<System.Boolean>
View Source

AllowGatewayTransit

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

Declaration
public Output<bool> AllowGatewayTransit { get; }
Property Value
Type Description
Output<System.Boolean>
View Source

AllowVirtualNetworkAccess

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

Declaration
public Output<bool?> AllowVirtualNetworkAccess { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Name

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

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

RemoteVirtualNetworkId

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

Declaration
public Output<string> RemoteVirtualNetworkId { get; }
Property Value
Type Description
Output<System.String>
View Source

ResourceGroupName

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

Declaration
public Output<string> ResourceGroupName { get; }
Property Value
Type Description
Output<System.String>
View Source

UseRemoteGateways

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.

Declaration
public Output<bool> UseRemoteGateways { get; }
Property Value
Type Description
Output<System.Boolean>
View Source

VirtualNetworkName

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

Declaration
public Output<string> VirtualNetworkName { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, VirtualNetworkPeeringState, CustomResourceOptions)

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

Declaration
public static VirtualNetworkPeering Get(string name, Input<string> id, VirtualNetworkPeeringState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

VirtualNetworkPeeringState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
VirtualNetworkPeering
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.