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

com.pulumi.digitalocean.kotlin.VpcPeeringArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.digitalocean.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.digitalocean.VpcPeeringArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * > VPC peering is currently in alpha. If you are not a member of the alpha group for this feature, you will not be able to use it until it has been more widely released. Please follow the official [DigitalOcean changelog](https://docs.digitalocean.com/release-notes/) for updates.
 * Provides a DigitalOcean VPC Peering resource.
 * VPC Peerings are used to connect two VPC networks allowing resources in each
 * VPC to communicate with each other privately.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as digitalocean from "@pulumi/digitalocean";
 * const example = new digitalocean.VpcPeering("example", {
 *     name: "example-peering",
 *     vpcIds: [
 *         vpc1.id,
 *         vpc2.id,
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_digitalocean as digitalocean
 * example = digitalocean.VpcPeering("example",
 *     name="example-peering",
 *     vpc_ids=[
 *         vpc1["id"],
 *         vpc2["id"],
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using DigitalOcean = Pulumi.DigitalOcean;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new DigitalOcean.VpcPeering("example", new()
 *     {
 *         Name = "example-peering",
 *         VpcIds = new[]
 *         {
 *             vpc1.Id,
 *             vpc2.Id,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := digitalocean.NewVpcPeering(ctx, "example", &digitalocean.VpcPeeringArgs{
 * 			Name: pulumi.String("example-peering"),
 * 			VpcIds: pulumi.StringArray{
 * 				vpc1.Id,
 * 				vpc2.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.digitalocean.VpcPeering;
 * import com.pulumi.digitalocean.VpcPeeringArgs;
 * 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 VpcPeering("example", VpcPeeringArgs.builder()
 *             .name("example-peering")
 *             .vpcIds(
 *                 vpc1.id(),
 *                 vpc2.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: digitalocean:VpcPeering
 *     properties:
 *       name: example-peering
 *       vpcIds:
 *         - ${vpc1.id}
 *         - ${vpc2.id}
 * ```
 * 
 * ### Resource Assignment
 * You can use the VPC Peering resource to allow communication between resources
 * in different VPCs. For example:
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as digitalocean from "@pulumi/digitalocean";
 * const vpc1 = new digitalocean.Vpc("vpc1", {
 *     name: "vpc1",
 *     region: "nyc3",
 * });
 * const vpc2 = new digitalocean.Vpc("vpc2", {
 *     name: "vpc2",
 *     region: "nyc3",
 * });
 * const example = new digitalocean.VpcPeering("example", {
 *     name: "example-peering",
 *     vpcIds: [
 *         vpc1.id,
 *         vpc2.id,
 *     ],
 * });
 * const example1 = new digitalocean.Droplet("example1", {
 *     name: "example1",
 *     size: digitalocean.DropletSlug.DropletS1VCPU1GB,
 *     image: "ubuntu-18-04-x64",
 *     region: digitalocean.Region.NYC3,
 *     vpcUuid: vpc1.id,
 * });
 * const example2 = new digitalocean.Droplet("example2", {
 *     name: "example2",
 *     size: digitalocean.DropletSlug.DropletS1VCPU1GB,
 *     image: "ubuntu-18-04-x64",
 *     region: digitalocean.Region.NYC3,
 *     vpcUuid: vpc2.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_digitalocean as digitalocean
 * vpc1 = digitalocean.Vpc("vpc1",
 *     name="vpc1",
 *     region="nyc3")
 * vpc2 = digitalocean.Vpc("vpc2",
 *     name="vpc2",
 *     region="nyc3")
 * example = digitalocean.VpcPeering("example",
 *     name="example-peering",
 *     vpc_ids=[
 *         vpc1.id,
 *         vpc2.id,
 *     ])
 * example1 = digitalocean.Droplet("example1",
 *     name="example1",
 *     size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
 *     image="ubuntu-18-04-x64",
 *     region=digitalocean.Region.NYC3,
 *     vpc_uuid=vpc1.id)
 * example2 = digitalocean.Droplet("example2",
 *     name="example2",
 *     size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
 *     image="ubuntu-18-04-x64",
 *     region=digitalocean.Region.NYC3,
 *     vpc_uuid=vpc2.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using DigitalOcean = Pulumi.DigitalOcean;
 * return await Deployment.RunAsync(() =>
 * {
 *     var vpc1 = new DigitalOcean.Vpc("vpc1", new()
 *     {
 *         Name = "vpc1",
 *         Region = "nyc3",
 *     });
 *     var vpc2 = new DigitalOcean.Vpc("vpc2", new()
 *     {
 *         Name = "vpc2",
 *         Region = "nyc3",
 *     });
 *     var example = new DigitalOcean.VpcPeering("example", new()
 *     {
 *         Name = "example-peering",
 *         VpcIds = new[]
 *         {
 *             vpc1.Id,
 *             vpc2.Id,
 *         },
 *     });
 *     var example1 = new DigitalOcean.Droplet("example1", new()
 *     {
 *         Name = "example1",
 *         Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
 *         Image = "ubuntu-18-04-x64",
 *         Region = DigitalOcean.Region.NYC3,
 *         VpcUuid = vpc1.Id,
 *     });
 *     var example2 = new DigitalOcean.Droplet("example2", new()
 *     {
 *         Name = "example2",
 *         Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
 *         Image = "ubuntu-18-04-x64",
 *         Region = DigitalOcean.Region.NYC3,
 *         VpcUuid = vpc2.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		vpc1, err := digitalocean.NewVpc(ctx, "vpc1", &digitalocean.VpcArgs{
 * 			Name:   pulumi.String("vpc1"),
 * 			Region: pulumi.String("nyc3"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		vpc2, err := digitalocean.NewVpc(ctx, "vpc2", &digitalocean.VpcArgs{
 * 			Name:   pulumi.String("vpc2"),
 * 			Region: pulumi.String("nyc3"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = digitalocean.NewVpcPeering(ctx, "example", &digitalocean.VpcPeeringArgs{
 * 			Name: pulumi.String("example-peering"),
 * 			VpcIds: pulumi.StringArray{
 * 				vpc1.ID(),
 * 				vpc2.ID(),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = digitalocean.NewDroplet(ctx, "example1", &digitalocean.DropletArgs{
 * 			Name:    pulumi.String("example1"),
 * 			Size:    pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
 * 			Image:   pulumi.String("ubuntu-18-04-x64"),
 * 			Region:  pulumi.String(digitalocean.RegionNYC3),
 * 			VpcUuid: vpc1.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = digitalocean.NewDroplet(ctx, "example2", &digitalocean.DropletArgs{
 * 			Name:    pulumi.String("example2"),
 * 			Size:    pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
 * 			Image:   pulumi.String("ubuntu-18-04-x64"),
 * 			Region:  pulumi.String(digitalocean.RegionNYC3),
 * 			VpcUuid: vpc2.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.digitalocean.Vpc;
 * import com.pulumi.digitalocean.VpcArgs;
 * import com.pulumi.digitalocean.VpcPeering;
 * import com.pulumi.digitalocean.VpcPeeringArgs;
 * import com.pulumi.digitalocean.Droplet;
 * import com.pulumi.digitalocean.DropletArgs;
 * 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 vpc1 = new Vpc("vpc1", VpcArgs.builder()
 *             .name("vpc1")
 *             .region("nyc3")
 *             .build());
 *         var vpc2 = new Vpc("vpc2", VpcArgs.builder()
 *             .name("vpc2")
 *             .region("nyc3")
 *             .build());
 *         var example = new VpcPeering("example", VpcPeeringArgs.builder()
 *             .name("example-peering")
 *             .vpcIds(
 *                 vpc1.id(),
 *                 vpc2.id())
 *             .build());
 *         var example1 = new Droplet("example1", DropletArgs.builder()
 *             .name("example1")
 *             .size("s-1vcpu-1gb")
 *             .image("ubuntu-18-04-x64")
 *             .region("nyc3")
 *             .vpcUuid(vpc1.id())
 *             .build());
 *         var example2 = new Droplet("example2", DropletArgs.builder()
 *             .name("example2")
 *             .size("s-1vcpu-1gb")
 *             .image("ubuntu-18-04-x64")
 *             .region("nyc3")
 *             .vpcUuid(vpc2.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   vpc1:
 *     type: digitalocean:Vpc
 *     properties:
 *       name: vpc1
 *       region: nyc3
 *   vpc2:
 *     type: digitalocean:Vpc
 *     properties:
 *       name: vpc2
 *       region: nyc3
 *   example:
 *     type: digitalocean:VpcPeering
 *     properties:
 *       name: example-peering
 *       vpcIds:
 *         - ${vpc1.id}
 *         - ${vpc2.id}
 *   example1:
 *     type: digitalocean:Droplet
 *     properties:
 *       name: example1
 *       size: s-1vcpu-1gb
 *       image: ubuntu-18-04-x64
 *       region: nyc3
 *       vpcUuid: ${vpc1.id}
 *   example2:
 *     type: digitalocean:Droplet
 *     properties:
 *       name: example2
 *       size: s-1vcpu-1gb
 *       image: ubuntu-18-04-x64
 *       region: nyc3
 *       vpcUuid: ${vpc2.id}
 * ```
 * 
 * ## Import
 * A VPC Peering can be imported using its `id`, e.g.
 * ```sh
 * $ pulumi import digitalocean:index/vpcPeering:VpcPeering example 771ad360-c017-4b4e-a34e-73934f5f0190
 * ```
 * @property name A name for the VPC Peering. Must be unique and contain alphanumeric characters, dashes, and periods only.
 * @property vpcIds A set of two VPC IDs to be peered.
 */
public data class VpcPeeringArgs(
    public val name: Output? = null,
    public val vpcIds: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.digitalocean.VpcPeeringArgs =
        com.pulumi.digitalocean.VpcPeeringArgs.builder()
            .name(name?.applyValue({ args0 -> args0 }))
            .vpcIds(vpcIds?.applyValue({ args0 -> args0.map({ args0 -> args0 }) })).build()
}

/**
 * Builder for [VpcPeeringArgs].
 */
@PulumiTagMarker
public class VpcPeeringArgsBuilder internal constructor() {
    private var name: Output? = null

    private var vpcIds: Output>? = null

    /**
     * @param value A name for the VPC Peering. Must be unique and contain alphanumeric characters, dashes, and periods only.
     */
    @JvmName("vjvhgkaplycciwcb")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value A set of two VPC IDs to be peered.
     */
    @JvmName("vcmhwyyahevbaqqd")
    public suspend fun vpcIds(`value`: Output>) {
        this.vpcIds = value
    }

    @JvmName("goijcpyiuidiwbxs")
    public suspend fun vpcIds(vararg values: Output) {
        this.vpcIds = Output.all(values.asList())
    }

    /**
     * @param values A set of two VPC IDs to be peered.
     */
    @JvmName("rvbojmkfaaubujyt")
    public suspend fun vpcIds(values: List>) {
        this.vpcIds = Output.all(values)
    }

    /**
     * @param value A name for the VPC Peering. Must be unique and contain alphanumeric characters, dashes, and periods only.
     */
    @JvmName("vvawyqrjbyfcektl")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value A set of two VPC IDs to be peered.
     */
    @JvmName("ngsmfutscaooxedn")
    public suspend fun vpcIds(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.vpcIds = mapped
    }

    /**
     * @param values A set of two VPC IDs to be peered.
     */
    @JvmName("poymoxkwvkchawct")
    public suspend fun vpcIds(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.vpcIds = mapped
    }

    internal fun build(): VpcPeeringArgs = VpcPeeringArgs(
        name = name,
        vpcIds = vpcIds,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy