Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.digitalocean.kotlin.VpcPeering.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.digitalocean.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
/**
* Builder for [VpcPeering].
*/
@PulumiTagMarker
public class VpcPeeringResourceBuilder internal constructor() {
public var name: String? = null
public var args: VpcPeeringArgs = VpcPeeringArgs()
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 VpcPeeringArgsBuilder.() -> Unit) {
val builder = VpcPeeringArgsBuilder()
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(): VpcPeering {
val builtJavaResource = com.pulumi.digitalocean.VpcPeering(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return VpcPeering(builtJavaResource)
}
}
/**
* > 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
* ```
*/
public class VpcPeering internal constructor(
override val javaResource: com.pulumi.digitalocean.VpcPeering,
) : KotlinCustomResource(javaResource, VpcPeeringMapper) {
/**
* The date and time of when the VPC Peering was created.
*/
public val createdAt: Output
get() = javaResource.createdAt().applyValue({ args0 -> args0 })
/**
* A name for the VPC Peering. Must be unique and contain alphanumeric characters, dashes, and periods only.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The status of the VPC Peering.
*/
public val status: Output
get() = javaResource.status().applyValue({ args0 -> args0 })
/**
* A set of two VPC IDs to be peered.
*/
public val vpcIds: Output>
get() = javaResource.vpcIds().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
}
public object VpcPeeringMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.digitalocean.VpcPeering::class == javaResource::class
override fun map(javaResource: Resource): VpcPeering = VpcPeering(
javaResource as
com.pulumi.digitalocean.VpcPeering,
)
}
/**
* @see [VpcPeering].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [VpcPeering].
*/
public suspend fun vpcPeering(name: String, block: suspend VpcPeeringResourceBuilder.() -> Unit): VpcPeering {
val builder = VpcPeeringResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [VpcPeering].
* @param name The _unique_ name of the resulting resource.
*/
public fun vpcPeering(name: String): VpcPeering {
val builder = VpcPeeringResourceBuilder()
builder.name(name)
return builder.build()
}