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.
Inherited Members
Namespace: Pulumi.Azure.Network
Assembly: Pulumi.Azure.dll
Syntax
public class VirtualNetworkPeering : CustomResource
Constructors
View SourceVirtualNetworkPeering(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 SourceAllowForwardedTraffic
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> |
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> |
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>> |
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> |
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> |
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> |
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> |
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 SourceGet(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 |