All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.network.kotlin.VirtualNetworkPeering.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.network.kotlin

import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map

/**
 * Builder for [VirtualNetworkPeering].
 */
@PulumiTagMarker
public class VirtualNetworkPeeringResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: VirtualNetworkPeeringArgs = VirtualNetworkPeeringArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend VirtualNetworkPeeringArgsBuilder.() -> Unit) {
        val builder = VirtualNetworkPeeringArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): VirtualNetworkPeering {
        val builtJavaResource = com.pulumi.azure.network.VirtualNetworkPeering(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return VirtualNetworkPeering(builtJavaResource)
    }
}

/**
 * Manages a virtual network peering which allows resources to access other
 * resources in the linked virtual network.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "peeredvnets-rg",
 *     location: "West Europe",
 * });
 * const example_1 = new azure.network.VirtualNetwork("example-1", {
 *     name: "peternetwork1",
 *     resourceGroupName: example.name,
 *     addressSpaces: ["10.0.1.0/24"],
 *     location: example.location,
 * });
 * const example_2 = new azure.network.VirtualNetwork("example-2", {
 *     name: "peternetwork2",
 *     resourceGroupName: example.name,
 *     addressSpaces: ["10.0.2.0/24"],
 *     location: example.location,
 * });
 * const example_1VirtualNetworkPeering = new azure.network.VirtualNetworkPeering("example-1", {
 *     name: "peer1to2",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: example_1.name,
 *     remoteVirtualNetworkId: example_2.id,
 * });
 * const example_2VirtualNetworkPeering = new azure.network.VirtualNetworkPeering("example-2", {
 *     name: "peer2to1",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: example_2.name,
 *     remoteVirtualNetworkId: example_1.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="peeredvnets-rg",
 *     location="West Europe")
 * example_1 = azure.network.VirtualNetwork("example-1",
 *     name="peternetwork1",
 *     resource_group_name=example.name,
 *     address_spaces=["10.0.1.0/24"],
 *     location=example.location)
 * example_2 = azure.network.VirtualNetwork("example-2",
 *     name="peternetwork2",
 *     resource_group_name=example.name,
 *     address_spaces=["10.0.2.0/24"],
 *     location=example.location)
 * example_1_virtual_network_peering = azure.network.VirtualNetworkPeering("example-1",
 *     name="peer1to2",
 *     resource_group_name=example.name,
 *     virtual_network_name=example_1.name,
 *     remote_virtual_network_id=example_2.id)
 * example_2_virtual_network_peering = azure.network.VirtualNetworkPeering("example-2",
 *     name="peer2to1",
 *     resource_group_name=example.name,
 *     virtual_network_name=example_2.name,
 *     remote_virtual_network_id=example_1.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "peeredvnets-rg",
 *         Location = "West Europe",
 *     });
 *     var example_1 = new Azure.Network.VirtualNetwork("example-1", new()
 *     {
 *         Name = "peternetwork1",
 *         ResourceGroupName = example.Name,
 *         AddressSpaces = new[]
 *         {
 *             "10.0.1.0/24",
 *         },
 *         Location = example.Location,
 *     });
 *     var example_2 = new Azure.Network.VirtualNetwork("example-2", new()
 *     {
 *         Name = "peternetwork2",
 *         ResourceGroupName = example.Name,
 *         AddressSpaces = new[]
 *         {
 *             "10.0.2.0/24",
 *         },
 *         Location = example.Location,
 *     });
 *     var example_1VirtualNetworkPeering = new Azure.Network.VirtualNetworkPeering("example-1", new()
 *     {
 *         Name = "peer1to2",
 *         ResourceGroupName = example.Name,
 *         VirtualNetworkName = example_1.Name,
 *         RemoteVirtualNetworkId = example_2.Id,
 *     });
 *     var example_2VirtualNetworkPeering = new Azure.Network.VirtualNetworkPeering("example-2", new()
 *     {
 *         Name = "peer2to1",
 *         ResourceGroupName = example.Name,
 *         VirtualNetworkName = example_2.Name,
 *         RemoteVirtualNetworkId = example_1.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("peeredvnets-rg"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewVirtualNetwork(ctx, "example-1", &network.VirtualNetworkArgs{
 * 			Name:              pulumi.String("peternetwork1"),
 * 			ResourceGroupName: example.Name,
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.0.1.0/24"),
 * 			},
 * 			Location: example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewVirtualNetwork(ctx, "example-2", &network.VirtualNetworkArgs{
 * 			Name:              pulumi.String("peternetwork2"),
 * 			ResourceGroupName: example.Name,
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.0.2.0/24"),
 * 			},
 * 			Location: example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewVirtualNetworkPeering(ctx, "example-1", &network.VirtualNetworkPeeringArgs{
 * 			Name:                   pulumi.String("peer1to2"),
 * 			ResourceGroupName:      example.Name,
 * 			VirtualNetworkName:     example_1.Name,
 * 			RemoteVirtualNetworkId: example_2.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewVirtualNetworkPeering(ctx, "example-2", &network.VirtualNetworkPeeringArgs{
 * 			Name:                   pulumi.String("peer2to1"),
 * 			ResourceGroupName:      example.Name,
 * 			VirtualNetworkName:     example_2.Name,
 * 			RemoteVirtualNetworkId: example_1.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * 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());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: peeredvnets-rg
 *       location: West Europe
 *   example-1:
 *     type: azure:network:VirtualNetwork
 *     properties:
 *       name: peternetwork1
 *       resourceGroupName: ${example.name}
 *       addressSpaces:
 *         - 10.0.1.0/24
 *       location: ${example.location}
 *   example-2:
 *     type: azure:network:VirtualNetwork
 *     properties:
 *       name: peternetwork2
 *       resourceGroupName: ${example.name}
 *       addressSpaces:
 *         - 10.0.2.0/24
 *       location: ${example.location}
 *   example-1VirtualNetworkPeering:
 *     type: azure:network:VirtualNetworkPeering
 *     name: example-1
 *     properties:
 *       name: peer1to2
 *       resourceGroupName: ${example.name}
 *       virtualNetworkName: ${["example-1"].name}
 *       remoteVirtualNetworkId: ${["example-2"].id}
 *   example-2VirtualNetworkPeering:
 *     type: azure:network:VirtualNetworkPeering
 *     name: example-2
 *     properties:
 *       name: peer2to1
 *       resourceGroupName: ${example.name}
 *       virtualNetworkName: ${["example-2"].name}
 *       remoteVirtualNetworkId: ${["example-1"].id}
 * ```
 * 
 * ### Triggers)
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as std from "@pulumi/std";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "peeredvnets-rg",
 *     location: "West Europe",
 * });
 * const example_1 = new azure.network.VirtualNetwork("example-1", {
 *     name: "peternetwork1",
 *     resourceGroupName: example.name,
 *     addressSpaces: ["10.0.1.0/24"],
 *     location: example.location,
 * });
 * const example_2 = new azure.network.VirtualNetwork("example-2", {
 *     name: "peternetwork2",
 *     resourceGroupName: example.name,
 *     addressSpaces: ["10.0.2.0/24"],
 *     location: example.location,
 * });
 * const example_1VirtualNetworkPeering = new azure.network.VirtualNetworkPeering("example-1", {
 *     name: "peer1to2",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: example_1.name,
 *     remoteVirtualNetworkId: example_2.id,
 *     triggers: {
 *         remote_address_space: std.joinOutput({
 *             separator: ",",
 *             input: example_2.addressSpaces,
 *         }).apply(invoke => invoke.result),
 *     },
 * });
 * const example_2VirtualNetworkPeering = new azure.network.VirtualNetworkPeering("example-2", {
 *     name: "peer2to1",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: example_2.name,
 *     remoteVirtualNetworkId: example_1.id,
 *     triggers: {
 *         remote_address_space: std.joinOutput({
 *             separator: ",",
 *             input: example_1.addressSpaces,
 *         }).apply(invoke => invoke.result),
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * import pulumi_std as std
 * example = azure.core.ResourceGroup("example",
 *     name="peeredvnets-rg",
 *     location="West Europe")
 * example_1 = azure.network.VirtualNetwork("example-1",
 *     name="peternetwork1",
 *     resource_group_name=example.name,
 *     address_spaces=["10.0.1.0/24"],
 *     location=example.location)
 * example_2 = azure.network.VirtualNetwork("example-2",
 *     name="peternetwork2",
 *     resource_group_name=example.name,
 *     address_spaces=["10.0.2.0/24"],
 *     location=example.location)
 * example_1_virtual_network_peering = azure.network.VirtualNetworkPeering("example-1",
 *     name="peer1to2",
 *     resource_group_name=example.name,
 *     virtual_network_name=example_1.name,
 *     remote_virtual_network_id=example_2.id,
 *     triggers={
 *         "remote_address_space": std.join_output(separator=",",
 *             input=example_2.address_spaces).apply(lambda invoke: invoke.result),
 *     })
 * example_2_virtual_network_peering = azure.network.VirtualNetworkPeering("example-2",
 *     name="peer2to1",
 *     resource_group_name=example.name,
 *     virtual_network_name=example_2.name,
 *     remote_virtual_network_id=example_1.id,
 *     triggers={
 *         "remote_address_space": std.join_output(separator=",",
 *             input=example_1.address_spaces).apply(lambda invoke: invoke.result),
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "peeredvnets-rg",
 *         Location = "West Europe",
 *     });
 *     var example_1 = new Azure.Network.VirtualNetwork("example-1", new()
 *     {
 *         Name = "peternetwork1",
 *         ResourceGroupName = example.Name,
 *         AddressSpaces = new[]
 *         {
 *             "10.0.1.0/24",
 *         },
 *         Location = example.Location,
 *     });
 *     var example_2 = new Azure.Network.VirtualNetwork("example-2", new()
 *     {
 *         Name = "peternetwork2",
 *         ResourceGroupName = example.Name,
 *         AddressSpaces = new[]
 *         {
 *             "10.0.2.0/24",
 *         },
 *         Location = example.Location,
 *     });
 *     var example_1VirtualNetworkPeering = new Azure.Network.VirtualNetworkPeering("example-1", new()
 *     {
 *         Name = "peer1to2",
 *         ResourceGroupName = example.Name,
 *         VirtualNetworkName = example_1.Name,
 *         RemoteVirtualNetworkId = example_2.Id,
 *         Triggers =
 *         {
 *             { "remote_address_space", Std.Join.Invoke(new()
 *             {
 *                 Separator = ",",
 *                 Input = example_2.AddressSpaces,
 *             }).Apply(invoke => invoke.Result) },
 *         },
 *     });
 *     var example_2VirtualNetworkPeering = new Azure.Network.VirtualNetworkPeering("example-2", new()
 *     {
 *         Name = "peer2to1",
 *         ResourceGroupName = example.Name,
 *         VirtualNetworkName = example_2.Name,
 *         RemoteVirtualNetworkId = example_1.Id,
 *         Triggers =
 *         {
 *             { "remote_address_space", Std.Join.Invoke(new()
 *             {
 *                 Separator = ",",
 *                 Input = example_1.AddressSpaces,
 *             }).Apply(invoke => invoke.Result) },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
 * 	"github.com/pulumi/pulumi-std/sdk/go/std"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("peeredvnets-rg"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewVirtualNetwork(ctx, "example-1", &network.VirtualNetworkArgs{
 * 			Name:              pulumi.String("peternetwork1"),
 * 			ResourceGroupName: example.Name,
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.0.1.0/24"),
 * 			},
 * 			Location: example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewVirtualNetwork(ctx, "example-2", &network.VirtualNetworkArgs{
 * 			Name:              pulumi.String("peternetwork2"),
 * 			ResourceGroupName: example.Name,
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.0.2.0/24"),
 * 			},
 * 			Location: example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewVirtualNetworkPeering(ctx, "example-1", &network.VirtualNetworkPeeringArgs{
 * 			Name:                   pulumi.String("peer1to2"),
 * 			ResourceGroupName:      example.Name,
 * 			VirtualNetworkName:     example_1.Name,
 * 			RemoteVirtualNetworkId: example_2.ID(),
 * 			Triggers: pulumi.StringMap{
 * 				"remote_address_space": pulumi.String(std.JoinOutput(ctx, std.JoinOutputArgs{
 * 					Separator: pulumi.String(","),
 * 					Input:     example_2.AddressSpaces,
 * 				}, nil).ApplyT(func(invoke std.JoinResult) (*string, error) {
 * 					return invoke.Result, nil
 * 				}).(pulumi.StringPtrOutput)),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewVirtualNetworkPeering(ctx, "example-2", &network.VirtualNetworkPeeringArgs{
 * 			Name:                   pulumi.String("peer2to1"),
 * 			ResourceGroupName:      example.Name,
 * 			VirtualNetworkName:     example_2.Name,
 * 			RemoteVirtualNetworkId: example_1.ID(),
 * 			Triggers: pulumi.StringMap{
 * 				"remote_address_space": pulumi.String(std.JoinOutput(ctx, std.JoinOutputArgs{
 * 					Separator: pulumi.String(","),
 * 					Input:     example_1.AddressSpaces,
 * 				}, nil).ApplyT(func(invoke std.JoinResult) (*string, error) {
 * 					return invoke.Result, nil
 * 				}).(pulumi.StringPtrOutput)),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * 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());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: peeredvnets-rg
 *       location: West Europe
 *   example-1:
 *     type: azure:network:VirtualNetwork
 *     properties:
 *       name: peternetwork1
 *       resourceGroupName: ${example.name}
 *       addressSpaces:
 *         - 10.0.1.0/24
 *       location: ${example.location}
 *   example-2:
 *     type: azure:network:VirtualNetwork
 *     properties:
 *       name: peternetwork2
 *       resourceGroupName: ${example.name}
 *       addressSpaces:
 *         - 10.0.2.0/24
 *       location: ${example.location}
 *   example-1VirtualNetworkPeering:
 *     type: azure:network:VirtualNetworkPeering
 *     name: example-1
 *     properties:
 *       name: peer1to2
 *       resourceGroupName: ${example.name}
 *       virtualNetworkName: ${["example-1"].name}
 *       remoteVirtualNetworkId: ${["example-2"].id}
 *       triggers:
 *         remote_address_space:
 *           fn::invoke:
 *             Function: std:join
 *             Arguments:
 *               separator: ','
 *               input: ${["example-2"].addressSpaces}
 *             Return: result
 *   example-2VirtualNetworkPeering:
 *     type: azure:network:VirtualNetworkPeering
 *     name: example-2
 *     properties:
 *       name: peer2to1
 *       resourceGroupName: ${example.name}
 *       virtualNetworkName: ${["example-2"].name}
 *       remoteVirtualNetworkId: ${["example-1"].id}
 *       triggers:
 *         remote_address_space:
 *           fn::invoke:
 *             Function: std:join
 *             Arguments:
 *               separator: ','
 *               input: ${["example-1"].addressSpaces}
 *             Return: result
 * ```
 * 
 * ## Note
 * Virtual Network peerings cannot be created, updated or deleted concurrently.
 * ## Import
 * Virtual Network Peerings can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:network/virtualNetworkPeering:VirtualNetworkPeering examplePeering /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/virtualNetworkPeerings/myvnet1peering
 * ```
 */
