1. Packages
  2. Ucloud Provider
  3. API Docs
  4. VpcPeeringConnection
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

ucloud.VpcPeeringConnection

Explore with Pulumi AI

Provides an VPC Peering Connection for establishing a connection between multiple VPC.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as ucloud from "@pulumi/ucloud";

const foo = new ucloud.Vpc("foo", {
    tag: "tf-example",
    cidrBlocks: ["192.168.0.0/16"],
});
const bar = new ucloud.Vpc("bar", {
    tag: "tf-example",
    cidrBlocks: ["10.10.0.0/16"],
});
const connection = new ucloud.VpcPeeringConnection("connection", {
    vpcId: foo.vpcId,
    peerVpcId: bar.vpcId,
});
Copy
import pulumi
import pulumi_ucloud as ucloud

foo = ucloud.Vpc("foo",
    tag="tf-example",
    cidr_blocks=["192.168.0.0/16"])
bar = ucloud.Vpc("bar",
    tag="tf-example",
    cidr_blocks=["10.10.0.0/16"])
connection = ucloud.VpcPeeringConnection("connection",
    vpc_id=foo.vpc_id,
    peer_vpc_id=bar.vpc_id)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ucloud/ucloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		foo, err := ucloud.NewVpc(ctx, "foo", &ucloud.VpcArgs{
			Tag: pulumi.String("tf-example"),
			CidrBlocks: pulumi.StringArray{
				pulumi.String("192.168.0.0/16"),
			},
		})
		if err != nil {
			return err
		}
		bar, err := ucloud.NewVpc(ctx, "bar", &ucloud.VpcArgs{
			Tag: pulumi.String("tf-example"),
			CidrBlocks: pulumi.StringArray{
				pulumi.String("10.10.0.0/16"),
			},
		})
		if err != nil {
			return err
		}
		_, err = ucloud.NewVpcPeeringConnection(ctx, "connection", &ucloud.VpcPeeringConnectionArgs{
			VpcId:     foo.VpcId,
			PeerVpcId: bar.VpcId,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ucloud = Pulumi.Ucloud;

return await Deployment.RunAsync(() => 
{
    var foo = new Ucloud.Vpc("foo", new()
    {
        Tag = "tf-example",
        CidrBlocks = new[]
        {
            "192.168.0.0/16",
        },
    });

    var bar = new Ucloud.Vpc("bar", new()
    {
        Tag = "tf-example",
        CidrBlocks = new[]
        {
            "10.10.0.0/16",
        },
    });

    var connection = new Ucloud.VpcPeeringConnection("connection", new()
    {
        VpcId = foo.VpcId,
        PeerVpcId = bar.VpcId,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ucloud.Vpc;
import com.pulumi.ucloud.VpcArgs;
import com.pulumi.ucloud.VpcPeeringConnection;
import com.pulumi.ucloud.VpcPeeringConnectionArgs;
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 foo = new Vpc("foo", VpcArgs.builder()
            .tag("tf-example")
            .cidrBlocks("192.168.0.0/16")
            .build());

        var bar = new Vpc("bar", VpcArgs.builder()
            .tag("tf-example")
            .cidrBlocks("10.10.0.0/16")
            .build());

        var connection = new VpcPeeringConnection("connection", VpcPeeringConnectionArgs.builder()
            .vpcId(foo.vpcId())
            .peerVpcId(bar.vpcId())
            .build());

    }
}
Copy
resources:
  foo:
    type: ucloud:Vpc
    properties:
      tag: tf-example
      cidrBlocks:
        - 192.168.0.0/16
  bar:
    type: ucloud:Vpc
    properties:
      tag: tf-example
      cidrBlocks:
        - 10.10.0.0/16
  connection:
    type: ucloud:VpcPeeringConnection
    properties:
      vpcId: ${foo.vpcId}
      peerVpcId: ${bar.vpcId}
Copy

Create VpcPeeringConnection Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new VpcPeeringConnection(name: string, args: VpcPeeringConnectionArgs, opts?: CustomResourceOptions);
@overload
def VpcPeeringConnection(resource_name: str,
                         args: VpcPeeringConnectionArgs,
                         opts: Optional[ResourceOptions] = None)

@overload
def VpcPeeringConnection(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         peer_vpc_id: Optional[str] = None,
                         vpc_id: Optional[str] = None,
                         peer_project_id: Optional[str] = None,
                         peer_region: Optional[str] = None,
                         vpc_peering_connection_id: Optional[str] = None)
func NewVpcPeeringConnection(ctx *Context, name string, args VpcPeeringConnectionArgs, opts ...ResourceOption) (*VpcPeeringConnection, error)
public VpcPeeringConnection(string name, VpcPeeringConnectionArgs args, CustomResourceOptions? opts = null)
public VpcPeeringConnection(String name, VpcPeeringConnectionArgs args)
public VpcPeeringConnection(String name, VpcPeeringConnectionArgs args, CustomResourceOptions options)
type: ucloud:VpcPeeringConnection
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. VpcPeeringConnectionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. VpcPeeringConnectionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. VpcPeeringConnectionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. VpcPeeringConnectionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. VpcPeeringConnectionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var vpcPeeringConnectionResource = new Ucloud.VpcPeeringConnection("vpcPeeringConnectionResource", new()
{
    PeerVpcId = "string",
    VpcId = "string",
    PeerProjectId = "string",
    PeerRegion = "string",
    VpcPeeringConnectionId = "string",
});
Copy
example, err := ucloud.NewVpcPeeringConnection(ctx, "vpcPeeringConnectionResource", &ucloud.VpcPeeringConnectionArgs{
	PeerVpcId:              pulumi.String("string"),
	VpcId:                  pulumi.String("string"),
	PeerProjectId:          pulumi.String("string"),
	PeerRegion:             pulumi.String("string"),
	VpcPeeringConnectionId: pulumi.String("string"),
})
Copy
var vpcPeeringConnectionResource = new VpcPeeringConnection("vpcPeeringConnectionResource", VpcPeeringConnectionArgs.builder()
    .peerVpcId("string")
    .vpcId("string")
    .peerProjectId("string")
    .peerRegion("string")
    .vpcPeeringConnectionId("string")
    .build());
Copy
vpc_peering_connection_resource = ucloud.VpcPeeringConnection("vpcPeeringConnectionResource",
    peer_vpc_id="string",
    vpc_id="string",
    peer_project_id="string",
    peer_region="string",
    vpc_peering_connection_id="string")
Copy
const vpcPeeringConnectionResource = new ucloud.VpcPeeringConnection("vpcPeeringConnectionResource", {
    peerVpcId: "string",
    vpcId: "string",
    peerProjectId: "string",
    peerRegion: "string",
    vpcPeeringConnectionId: "string",
});
Copy
type: ucloud:VpcPeeringConnection
properties:
    peerProjectId: string
    peerRegion: string
    peerVpcId: string
    vpcId: string
    vpcPeeringConnectionId: string
Copy

VpcPeeringConnection Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The VpcPeeringConnection resource accepts the following input properties:

PeerVpcId This property is required. string
The short ID of accepter VPC of the specific VPC Peering Connection to retrieve.


VpcId This property is required. string
The short of ID of the requester VPC of the specific VPC Peering Connection to retrieve.
PeerProjectId string
The ID of accepter project of the specific VPC Peering Connection to retrieve.
PeerRegion string
The region of the specific VPC Peering Connection to retrieve.
VpcPeeringConnectionId string
PeerVpcId This property is required. string
The short ID of accepter VPC of the specific VPC Peering Connection to retrieve.


VpcId This property is required. string
The short of ID of the requester VPC of the specific VPC Peering Connection to retrieve.
PeerProjectId string
The ID of accepter project of the specific VPC Peering Connection to retrieve.
PeerRegion string
The region of the specific VPC Peering Connection to retrieve.
VpcPeeringConnectionId string
peerVpcId This property is required. String
The short ID of accepter VPC of the specific VPC Peering Connection to retrieve.


vpcId This property is required. String
The short of ID of the requester VPC of the specific VPC Peering Connection to retrieve.
peerProjectId String
The ID of accepter project of the specific VPC Peering Connection to retrieve.
peerRegion String
The region of the specific VPC Peering Connection to retrieve.
vpcPeeringConnectionId String
peerVpcId This property is required. string
The short ID of accepter VPC of the specific VPC Peering Connection to retrieve.


vpcId This property is required. string
The short of ID of the requester VPC of the specific VPC Peering Connection to retrieve.
peerProjectId string
The ID of accepter project of the specific VPC Peering Connection to retrieve.
peerRegion string
The region of the specific VPC Peering Connection to retrieve.
vpcPeeringConnectionId string
peer_vpc_id This property is required. str
The short ID of accepter VPC of the specific VPC Peering Connection to retrieve.


vpc_id This property is required. str
The short of ID of the requester VPC of the specific VPC Peering Connection to retrieve.
peer_project_id str
The ID of accepter project of the specific VPC Peering Connection to retrieve.
peer_region str
The region of the specific VPC Peering Connection to retrieve.
vpc_peering_connection_id str
peerVpcId This property is required. String
The short ID of accepter VPC of the specific VPC Peering Connection to retrieve.


vpcId This property is required. String
The short of ID of the requester VPC of the specific VPC Peering Connection to retrieve.
peerProjectId String
The ID of accepter project of the specific VPC Peering Connection to retrieve.
peerRegion String
The region of the specific VPC Peering Connection to retrieve.
vpcPeeringConnectionId String

Outputs

All input properties are implicitly available as output properties. Additionally, the VpcPeeringConnection resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing VpcPeeringConnection Resource

Get an existing VpcPeeringConnection resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: VpcPeeringConnectionState, opts?: CustomResourceOptions): VpcPeeringConnection
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        peer_project_id: Optional[str] = None,
        peer_region: Optional[str] = None,
        peer_vpc_id: Optional[str] = None,
        vpc_id: Optional[str] = None,
        vpc_peering_connection_id: Optional[str] = None) -> VpcPeeringConnection
func GetVpcPeeringConnection(ctx *Context, name string, id IDInput, state *VpcPeeringConnectionState, opts ...ResourceOption) (*VpcPeeringConnection, error)
public static VpcPeeringConnection Get(string name, Input<string> id, VpcPeeringConnectionState? state, CustomResourceOptions? opts = null)
public static VpcPeeringConnection get(String name, Output<String> id, VpcPeeringConnectionState state, CustomResourceOptions options)
resources:  _:    type: ucloud:VpcPeeringConnection    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
PeerProjectId string
The ID of accepter project of the specific VPC Peering Connection to retrieve.
PeerRegion string
The region of the specific VPC Peering Connection to retrieve.
PeerVpcId string
The short ID of accepter VPC of the specific VPC Peering Connection to retrieve.


VpcId string
The short of ID of the requester VPC of the specific VPC Peering Connection to retrieve.
VpcPeeringConnectionId string
PeerProjectId string
The ID of accepter project of the specific VPC Peering Connection to retrieve.
PeerRegion string
The region of the specific VPC Peering Connection to retrieve.
PeerVpcId string
The short ID of accepter VPC of the specific VPC Peering Connection to retrieve.


VpcId string
The short of ID of the requester VPC of the specific VPC Peering Connection to retrieve.
VpcPeeringConnectionId string
peerProjectId String
The ID of accepter project of the specific VPC Peering Connection to retrieve.
peerRegion String
The region of the specific VPC Peering Connection to retrieve.
peerVpcId String
The short ID of accepter VPC of the specific VPC Peering Connection to retrieve.


vpcId String
The short of ID of the requester VPC of the specific VPC Peering Connection to retrieve.
vpcPeeringConnectionId String
peerProjectId string
The ID of accepter project of the specific VPC Peering Connection to retrieve.
peerRegion string
The region of the specific VPC Peering Connection to retrieve.
peerVpcId string
The short ID of accepter VPC of the specific VPC Peering Connection to retrieve.


vpcId string
The short of ID of the requester VPC of the specific VPC Peering Connection to retrieve.
vpcPeeringConnectionId string
peer_project_id str
The ID of accepter project of the specific VPC Peering Connection to retrieve.
peer_region str
The region of the specific VPC Peering Connection to retrieve.
peer_vpc_id str
The short ID of accepter VPC of the specific VPC Peering Connection to retrieve.


vpc_id str
The short of ID of the requester VPC of the specific VPC Peering Connection to retrieve.
vpc_peering_connection_id str
peerProjectId String
The ID of accepter project of the specific VPC Peering Connection to retrieve.
peerRegion String
The region of the specific VPC Peering Connection to retrieve.
peerVpcId String
The short ID of accepter VPC of the specific VPC Peering Connection to retrieve.


vpcId String
The short of ID of the requester VPC of the specific VPC Peering Connection to retrieve.
vpcPeeringConnectionId String

Package Details

Repository
ucloud ucloud/terraform-provider-ucloud
License
Notes
This Pulumi package is based on the ucloud Terraform Provider.