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
new VirtualNetworkPeering(name: string, args: VirtualNetworkPeeringArgs, opts?: CustomResourceOptions);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);func NewVirtualNetworkPeering(ctx *Context, name string, args VirtualNetworkPeeringArgs, opts ...ResourceOption) (*VirtualNetworkPeering, error)public VirtualNetworkPeering(string name, VirtualNetworkPeeringArgs args, CustomResourceOptions? opts = null)- 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:
- Remote
Virtual stringNetwork Id The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
- Resource
Group stringName 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 stringName The name of the virtual network. Changing this forces a new resource to be created.
- Allow
Forwarded boolTraffic Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
- Allow
Gateway boolTransit Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- Allow
Virtual boolNetwork Access 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.
- Use
Remote boolGateways Controls if remote gateways can be used on the local virtual network. If the flag is set to
true, andallow_gateway_transiton the remote peering is alsotrue, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set totrue. This flag cannot be set if virtual network already has a gateway. Defaults tofalse.
- Remote
Virtual stringNetwork Id The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
- Resource
Group stringName 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 stringName The name of the virtual network. Changing this forces a new resource to be created.
- Allow
Forwarded boolTraffic Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
- Allow
Gateway boolTransit Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- Allow
Virtual boolNetwork Access 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.
- Use
Remote boolGateways Controls if remote gateways can be used on the local virtual network. If the flag is set to
true, andallow_gateway_transiton the remote peering is alsotrue, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set totrue. This flag cannot be set if virtual network already has a gateway. Defaults tofalse.
- remote
Virtual stringNetwork Id The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
- resource
Group stringName 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 stringName The name of the virtual network. Changing this forces a new resource to be created.
- allow
Forwarded booleanTraffic Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
- allow
Gateway booleanTransit Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- allow
Virtual booleanNetwork Access 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.
- use
Remote booleanGateways Controls if remote gateways can be used on the local virtual network. If the flag is set to
true, andallow_gateway_transiton the remote peering is alsotrue, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set totrue. This flag cannot be set if virtual network already has a gateway. Defaults tofalse.
- remote_
virtual_ strnetwork_ id The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
- resource_
group_ strname 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_ strname The name of the virtual network. Changing this forces a new resource to be created.
- allow_
forwarded_ booltraffic Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
- allow_
gateway_ booltransit Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- allow_
virtual_ boolnetwork_ access 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_ boolgateways Controls if remote gateways can be used on the local virtual network. If the flag is set to
true, andallow_gateway_transiton the remote peering is alsotrue, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set totrue. This flag cannot be set if virtual network already has a gateway. Defaults tofalse.
Outputs
All input properties are implicitly available as output properties. Additionally, the VirtualNetworkPeering resource produces the following output properties:
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.
public static get(name: string, id: Input<ID>, state?: VirtualNetworkPeeringState, opts?: CustomResourceOptions): VirtualNetworkPeeringstatic 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)public static VirtualNetworkPeering Get(string name, Input<string> id, VirtualNetworkPeeringState? 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:
- Allow
Forwarded boolTraffic Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
- Allow
Gateway boolTransit Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- Allow
Virtual boolNetwork Access 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.
- Remote
Virtual stringNetwork Id The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
- Resource
Group stringName 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 boolGateways Controls if remote gateways can be used on the local virtual network. If the flag is set to
true, andallow_gateway_transiton the remote peering is alsotrue, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set totrue. This flag cannot be set if virtual network already has a gateway. Defaults tofalse.- Virtual
Network stringName The name of the virtual network. Changing this forces a new resource to be created.
- Allow
Forwarded boolTraffic Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
- Allow
Gateway boolTransit Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- Allow
Virtual boolNetwork Access 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.
- Remote
Virtual stringNetwork Id The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
- Resource
Group stringName 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 boolGateways Controls if remote gateways can be used on the local virtual network. If the flag is set to
true, andallow_gateway_transiton the remote peering is alsotrue, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set totrue. This flag cannot be set if virtual network already has a gateway. Defaults tofalse.- Virtual
Network stringName The name of the virtual network. Changing this forces a new resource to be created.
- allow
Forwarded booleanTraffic Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
- allow
Gateway booleanTransit Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- allow
Virtual booleanNetwork Access 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.
- remote
Virtual stringNetwork Id The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
- resource
Group stringName 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 booleanGateways Controls if remote gateways can be used on the local virtual network. If the flag is set to
true, andallow_gateway_transiton the remote peering is alsotrue, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set totrue. This flag cannot be set if virtual network already has a gateway. Defaults tofalse.- virtual
Network stringName The name of the virtual network. Changing this forces a new resource to be created.
- allow_
forwarded_ booltraffic Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false.
- allow_
gateway_ booltransit Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network.
- allow_
virtual_ boolnetwork_ access 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_ strnetwork_ id The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
- resource_
group_ strname 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_ boolgateways Controls if remote gateways can be used on the local virtual network. If the flag is set to
true, andallow_gateway_transiton the remote peering is alsotrue, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set totrue. This flag cannot be set if virtual network already has a gateway. Defaults tofalse.- virtual_
network_ strname 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
azurermTerraform Provider.