title: "getPeeringConnection" title_tag: "huaweicloud.Vpc.getPeeringConnection" meta_desc: "Documentation for the huaweicloud.Vpc.getPeeringConnection function with examples, input properties, output properties, and supporting types." layout: api no_edit_this_page: true
The VPC Peering Connection data source provides details about a specific VPC peering connection.
using System.Collections.Generic;
using Pulumi;
using Huaweicloud = Pulumi.Huaweicloud;
return await Deployment.RunAsync(() =>
{
var vpc = Huaweicloud.Vpc.GetVpc.Invoke(new()
{
Name = "vpc",
});
var peerVpc = Huaweicloud.Vpc.GetVpc.Invoke(new()
{
Name = "peer_vpc",
});
var peering = Huaweicloud.Vpc.GetPeeringConnection.Invoke(new()
{
VpcId = vpc.Apply(getVpcResult => getVpcResult.Id),
PeerVpcId = peerVpc.Apply(getVpcResult => getVpcResult.Id),
});
var vpcRoute = new Huaweicloud.Vpc.Route("vpcRoute", new()
{
Type = "peering",
Nexthop = peering.Apply(getPeeringConnectionResult => getPeeringConnectionResult.Id),
Destination = "192.168.0.0/16",
VpcId = vpc.Apply(getVpcResult => getVpcResult.Id),
});
});
package main
import (
"github.com/huaweicloud/pulumi-huaweicloud/sdk/go/huaweicloud/Vpc"
"github.com/pulumi/pulumi-huaweicloud/sdk/go/huaweicloud/Vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
vpc, err := Vpc.GetVpc(ctx, &vpc.GetVpcArgs{
Name: pulumi.StringRef("vpc"),
}, nil)
if err != nil {
return err
}
peerVpc, err := Vpc.GetVpc(ctx, &vpc.GetVpcArgs{
Name: pulumi.StringRef("peer_vpc"),
}, nil)
if err != nil {
return err
}
peering, err := Vpc.GetPeeringConnection(ctx, &vpc.GetPeeringConnectionArgs{
VpcId: pulumi.StringRef(vpc.Id),
PeerVpcId: pulumi.StringRef(peerVpc.Id),
}, nil)
if err != nil {
return err
}
_, err = Vpc.NewRoute(ctx, "vpcRoute", &Vpc.RouteArgs{
Type: pulumi.String("peering"),
Nexthop: pulumi.String(peering.Id),
Destination: pulumi.String("192.168.0.0/16"),
VpcId: pulumi.String(vpc.Id),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.huaweicloud.Vpc.VpcFunctions;
import com.pulumi.huaweicloud.Iec.inputs.GetVpcArgs;
import com.pulumi.huaweicloud.Vpc.inputs.GetPeeringConnectionArgs;
import com.pulumi.huaweicloud.Vpc.Route;
import com.pulumi.huaweicloud.Vpc.RouteArgs;
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 vpc = VpcFunctions.getVpc(GetVpcArgs.builder()
.name("vpc")
.build());
final var peerVpc = VpcFunctions.getVpc(GetVpcArgs.builder()
.name("peer_vpc")
.build());
final var peering = VpcFunctions.getPeeringConnection(GetPeeringConnectionArgs.builder()
.vpcId(vpc.applyValue(getVpcResult -> getVpcResult.id()))
.peerVpcId(peerVpc.applyValue(getVpcResult -> getVpcResult.id()))
.build());
var vpcRoute = new Route("vpcRoute", RouteArgs.builder()
.type("peering")
.nexthop(peering.applyValue(getPeeringConnectionResult -> getPeeringConnectionResult.id()))
.destination("192.168.0.0/16")
.vpcId(vpc.applyValue(getVpcResult -> getVpcResult.id()))
.build());
}
}
import pulumi
import pulumi_huaweicloud as huaweicloud
vpc = huaweicloud.Vpc.get_vpc(name="vpc")
peer_vpc = huaweicloud.Vpc.get_vpc(name="peer_vpc")
peering = huaweicloud.Vpc.get_peering_connection(vpc_id=vpc.id,
peer_vpc_id=peer_vpc.id)
vpc_route = huaweicloud.vpc.Route("vpcRoute",
type="peering",
nexthop=peering.id,
destination="192.168.0.0/16",
vpc_id=vpc.id)
import * as pulumi from "@pulumi/pulumi";
import * as huaweicloud from "@pulumi/huaweicloud";
import * as pulumi from "@huaweicloudos/pulumi";
const vpc = huaweicloud.Vpc.getVpc({
name: "vpc",
});
const peerVpc = huaweicloud.Vpc.getVpc({
name: "peer_vpc",
});
const peering = Promise.all([vpc, peerVpc]).then(([vpc, peerVpc]) => huaweicloud.Vpc.getPeeringConnection({
vpcId: vpc.id,
peerVpcId: peerVpc.id,
}));
const vpcRoute = new huaweicloud.vpc.Route("vpcRoute", {
type: "peering",
nexthop: peering.then(peering => peering.id),
destination: "192.168.0.0/16",
vpcId: vpc.then(vpc => vpc.id),
});
resources:
vpcRoute:
type: huaweicloud:Vpc:Route
properties:
type: peering
nexthop: ${peering.id}
destination: 192.168.0.0/16
vpcId: ${vpc.id}
variables:
vpc:
Fn::Invoke:
Function: huaweicloud:Vpc:getVpc
Arguments:
name: vpc
peerVpc:
Fn::Invoke:
Function: huaweicloud:Vpc:getVpc
Arguments:
name: peer_vpc
peering:
Fn::Invoke:
Function: huaweicloud:Vpc:getPeeringConnection
Arguments:
vpcId: ${vpc.id}
peerVpcId: ${peerVpc.id}
Using getPeeringConnection {#using}
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 getPeeringConnection(args: GetPeeringConnectionArgs, opts?: InvokeOptions): Promise<GetPeeringConnectionResult>
function getPeeringConnectionOutput(args: GetPeeringConnectionOutputArgs, opts?: InvokeOptions): Output<GetPeeringConnectionResult>
def get_peering_connection(id: Optional[str] = None,
name: Optional[str] = None,
peer_tenant_id: Optional[str] = None,
peer_vpc_id: Optional[str] = None,
region: Optional[str] = None,
status: Optional[str] = None,
vpc_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPeeringConnectionResult
def get_peering_connection_output(id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
peer_tenant_id: Optional[pulumi.Input[str]] = None,
peer_vpc_id: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
status: Optional[pulumi.Input[str]] = None,
vpc_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetPeeringConnectionResult]
func GetPeeringConnection(ctx *Context, args *GetPeeringConnectionArgs, opts ...InvokeOption) (*GetPeeringConnectionResult, error)
func GetPeeringConnectionOutput(ctx *Context, args *GetPeeringConnectionOutputArgs, opts ...InvokeOption) GetPeeringConnectionResultOutput
> Note: This function is named GetPeeringConnection
in the Go SDK.
public static class GetPeeringConnection
{
public static Task<GetPeeringConnectionResult> InvokeAsync(GetPeeringConnectionArgs args, InvokeOptions? opts = null)
public static Output<GetPeeringConnectionResult> Invoke(GetPeeringConnectionInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPeeringConnectionResult> getPeeringConnection(GetPeeringConnectionArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
Function: huaweicloud:Vpc/getPeeringConnection:getPeeringConnection
Arguments:
# Arguments dictionary
The following arguments are supported:
- Id string
The ID of the specific VPC Peering Connection to retrieve.
- Name string
The name of the specific VPC Peering Connection to retrieve.
-
Peer
Tenant stringId The Tenant ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
-
Peer
Vpc stringId The ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
- Region string
The region in which to obtain the VPC Peering Connection. If omitted, the provider-level region will be used.
- Status string
The status of the specific VPC Peering Connection to retrieve.
-
Vpc
Id string The ID of the requester VPC of the specific VPC Peering Connection to retrieve.
- Id string
The ID of the specific VPC Peering Connection to retrieve.
- Name string
The name of the specific VPC Peering Connection to retrieve.
-
Peer
Tenant stringId The Tenant ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
-
Peer
Vpc stringId The ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
- Region string
The region in which to obtain the VPC Peering Connection. If omitted, the provider-level region will be used.
- Status string
The status of the specific VPC Peering Connection to retrieve.
-
Vpc
Id string The ID of the requester VPC of the specific VPC Peering Connection to retrieve.
- id String
The ID of the specific VPC Peering Connection to retrieve.
- name String
The name of the specific VPC Peering Connection to retrieve.
-
peer
Tenant StringId The Tenant ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
-
peer
Vpc StringId The ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
- region String
The region in which to obtain the VPC Peering Connection. If omitted, the provider-level region will be used.
- status String
The status of the specific VPC Peering Connection to retrieve.
-
vpc
Id String The ID of the requester VPC of the specific VPC Peering Connection to retrieve.
- id string
The ID of the specific VPC Peering Connection to retrieve.
- name string
The name of the specific VPC Peering Connection to retrieve.
-
peer
Tenant stringId The Tenant ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
-
peer
Vpc stringId The ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
- region string
The region in which to obtain the VPC Peering Connection. If omitted, the provider-level region will be used.
- status string
The status of the specific VPC Peering Connection to retrieve.
-
vpc
Id string The ID of the requester VPC of the specific VPC Peering Connection to retrieve.
- id str
The ID of the specific VPC Peering Connection to retrieve.
- name str
The name of the specific VPC Peering Connection to retrieve.
-
peer_
tenant_ strid The Tenant ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
-
peer_
vpc_ strid The ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
- region str
The region in which to obtain the VPC Peering Connection. If omitted, the provider-level region will be used.
- status str
The status of the specific VPC Peering Connection to retrieve.
-
vpc_
id str The ID of the requester VPC of the specific VPC Peering Connection to retrieve.
- id String
The ID of the specific VPC Peering Connection to retrieve.
- name String
The name of the specific VPC Peering Connection to retrieve.
-
peer
Tenant StringId The Tenant ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
-
peer
Vpc StringId The ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
- region String
The region in which to obtain the VPC Peering Connection. If omitted, the provider-level region will be used.
- status String
The status of the specific VPC Peering Connection to retrieve.
-
vpc
Id String The ID of the requester VPC of the specific VPC Peering Connection to retrieve.
getPeeringConnection Result {#result}
The following output properties are available:
- id str
- name str
-
peer_
tenant_ strid -
peer_
vpc_ strid - region str
- status str
-
vpc_
id str
Package Details
- Repository
- https://github.com/huaweicloud/pulumi-huaweicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
huaweicloud
Terraform Provider.