Virtual Network Peering Args
data class VirtualNetworkPeeringArgs(val allowForwardedTraffic: Output<Boolean>? = null, val allowGatewayTransit: Output<Boolean>? = null, val allowVirtualNetworkAccess: Output<Boolean>? = null, val name: Output<String>? = null, val remoteVirtualNetworkId: Output<String>? = null, val resourceGroupName: Output<String>? = null, val triggers: Output<Map<String, String>>? = null, val useRemoteGateways: Output<Boolean>? = null, val virtualNetworkName: Output<String>? = null) : ConvertibleToJava<VirtualNetworkPeeringArgs>
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()
.name("peeredvnets-rg")
.location("West Europe")
.build());
var example_1 = new VirtualNetwork("example-1", VirtualNetworkArgs.builder()
.name("peternetwork1")
.resourceGroupName(example.name())
.addressSpaces("10.0.1.0/24")
.location(example.location())
.build());
var example_2 = new VirtualNetwork("example-2", VirtualNetworkArgs.builder()
.name("peternetwork2")
.resourceGroupName(example.name())
.addressSpaces("10.0.2.0/24")
.location(example.location())
.build());
var example_1VirtualNetworkPeering = new VirtualNetworkPeering("example-1VirtualNetworkPeering", VirtualNetworkPeeringArgs.builder()
.name("peer1to2")
.resourceGroupName(example.name())
.virtualNetworkName(example_1.name())
.remoteVirtualNetworkId(example_2.id())
.build());
var example_2VirtualNetworkPeering = new VirtualNetworkPeering("example-2VirtualNetworkPeering", VirtualNetworkPeeringArgs.builder()
.name("peer2to1")
.resourceGroupName(example.name())
.virtualNetworkName(example_2.name())
.remoteVirtualNetworkId(example_1.id())
.build());
}
}Content copied to clipboard
Triggers)
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()
.name("peeredvnets-rg")
.location("West Europe")
.build());
var example_1 = new VirtualNetwork("example-1", VirtualNetworkArgs.builder()
.name("peternetwork1")
.resourceGroupName(example.name())
.addressSpaces("10.0.1.0/24")
.location(example.location())
.build());
var example_2 = new VirtualNetwork("example-2", VirtualNetworkArgs.builder()
.name("peternetwork2")
.resourceGroupName(example.name())
.addressSpaces("10.0.2.0/24")
.location(example.location())
.build());
var example_1VirtualNetworkPeering = new VirtualNetworkPeering("example-1VirtualNetworkPeering", VirtualNetworkPeeringArgs.builder()
.name("peer1to2")
.resourceGroupName(example.name())
.virtualNetworkName(example_1.name())
.remoteVirtualNetworkId(example_2.id())
.triggers(Map.of("remote_address_space", StdFunctions.join().applyValue(invoke -> invoke.result())))
.build());
var example_2VirtualNetworkPeering = new VirtualNetworkPeering("example-2VirtualNetworkPeering", VirtualNetworkPeeringArgs.builder()
.name("peer2to1")
.resourceGroupName(example.name())
.virtualNetworkName(example_2.name())
.remoteVirtualNetworkId(example_1.id())
.triggers(Map.of("remote_address_space", StdFunctions.join().applyValue(invoke -> invoke.result())))
.build());
}
}Content copied to clipboard
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/myvnet1peeringContent copied to clipboard
Constructors
Link copied to clipboard
fun VirtualNetworkPeeringArgs(allowForwardedTraffic: Output<Boolean>? = null, allowGatewayTransit: Output<Boolean>? = null, allowVirtualNetworkAccess: Output<Boolean>? = null, name: Output<String>? = null, remoteVirtualNetworkId: Output<String>? = null, resourceGroupName: Output<String>? = null, triggers: Output<Map<String, String>>? = null, useRemoteGateways: Output<Boolean>? = null, virtualNetworkName: Output<String>? = null)
Functions
Properties
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.