public class VirtualNetworkPeering internal constructor(
    override val javaResource: com.pulumi.azure.network.VirtualNetworkPeering,
) : KotlinCustomResource(javaResource, VirtualNetworkPeeringMapper) {
    /**
     * Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to `false`.
     */
    public val allowForwardedTraffic: Output?
        get() = javaResource.allowForwardedTraffic().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to `false`.
     */
    public val allowGatewayTransit: Output?
        get() = javaResource.allowGatewayTransit().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Controls if the traffic from the local virtual network can reach the remote virtual network. Defaults to `true`.
     */
    public val allowVirtualNetworkAccess: Output?
        get() = javaResource.allowVirtualNetworkAccess().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A list of local Subnet names that are Subnet peered with remote Virtual Network.
     */
    public val localSubnetNames: Output>?
        get() = javaResource.localSubnetNames().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The name of the virtual network peering. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Specifies whether only IPv6 address space is peered for Subnet peering. Changing this forces a new resource to be created.
     */
    public val onlyIpv6PeeringEnabled: Output?
        get() = javaResource.onlyIpv6PeeringEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies whether complete Virtual Network address space is peered. Defaults to `true`. Changing this forces a new resource to be created.
     */
    public val peerCompleteVirtualNetworksEnabled: Output?
        get() = javaResource.peerCompleteVirtualNetworksEnabled().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * A list of remote Subnet names from remote Virtual Network that are Subnet peered.
     */
    public val remoteSubnetNames: Output>?
        get() = javaResource.remoteSubnetNames().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The full Azure resource ID of the remote virtual network. Changing this forces a new resource to be created.
     */
    public val remoteVirtualNetworkId: Output
        get() = javaResource.remoteVirtualNetworkId().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group in which to create the virtual network peering. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * 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.
     */
    public val triggers: Output>?
        get() = javaResource.triggers().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * 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`.
     * > **NOTE:** `use_remote_gateways` must be set to `false` if using Global Virtual Network Peerings.
     */
    public val useRemoteGateways: Output?
        get() = javaResource.useRemoteGateways().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the virtual network. Changing this forces a new resource to be created.
     */
    public val virtualNetworkName: Output
        get() = javaResource.virtualNetworkName().applyValue({ args0 -> args0 })
}

public object VirtualNetworkPeeringMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.network.VirtualNetworkPeering::class == javaResource::class

    override fun map(javaResource: Resource): VirtualNetworkPeering =
        VirtualNetworkPeering(javaResource as com.pulumi.azure.network.VirtualNetworkPeering)
}

/**
 * @see [VirtualNetworkPeering].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [VirtualNetworkPeering].
 */
public suspend fun virtualNetworkPeering(
    name: String,
    block: suspend VirtualNetworkPeeringResourceBuilder.() -> Unit,
): VirtualNetworkPeering {
    val builder = VirtualNetworkPeeringResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [VirtualNetworkPeering].
 * @param name The _unique_ name of the resulting resource.
 */
public fun virtualNetworkPeering(name: String): VirtualNetworkPeering {
    val builder = VirtualNetworkPeeringResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy