1. Packages
  2. Flexibleengine Provider
  3. API Docs
  4. getVpcPeeringConnectionV2
flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud

flexibleengine.getVpcPeeringConnectionV2

Explore with Pulumi AI

flexibleengine logo
flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud

    The VPC Peering Connection data source provides details about a specific VPC peering connection.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as flexibleengine from "@pulumi/flexibleengine";
    
    const peering = flexibleengine.getVpcPeeringConnectionV2({
        vpcId: flexibleengine_vpc_v1.vpc.id,
        peerVpcId: flexibleengine_vpc_v1.peer_vpc.id,
    });
    const vpcRoute = new flexibleengine.VpcRouteV2("vpcRoute", {
        type: "peering",
        nexthop: peering.then(peering => peering.id),
        destination: "192.168.0.0/16",
        vpcId: flexibleengine_vpc_v1.vpc.id,
    });
    
    import pulumi
    import pulumi_flexibleengine as flexibleengine
    
    peering = flexibleengine.get_vpc_peering_connection_v2(vpc_id=flexibleengine_vpc_v1["vpc"]["id"],
        peer_vpc_id=flexibleengine_vpc_v1["peer_vpc"]["id"])
    vpc_route = flexibleengine.VpcRouteV2("vpcRoute",
        type="peering",
        nexthop=peering.id,
        destination="192.168.0.0/16",
        vpc_id=flexibleengine_vpc_v1["vpc"]["id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/flexibleengine/flexibleengine"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		peering, err := flexibleengine.LookupVpcPeeringConnectionV2(ctx, &flexibleengine.LookupVpcPeeringConnectionV2Args{
    			VpcId:     pulumi.StringRef(flexibleengine_vpc_v1.Vpc.Id),
    			PeerVpcId: pulumi.StringRef(flexibleengine_vpc_v1.Peer_vpc.Id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = flexibleengine.NewVpcRouteV2(ctx, "vpcRoute", &flexibleengine.VpcRouteV2Args{
    			Type:        pulumi.String("peering"),
    			Nexthop:     pulumi.String(peering.Id),
    			Destination: pulumi.String("192.168.0.0/16"),
    			VpcId:       pulumi.Any(flexibleengine_vpc_v1.Vpc.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Flexibleengine = Pulumi.Flexibleengine;
    
    return await Deployment.RunAsync(() => 
    {
        var peering = Flexibleengine.GetVpcPeeringConnectionV2.Invoke(new()
        {
            VpcId = flexibleengine_vpc_v1.Vpc.Id,
            PeerVpcId = flexibleengine_vpc_v1.Peer_vpc.Id,
        });
    
        var vpcRoute = new Flexibleengine.VpcRouteV2("vpcRoute", new()
        {
            Type = "peering",
            Nexthop = peering.Apply(getVpcPeeringConnectionV2Result => getVpcPeeringConnectionV2Result.Id),
            Destination = "192.168.0.0/16",
            VpcId = flexibleengine_vpc_v1.Vpc.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.flexibleengine.FlexibleengineFunctions;
    import com.pulumi.flexibleengine.inputs.GetVpcPeeringConnectionV2Args;
    import com.pulumi.flexibleengine.VpcRouteV2;
    import com.pulumi.flexibleengine.VpcRouteV2Args;
    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 peering = FlexibleengineFunctions.getVpcPeeringConnectionV2(GetVpcPeeringConnectionV2Args.builder()
                .vpcId(flexibleengine_vpc_v1.vpc().id())
                .peerVpcId(flexibleengine_vpc_v1.peer_vpc().id())
                .build());
    
            var vpcRoute = new VpcRouteV2("vpcRoute", VpcRouteV2Args.builder()
                .type("peering")
                .nexthop(peering.applyValue(getVpcPeeringConnectionV2Result -> getVpcPeeringConnectionV2Result.id()))
                .destination("192.168.0.0/16")
                .vpcId(flexibleengine_vpc_v1.vpc().id())
                .build());
    
        }
    }
    
    resources:
      vpcRoute:
        type: flexibleengine:VpcRouteV2
        properties:
          type: peering
          nexthop: ${peering.id}
          destination: 192.168.0.0/16
          vpcId: ${flexibleengine_vpc_v1.vpc.id}
    variables:
      peering:
        fn::invoke:
          function: flexibleengine:getVpcPeeringConnectionV2
          arguments:
            vpcId: ${flexibleengine_vpc_v1.vpc.id}
            peerVpcId: ${flexibleengine_vpc_v1.peer_vpc.id}
    

    Using getVpcPeeringConnectionV2

    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 getVpcPeeringConnectionV2(args: GetVpcPeeringConnectionV2Args, opts?: InvokeOptions): Promise<GetVpcPeeringConnectionV2Result>
    function getVpcPeeringConnectionV2Output(args: GetVpcPeeringConnectionV2OutputArgs, opts?: InvokeOptions): Output<GetVpcPeeringConnectionV2Result>
    def get_vpc_peering_connection_v2(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) -> GetVpcPeeringConnectionV2Result
    def get_vpc_peering_connection_v2_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[GetVpcPeeringConnectionV2Result]
    func LookupVpcPeeringConnectionV2(ctx *Context, args *LookupVpcPeeringConnectionV2Args, opts ...InvokeOption) (*LookupVpcPeeringConnectionV2Result, error)
    func LookupVpcPeeringConnectionV2Output(ctx *Context, args *LookupVpcPeeringConnectionV2OutputArgs, opts ...InvokeOption) LookupVpcPeeringConnectionV2ResultOutput

    > Note: This function is named LookupVpcPeeringConnectionV2 in the Go SDK.

    public static class GetVpcPeeringConnectionV2 
    {
        public static Task<GetVpcPeeringConnectionV2Result> InvokeAsync(GetVpcPeeringConnectionV2Args args, InvokeOptions? opts = null)
        public static Output<GetVpcPeeringConnectionV2Result> Invoke(GetVpcPeeringConnectionV2InvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVpcPeeringConnectionV2Result> getVpcPeeringConnectionV2(GetVpcPeeringConnectionV2Args args, InvokeOptions options)
    public static Output<GetVpcPeeringConnectionV2Result> getVpcPeeringConnectionV2(GetVpcPeeringConnectionV2Args args, InvokeOptions options)
    
    fn::invoke:
      function: flexibleengine:index/getVpcPeeringConnectionV2:getVpcPeeringConnectionV2
      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.
    PeerTenantId string
    The Tenant ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
    PeerVpcId string
    The ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
    Region string
    The region in which to obtain the V1 VPC client. A VPC client is needed to retrieve VPCs. If omitted, the region argument of the provider is used.
    Status string
    The status of the specific VPC Peering Connection to retrieve.
    VpcId 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.
    PeerTenantId string
    The Tenant ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
    PeerVpcId string
    The ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
    Region string
    The region in which to obtain the V1 VPC client. A VPC client is needed to retrieve VPCs. If omitted, the region argument of the provider is used.
    Status string
    The status of the specific VPC Peering Connection to retrieve.
    VpcId 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.
    peerTenantId String
    The Tenant ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
    peerVpcId String
    The ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
    region String
    The region in which to obtain the V1 VPC client. A VPC client is needed to retrieve VPCs. If omitted, the region argument of the provider is used.
    status String
    The status of the specific VPC Peering Connection to retrieve.
    vpcId 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.
    peerTenantId string
    The Tenant ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
    peerVpcId string
    The ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
    region string
    The region in which to obtain the V1 VPC client. A VPC client is needed to retrieve VPCs. If omitted, the region argument of the provider is used.
    status string
    The status of the specific VPC Peering Connection to retrieve.
    vpcId 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_id str
    The Tenant ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
    peer_vpc_id str
    The ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
    region str
    The region in which to obtain the V1 VPC client. A VPC client is needed to retrieve VPCs. If omitted, the region argument of the provider is 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.
    peerTenantId String
    The Tenant ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
    peerVpcId String
    The ID of the accepter/peer VPC of the specific VPC Peering Connection to retrieve.
    region String
    The region in which to obtain the V1 VPC client. A VPC client is needed to retrieve VPCs. If omitted, the region argument of the provider is used.
    status String
    The status of the specific VPC Peering Connection to retrieve.
    vpcId String
    The ID of the requester VPC of the specific VPC Peering Connection to retrieve.

    getVpcPeeringConnectionV2 Result

    The following output properties are available:

    Region string
    Id string
    Name string
    PeerTenantId string
    PeerVpcId string
    Status string
    VpcId string
    Region string
    Id string
    Name string
    PeerTenantId string
    PeerVpcId string
    Status string
    VpcId string
    region String
    id String
    name String
    peerTenantId String
    peerVpcId String
    status String
    vpcId String
    region string
    id string
    name string
    peerTenantId string
    peerVpcId string
    status string
    vpcId string
    region String
    id String
    name String
    peerTenantId String
    peerVpcId String
    status String
    vpcId String

    Package Details

    Repository
    flexibleengine flexibleenginecloud/terraform-provider-flexibleengine
    License
    Notes
    This Pulumi package is based on the flexibleengine Terraform Provider.
    flexibleengine logo
    flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud