DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi
digitalocean.getVpcPeering
Explore with Pulumi AI
Example Usage
VPC Peering By Id
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const example = digitalocean.getVpcPeering({
id: "example-id",
});
import pulumi
import pulumi_digitalocean as digitalocean
example = digitalocean.get_vpc_peering(id="example-id")
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.LookupVpcPeering(ctx, &digitalocean.LookupVpcPeeringArgs{
Id: pulumi.StringRef("example-id"),
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var example = DigitalOcean.GetVpcPeering.Invoke(new()
{
Id = "example-id",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetVpcPeeringArgs;
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) {
final var example = DigitaloceanFunctions.getVpcPeering(GetVpcPeeringArgs.builder()
.id("example-id")
.build());
}
}
variables:
example:
fn::invoke:
Function: digitalocean:getVpcPeering
Arguments:
id: example-id
Reuse the data about a VPC Peering in other resources:
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const example = digitalocean.getVpcPeering({
id: "example-id",
});
const exampleDroplet = new digitalocean.Droplet("example", {
name: "example-01",
size: digitalocean.DropletSlug.DropletS1VCPU1GB,
image: "ubuntu-18-04-x64",
region: digitalocean.Region.NYC3,
vpcUuid: example.then(example => example.vpcIds?.[0]),
});
import pulumi
import pulumi_digitalocean as digitalocean
example = digitalocean.get_vpc_peering(id="example-id")
example_droplet = digitalocean.Droplet("example",
name="example-01",
size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
image="ubuntu-18-04-x64",
region=digitalocean.Region.NYC3,
vpc_uuid=example.vpc_ids[0])
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 {
example, err := digitalocean.LookupVpcPeering(ctx, &digitalocean.LookupVpcPeeringArgs{
Id: pulumi.StringRef("example-id"),
}, nil)
if err != nil {
return err
}
_, err = digitalocean.NewDroplet(ctx, "example", &digitalocean.DropletArgs{
Name: pulumi.String("example-01"),
Size: pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
Image: pulumi.String("ubuntu-18-04-x64"),
Region: pulumi.String(digitalocean.RegionNYC3),
VpcUuid: pulumi.String(example.VpcIds[0]),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var example = DigitalOcean.GetVpcPeering.Invoke(new()
{
Id = "example-id",
});
var exampleDroplet = new DigitalOcean.Droplet("example", new()
{
Name = "example-01",
Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
Image = "ubuntu-18-04-x64",
Region = DigitalOcean.Region.NYC3,
VpcUuid = example.Apply(getVpcPeeringResult => getVpcPeeringResult.VpcIds[0]),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetVpcPeeringArgs;
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) {
final var example = DigitaloceanFunctions.getVpcPeering(GetVpcPeeringArgs.builder()
.id("example-id")
.build());
var exampleDroplet = new Droplet("exampleDroplet", DropletArgs.builder()
.name("example-01")
.size("s-1vcpu-1gb")
.image("ubuntu-18-04-x64")
.region("nyc3")
.vpcUuid(example.applyValue(getVpcPeeringResult -> getVpcPeeringResult.vpcIds()[0]))
.build());
}
}
resources:
exampleDroplet:
type: digitalocean:Droplet
name: example
properties:
name: example-01
size: s-1vcpu-1gb
image: ubuntu-18-04-x64
region: nyc3
vpcUuid: ${example.vpcIds[0]}
variables:
example:
fn::invoke:
Function: digitalocean:getVpcPeering
Arguments:
id: example-id
VPC Peering By Name
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const example = digitalocean.getVpcPeering({
name: "example-peering",
});
import pulumi
import pulumi_digitalocean as digitalocean
example = digitalocean.get_vpc_peering(name="example-peering")
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.LookupVpcPeering(ctx, &digitalocean.LookupVpcPeeringArgs{
Name: pulumi.StringRef("example-peering"),
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var example = DigitalOcean.GetVpcPeering.Invoke(new()
{
Name = "example-peering",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetVpcPeeringArgs;
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) {
final var example = DigitaloceanFunctions.getVpcPeering(GetVpcPeeringArgs.builder()
.name("example-peering")
.build());
}
}
variables:
example:
fn::invoke:
Function: digitalocean:getVpcPeering
Arguments:
name: example-peering
Reuse the data about a VPC Peering in other resources:
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const example = digitalocean.getVpcPeering({
name: "example-peering",
});
const exampleDroplet = new digitalocean.Droplet("example", {
name: "example-01",
size: digitalocean.DropletSlug.DropletS1VCPU1GB,
image: "ubuntu-18-04-x64",
region: digitalocean.Region.NYC3,
vpcUuid: example.then(example => example.vpcIds?.[0]),
});
import pulumi
import pulumi_digitalocean as digitalocean
example = digitalocean.get_vpc_peering(name="example-peering")
example_droplet = digitalocean.Droplet("example",
name="example-01",
size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
image="ubuntu-18-04-x64",
region=digitalocean.Region.NYC3,
vpc_uuid=example.vpc_ids[0])
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 {
example, err := digitalocean.LookupVpcPeering(ctx, &digitalocean.LookupVpcPeeringArgs{
Name: pulumi.StringRef("example-peering"),
}, nil)
if err != nil {
return err
}
_, err = digitalocean.NewDroplet(ctx, "example", &digitalocean.DropletArgs{
Name: pulumi.String("example-01"),
Size: pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
Image: pulumi.String("ubuntu-18-04-x64"),
Region: pulumi.String(digitalocean.RegionNYC3),
VpcUuid: pulumi.String(example.VpcIds[0]),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var example = DigitalOcean.GetVpcPeering.Invoke(new()
{
Name = "example-peering",
});
var exampleDroplet = new DigitalOcean.Droplet("example", new()
{
Name = "example-01",
Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
Image = "ubuntu-18-04-x64",
Region = DigitalOcean.Region.NYC3,
VpcUuid = example.Apply(getVpcPeeringResult => getVpcPeeringResult.VpcIds[0]),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetVpcPeeringArgs;
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) {
final var example = DigitaloceanFunctions.getVpcPeering(GetVpcPeeringArgs.builder()
.name("example-peering")
.build());
var exampleDroplet = new Droplet("exampleDroplet", DropletArgs.builder()
.name("example-01")
.size("s-1vcpu-1gb")
.image("ubuntu-18-04-x64")
.region("nyc3")
.vpcUuid(example.applyValue(getVpcPeeringResult -> getVpcPeeringResult.vpcIds()[0]))
.build());
}
}
resources:
exampleDroplet:
type: digitalocean:Droplet
name: example
properties:
name: example-01
size: s-1vcpu-1gb
image: ubuntu-18-04-x64
region: nyc3
vpcUuid: ${example.vpcIds[0]}
variables:
example:
fn::invoke:
Function: digitalocean:getVpcPeering
Arguments:
name: example-peering
Using getVpcPeering
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getVpcPeering(args: GetVpcPeeringArgs, opts?: InvokeOptions): Promise<GetVpcPeeringResult>
function getVpcPeeringOutput(args: GetVpcPeeringOutputArgs, opts?: InvokeOptions): Output<GetVpcPeeringResult>
def get_vpc_peering(id: Optional[str] = None,
name: Optional[str] = None,
vpc_ids: Optional[Sequence[str]] = None,
opts: Optional[InvokeOptions] = None) -> GetVpcPeeringResult
def get_vpc_peering_output(id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
vpc_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetVpcPeeringResult]
func LookupVpcPeering(ctx *Context, args *LookupVpcPeeringArgs, opts ...InvokeOption) (*LookupVpcPeeringResult, error)
func LookupVpcPeeringOutput(ctx *Context, args *LookupVpcPeeringOutputArgs, opts ...InvokeOption) LookupVpcPeeringResultOutput
> Note: This function is named LookupVpcPeering
in the Go SDK.
public static class GetVpcPeering
{
public static Task<GetVpcPeeringResult> InvokeAsync(GetVpcPeeringArgs args, InvokeOptions? opts = null)
public static Output<GetVpcPeeringResult> Invoke(GetVpcPeeringInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetVpcPeeringResult> getVpcPeering(GetVpcPeeringArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: digitalocean:index/getVpcPeering:getVpcPeering
arguments:
# arguments dictionary
The following arguments are supported:
getVpcPeering Result
The following output properties are available:
- created_
at str - The date and time of when the VPC Peering was created.
- id str
- The unique identifier for the VPC Peering.
- name str
- The name of the VPC Peering.
- status str
- The status of the VPC Peering.
- vpc_
ids Sequence[str] - The list of VPC IDs involved in the peering.
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
digitalocean
Terraform Provider.