1. Packages
  2. Azure Native
  3. API Docs
  4. network
  5. VirtualNetworkPeering
Azure Native v1.103.0 published on Friday, Jun 2, 2023 by Pulumi

azure-native.network.VirtualNetworkPeering

Explore with Pulumi AI

azure-native logo
Azure Native v1.103.0 published on Friday, Jun 2, 2023 by Pulumi

    Peerings in a virtual network resource. API Version: 2020-11-01.

    Example Usage

    Create peering

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureNative = Pulumi.AzureNative;
    
    return await Deployment.RunAsync(() => 
    {
        var virtualNetworkPeering = new AzureNative.Network.VirtualNetworkPeering("virtualNetworkPeering", new()
        {
            AllowForwardedTraffic = true,
            AllowGatewayTransit = false,
            AllowVirtualNetworkAccess = true,
            RemoteVirtualNetwork = new AzureNative.Network.Inputs.SubResourceArgs
            {
                Id = "/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2",
            },
            ResourceGroupName = "peerTest",
            UseRemoteGateways = false,
            VirtualNetworkName = "vnet1",
            VirtualNetworkPeeringName = "peer",
        });
    
    });
    
    package main
    
    import (
    	network "github.com/pulumi/pulumi-azure-native-sdk/network"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := network.NewVirtualNetworkPeering(ctx, "virtualNetworkPeering", &network.VirtualNetworkPeeringArgs{
    			AllowForwardedTraffic:     pulumi.Bool(true),
    			AllowGatewayTransit:       pulumi.Bool(false),
    			AllowVirtualNetworkAccess: pulumi.Bool(true),
    			RemoteVirtualNetwork: &network.SubResourceArgs{
    				Id: pulumi.String("/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"),
    			},
    			ResourceGroupName:         pulumi.String("peerTest"),
    			UseRemoteGateways:         pulumi.Bool(false),
    			VirtualNetworkName:        pulumi.String("vnet1"),
    			VirtualNetworkPeeringName: pulumi.String("peer"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azurenative.network.VirtualNetworkPeering;
    import com.pulumi.azurenative.network.VirtualNetworkPeeringArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var virtualNetworkPeering = new VirtualNetworkPeering("virtualNetworkPeering", VirtualNetworkPeeringArgs.builder()        
                .allowForwardedTraffic(true)
                .allowGatewayTransit(false)
                .allowVirtualNetworkAccess(true)
                .remoteVirtualNetwork(Map.of("id", "/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2"))
                .resourceGroupName("peerTest")
                .useRemoteGateways(false)
                .virtualNetworkName("vnet1")
                .virtualNetworkPeeringName("peer")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_azure_native as azure_native
    
    virtual_network_peering = azure_native.network.VirtualNetworkPeering("virtualNetworkPeering",
        allow_forwarded_traffic=True,
        allow_gateway_transit=False,
        allow_virtual_network_access=True,
        remote_virtual_network=azure_native.network.SubResourceArgs(
            id="/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2",
        ),
        resource_group_name="peerTest",
        use_remote_gateways=False,
        virtual_network_name="vnet1",
        virtual_network_peering_name="peer")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azure_native from "@pulumi/azure-native";
    
    const virtualNetworkPeering = new azure_native.network.VirtualNetworkPeering("virtualNetworkPeering", {
        allowForwardedTraffic: true,
        allowGatewayTransit: false,
        allowVirtualNetworkAccess: true,
        remoteVirtualNetwork: {
            id: "/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2",
        },
        resourceGroupName: "peerTest",
        useRemoteGateways: false,
        virtualNetworkName: "vnet1",
        virtualNetworkPeeringName: "peer",
    });
    
    resources:
      virtualNetworkPeering:
        type: azure-native:network:VirtualNetworkPeering
        properties:
          allowForwardedTraffic: true
          allowGatewayTransit: false
          allowVirtualNetworkAccess: true
          remoteVirtualNetwork:
            id: /subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2
          resourceGroupName: peerTest
          useRemoteGateways: false
          virtualNetworkName: vnet1
          virtualNetworkPeeringName: peer
    

    Create VirtualNetworkPeering Resource

    new VirtualNetworkPeering(name: string, args: VirtualNetworkPeeringArgs, opts?: CustomResourceOptions);
    @overload
    def VirtualNetworkPeering(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              allow_forwarded_traffic: Optional[bool] = None,
                              allow_gateway_transit: Optional[bool] = None,
                              allow_virtual_network_access: Optional[bool] = None,
                              do_not_verify_remote_gateways: Optional[bool] = None,
                              id: Optional[str] = None,
                              name: Optional[str] = None,
                              peering_state: Optional[Union[str, VirtualNetworkPeeringState]] = None,
                              remote_address_space: Optional[AddressSpaceArgs] = None,
                              remote_bgp_communities: Optional[VirtualNetworkBgpCommunitiesArgs] = None,
                              remote_virtual_network: Optional[SubResourceArgs] = None,
                              resource_group_name: Optional[str] = None,
                              type: Optional[str] = None,
                              use_remote_gateways: Optional[bool] = None,
                              virtual_network_name: Optional[str] = None,
                              virtual_network_peering_name: Optional[str] = None)
    @overload
    def VirtualNetworkPeering(resource_name: str,
                              args: VirtualNetworkPeeringInitArgs,
                              opts: Optional[ResourceOptions] = None)
    func NewVirtualNetworkPeering(ctx *Context, name string, args VirtualNetworkPeeringArgs, opts ...ResourceOption) (*VirtualNetworkPeering, error)
    public VirtualNetworkPeering(string name, VirtualNetworkPeeringArgs args, CustomResourceOptions? opts = null)
    public VirtualNetworkPeering(String name, VirtualNetworkPeeringArgs args)
    public VirtualNetworkPeering(String name, VirtualNetworkPeeringArgs args, CustomResourceOptions options)
    
    type: azure-native:network:VirtualNetworkPeering
    properties: # The arguments to resource properties.
    options: # 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.
    resource_name str
    The unique name of the resource.
    args VirtualNetworkPeeringInitArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control 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.
    name String
    The unique name of the resource.
    args VirtualNetworkPeeringArgs
    The arguments to resource properties.
    options 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 Architecture and Concepts docs.

    Inputs

    The VirtualNetworkPeering resource accepts the following input properties:

    ResourceGroupName string

    The name of the resource group.

    VirtualNetworkName string

    The name of the virtual network.

    AllowForwardedTraffic bool

    Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network.

    AllowGatewayTransit bool

    If gateway links can be used in remote virtual networking to link to this virtual network.

    AllowVirtualNetworkAccess bool

    Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space.

    DoNotVerifyRemoteGateways bool

    If we need to verify the provisioning state of the remote gateway.

    Id string

    Resource ID.

    Name string

    The name of the resource that is unique within a resource group. This name can be used to access the resource.

    PeeringState string | Pulumi.AzureNative.Network.VirtualNetworkPeeringState

    The status of the virtual network peering.

    RemoteAddressSpace Pulumi.AzureNative.Network.Inputs.AddressSpaceArgs

    The reference to the remote virtual network address space.

    RemoteBgpCommunities Pulumi.AzureNative.Network.Inputs.VirtualNetworkBgpCommunitiesArgs

    The reference to the remote virtual network's Bgp Communities.

    RemoteVirtualNetwork Pulumi.AzureNative.Network.Inputs.SubResourceArgs

    The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). See here to register for the preview and learn more (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering).

    Type string

    Resource type.

    UseRemoteGateways bool

    If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on 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.

    VirtualNetworkPeeringName string

    The name of the peering.

    ResourceGroupName string

    The name of the resource group.

    VirtualNetworkName string

    The name of the virtual network.

    AllowForwardedTraffic bool

    Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network.

    AllowGatewayTransit bool

    If gateway links can be used in remote virtual networking to link to this virtual network.

    AllowVirtualNetworkAccess bool

    Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space.

    DoNotVerifyRemoteGateways bool

    If we need to verify the provisioning state of the remote gateway.

    Id string

    Resource ID.

    Name string

    The name of the resource that is unique within a resource group. This name can be used to access the resource.

    PeeringState string | VirtualNetworkPeeringStateEnum

    The status of the virtual network peering.

    RemoteAddressSpace AddressSpaceArgs

    The reference to the remote virtual network address space.

    RemoteBgpCommunities VirtualNetworkBgpCommunitiesArgs

    The reference to the remote virtual network's Bgp Communities.

    RemoteVirtualNetwork SubResourceArgs

    The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). See here to register for the preview and learn more (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering).

    Type string

    Resource type.

    UseRemoteGateways bool

    If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on 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.

    VirtualNetworkPeeringName string

    The name of the peering.

    resourceGroupName String

    The name of the resource group.

    virtualNetworkName String

    The name of the virtual network.

    allowForwardedTraffic Boolean

    Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network.

    allowGatewayTransit Boolean

    If gateway links can be used in remote virtual networking to link to this virtual network.

    allowVirtualNetworkAccess Boolean

    Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space.

    doNotVerifyRemoteGateways Boolean

    If we need to verify the provisioning state of the remote gateway.

    id String

    Resource ID.

    name String

    The name of the resource that is unique within a resource group. This name can be used to access the resource.

    peeringState String | VirtualNetworkPeeringState

    The status of the virtual network peering.

    remoteAddressSpace AddressSpaceArgs

    The reference to the remote virtual network address space.

    remoteBgpCommunities VirtualNetworkBgpCommunitiesArgs

    The reference to the remote virtual network's Bgp Communities.

    remoteVirtualNetwork SubResourceArgs

    The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). See here to register for the preview and learn more (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering).

    type String

    Resource type.

    useRemoteGateways Boolean

    If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on 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.

    virtualNetworkPeeringName String

    The name of the peering.

    resourceGroupName string

    The name of the resource group.

    virtualNetworkName string

    The name of the virtual network.

    allowForwardedTraffic boolean

    Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network.

    allowGatewayTransit boolean

    If gateway links can be used in remote virtual networking to link to this virtual network.

    allowVirtualNetworkAccess boolean

    Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space.

    doNotVerifyRemoteGateways boolean

    If we need to verify the provisioning state of the remote gateway.

    id string

    Resource ID.

    name string

    The name of the resource that is unique within a resource group. This name can be used to access the resource.

    peeringState string | VirtualNetworkPeeringState

    The status of the virtual network peering.

    remoteAddressSpace AddressSpaceArgs

    The reference to the remote virtual network address space.

    remoteBgpCommunities VirtualNetworkBgpCommunitiesArgs

    The reference to the remote virtual network's Bgp Communities.

    remoteVirtualNetwork SubResourceArgs

    The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). See here to register for the preview and learn more (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering).

    type string

    Resource type.

    useRemoteGateways boolean

    If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on 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.

    virtualNetworkPeeringName string

    The name of the peering.

    resource_group_name str

    The name of the resource group.

    virtual_network_name str

    The name of the virtual network.

    allow_forwarded_traffic bool

    Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network.

    allow_gateway_transit bool

    If gateway links can be used in remote virtual networking to link to this virtual network.

    allow_virtual_network_access bool

    Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space.

    do_not_verify_remote_gateways bool

    If we need to verify the provisioning state of the remote gateway.

    id str

    Resource ID.

    name str

    The name of the resource that is unique within a resource group. This name can be used to access the resource.

    peering_state str | VirtualNetworkPeeringState

    The status of the virtual network peering.

    remote_address_space AddressSpaceArgs

    The reference to the remote virtual network address space.

    remote_bgp_communities VirtualNetworkBgpCommunitiesArgs

    The reference to the remote virtual network's Bgp Communities.

    remote_virtual_network SubResourceArgs

    The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). See here to register for the preview and learn more (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering).

    type str

    Resource type.

    use_remote_gateways bool

    If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on 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.

    virtual_network_peering_name str

    The name of the peering.

    resourceGroupName String

    The name of the resource group.

    virtualNetworkName String

    The name of the virtual network.

    allowForwardedTraffic Boolean

    Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network.

    allowGatewayTransit Boolean

    If gateway links can be used in remote virtual networking to link to this virtual network.

    allowVirtualNetworkAccess Boolean

    Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space.

    doNotVerifyRemoteGateways Boolean

    If we need to verify the provisioning state of the remote gateway.

    id String

    Resource ID.

    name String

    The name of the resource that is unique within a resource group. This name can be used to access the resource.

    peeringState String | "Initiated" | "Connected" | "Disconnected"

    The status of the virtual network peering.

    remoteAddressSpace Property Map

    The reference to the remote virtual network address space.

    remoteBgpCommunities Property Map

    The reference to the remote virtual network's Bgp Communities.

    remoteVirtualNetwork Property Map

    The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). See here to register for the preview and learn more (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering).

    type String

    Resource type.

    useRemoteGateways Boolean

    If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on 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.

    virtualNetworkPeeringName String

    The name of the peering.

    Outputs

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

    Etag string

    A unique read-only string that changes whenever the resource is updated.

    Id string

    The provider-assigned unique ID for this managed resource.

    ProvisioningState string

    The provisioning state of the virtual network peering resource.

    ResourceGuid string

    The resourceGuid property of the Virtual Network peering resource.

    Etag string

    A unique read-only string that changes whenever the resource is updated.

    Id string

    The provider-assigned unique ID for this managed resource.

    ProvisioningState string

    The provisioning state of the virtual network peering resource.

    ResourceGuid string

    The resourceGuid property of the Virtual Network peering resource.

    etag String

    A unique read-only string that changes whenever the resource is updated.

    id String

    The provider-assigned unique ID for this managed resource.

    provisioningState String

    The provisioning state of the virtual network peering resource.

    resourceGuid String

    The resourceGuid property of the Virtual Network peering resource.

    etag string

    A unique read-only string that changes whenever the resource is updated.

    id string

    The provider-assigned unique ID for this managed resource.

    provisioningState string

    The provisioning state of the virtual network peering resource.

    resourceGuid string

    The resourceGuid property of the Virtual Network peering resource.

    etag str

    A unique read-only string that changes whenever the resource is updated.

    id str

    The provider-assigned unique ID for this managed resource.

    provisioning_state str

    The provisioning state of the virtual network peering resource.

    resource_guid str

    The resourceGuid property of the Virtual Network peering resource.

    etag String

    A unique read-only string that changes whenever the resource is updated.

    id String

    The provider-assigned unique ID for this managed resource.

    provisioningState String

    The provisioning state of the virtual network peering resource.

    resourceGuid String

    The resourceGuid property of the Virtual Network peering resource.

    Supporting Types

    AddressSpace

    AddressPrefixes List<string>

    A list of address blocks reserved for this virtual network in CIDR notation.

    AddressPrefixes []string

    A list of address blocks reserved for this virtual network in CIDR notation.

    addressPrefixes List<String>

    A list of address blocks reserved for this virtual network in CIDR notation.

    addressPrefixes string[]

    A list of address blocks reserved for this virtual network in CIDR notation.

    address_prefixes Sequence[str]

    A list of address blocks reserved for this virtual network in CIDR notation.

    addressPrefixes List<String>

    A list of address blocks reserved for this virtual network in CIDR notation.

    AddressSpaceResponse

    AddressPrefixes List<string>

    A list of address blocks reserved for this virtual network in CIDR notation.

    AddressPrefixes []string

    A list of address blocks reserved for this virtual network in CIDR notation.

    addressPrefixes List<String>

    A list of address blocks reserved for this virtual network in CIDR notation.

    addressPrefixes string[]

    A list of address blocks reserved for this virtual network in CIDR notation.

    address_prefixes Sequence[str]

    A list of address blocks reserved for this virtual network in CIDR notation.

    addressPrefixes List<String>

    A list of address blocks reserved for this virtual network in CIDR notation.

    SubResource

    Id string

    Resource Id.

    Id string

    Resource Id.

    id String

    Resource Id.

    id string

    Resource Id.

    id str

    Resource Id.

    id String

    Resource Id.

    SubResourceResponse

    Id string

    Resource ID.

    Id string

    Resource ID.

    id String

    Resource ID.

    id string

    Resource ID.

    id str

    Resource ID.

    id String

    Resource ID.

    VirtualNetworkBgpCommunities

    VirtualNetworkCommunity string

    The BGP community associated with the virtual network.

    VirtualNetworkCommunity string

    The BGP community associated with the virtual network.

    virtualNetworkCommunity String

    The BGP community associated with the virtual network.

    virtualNetworkCommunity string

    The BGP community associated with the virtual network.

    virtual_network_community str

    The BGP community associated with the virtual network.

    virtualNetworkCommunity String

    The BGP community associated with the virtual network.

    VirtualNetworkBgpCommunitiesResponse

    RegionalCommunity string

    The BGP community associated with the region of the virtual network.

    VirtualNetworkCommunity string

    The BGP community associated with the virtual network.

    RegionalCommunity string

    The BGP community associated with the region of the virtual network.

    VirtualNetworkCommunity string

    The BGP community associated with the virtual network.

    regionalCommunity String

    The BGP community associated with the region of the virtual network.

    virtualNetworkCommunity String

    The BGP community associated with the virtual network.

    regionalCommunity string

    The BGP community associated with the region of the virtual network.

    virtualNetworkCommunity string

    The BGP community associated with the virtual network.

    regional_community str

    The BGP community associated with the region of the virtual network.

    virtual_network_community str

    The BGP community associated with the virtual network.

    regionalCommunity String

    The BGP community associated with the region of the virtual network.

    virtualNetworkCommunity String

    The BGP community associated with the virtual network.

    VirtualNetworkPeeringState

    Initiated
    Initiated
    Connected
    Connected
    Disconnected
    Disconnected
    VirtualNetworkPeeringStateInitiated
    Initiated
    VirtualNetworkPeeringStateConnected
    Connected
    VirtualNetworkPeeringStateDisconnected
    Disconnected
    Initiated
    Initiated
    Connected
    Connected
    Disconnected
    Disconnected
    Initiated
    Initiated
    Connected
    Connected
    Disconnected
    Disconnected
    INITIATED
    Initiated
    CONNECTED
    Connected
    DISCONNECTED
    Disconnected
    "Initiated"
    Initiated
    "Connected"
    Connected
    "Disconnected"
    Disconnected

    Import

    An existing resource can be imported using its type token, name, and identifier, e.g.

    $ pulumi import azure-native:network:VirtualNetworkPeering peer /subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet1/virtualNetworkPeerings/peer 
    

    Package Details

    Repository
    Azure Native pulumi/pulumi-azure-native
    License
    Apache-2.0
    azure-native logo
    Azure Native v1.103.0 published on Friday, Jun 2, 2023 by Pulumi