VirtualNetworkPeering

class VirtualNetworkPeering : KotlinCustomResource

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

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.network.VirtualNetworkPeering;
import com.pulumi.azure.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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var example_1VirtualNetwork = new VirtualNetwork("example-1VirtualNetwork", VirtualNetworkArgs.builder()
.resourceGroupName(example.name())
.addressSpaces("10.0.1.0/24")
.location(example.location())
.build());
var example_2VirtualNetwork = new VirtualNetwork("example-2VirtualNetwork", VirtualNetworkArgs.builder()
.resourceGroupName(example.name())
.addressSpaces("10.0.2.0/24")
.location(example.location())
.build());
var example_1VirtualNetworkPeering = new VirtualNetworkPeering("example-1VirtualNetworkPeering", VirtualNetworkPeeringArgs.builder()
.resourceGroupName(example.name())
.virtualNetworkName(example_1VirtualNetwork.name())
.remoteVirtualNetworkId(example_2VirtualNetwork.id())
.build());
var example_2VirtualNetworkPeering = new VirtualNetworkPeering("example-2VirtualNetworkPeering", VirtualNetworkPeeringArgs.builder()
.resourceGroupName(example.name())
.virtualNetworkName(example_2VirtualNetwork.name())
.remoteVirtualNetworkId(example_1VirtualNetwork.id())
.build());
}
}

Note

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

Import

Virtual Network Peerings can be imported using the resource id, e.g.

$ pulumi import azure:network/virtualNetworkPeering:VirtualNetworkPeering examplePeering /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/virtualNetworkPeerings/myvnet1peering

Properties

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val name: Output<String>

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

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard
val triggers: Output<Map<String, String>>?

A mapping of key values pairs that can be used to sync network routes from the remote virtual network to the local virtual network. See the trigger example for an example on how to set it up.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard

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.

Link copied to clipboard

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