1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. vpc
  5. getPeerConnections
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

alicloud.vpc.getPeerConnections

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

    This data source provides the Vpc Peer Connections of the current Alibaba Cloud user.

    NOTE: Available in v1.186.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const ids = alicloud.vpc.getPeerConnections({});
    export const vpcPeerConnectionId1 = ids.then(ids => ids.connections?.[0]?.id);
    const nameRegex = alicloud.vpc.getPeerConnections({
        nameRegex: "^my-PeerConnection",
    });
    export const vpcPeerConnectionId2 = nameRegex.then(nameRegex => nameRegex.connections?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    ids = alicloud.vpc.get_peer_connections()
    pulumi.export("vpcPeerConnectionId1", ids.connections[0].id)
    name_regex = alicloud.vpc.get_peer_connections(name_regex="^my-PeerConnection")
    pulumi.export("vpcPeerConnectionId2", name_regex.connections[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ids, err := vpc.GetPeerConnections(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcPeerConnectionId1", ids.Connections[0].Id)
    		nameRegex, err := vpc.GetPeerConnections(ctx, &vpc.GetPeerConnectionsArgs{
    			NameRegex: pulumi.StringRef("^my-PeerConnection"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcPeerConnectionId2", nameRegex.Connections[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var ids = AliCloud.Vpc.GetPeerConnections.Invoke();
    
        var nameRegex = AliCloud.Vpc.GetPeerConnections.Invoke(new()
        {
            NameRegex = "^my-PeerConnection",
        });
    
        return new Dictionary<string, object?>
        {
            ["vpcPeerConnectionId1"] = ids.Apply(getPeerConnectionsResult => getPeerConnectionsResult.Connections[0]?.Id),
            ["vpcPeerConnectionId2"] = nameRegex.Apply(getPeerConnectionsResult => getPeerConnectionsResult.Connections[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.vpc.VpcFunctions;
    import com.pulumi.alicloud.vpc.inputs.GetPeerConnectionsArgs;
    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 ids = VpcFunctions.getPeerConnections();
    
            ctx.export("vpcPeerConnectionId1", ids.applyValue(getPeerConnectionsResult -> getPeerConnectionsResult.connections()[0].id()));
            final var nameRegex = VpcFunctions.getPeerConnections(GetPeerConnectionsArgs.builder()
                .nameRegex("^my-PeerConnection")
                .build());
    
            ctx.export("vpcPeerConnectionId2", nameRegex.applyValue(getPeerConnectionsResult -> getPeerConnectionsResult.connections()[0].id()));
        }
    }
    
    variables:
      ids:
        fn::invoke:
          Function: alicloud:vpc:getPeerConnections
          Arguments: {}
      nameRegex:
        fn::invoke:
          Function: alicloud:vpc:getPeerConnections
          Arguments:
            nameRegex: ^my-PeerConnection
    outputs:
      vpcPeerConnectionId1: ${ids.connections[0].id}
      vpcPeerConnectionId2: ${nameRegex.connections[0].id}
    

    Using getPeerConnections

    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 getPeerConnections(args: GetPeerConnectionsArgs, opts?: InvokeOptions): Promise<GetPeerConnectionsResult>
    function getPeerConnectionsOutput(args: GetPeerConnectionsOutputArgs, opts?: InvokeOptions): Output<GetPeerConnectionsResult>
    def get_peer_connections(ids: Optional[Sequence[str]] = None,
                             name_regex: Optional[str] = None,
                             output_file: Optional[str] = None,
                             peer_connection_name: Optional[str] = None,
                             status: Optional[str] = None,
                             vpc_id: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetPeerConnectionsResult
    def get_peer_connections_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                             name_regex: Optional[pulumi.Input[str]] = None,
                             output_file: Optional[pulumi.Input[str]] = None,
                             peer_connection_name: Optional[pulumi.Input[str]] = None,
                             status: Optional[pulumi.Input[str]] = None,
                             vpc_id: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetPeerConnectionsResult]
    func GetPeerConnections(ctx *Context, args *GetPeerConnectionsArgs, opts ...InvokeOption) (*GetPeerConnectionsResult, error)
    func GetPeerConnectionsOutput(ctx *Context, args *GetPeerConnectionsOutputArgs, opts ...InvokeOption) GetPeerConnectionsResultOutput

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

    public static class GetPeerConnections 
    {
        public static Task<GetPeerConnectionsResult> InvokeAsync(GetPeerConnectionsArgs args, InvokeOptions? opts = null)
        public static Output<GetPeerConnectionsResult> Invoke(GetPeerConnectionsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetPeerConnectionsResult> getPeerConnections(GetPeerConnectionsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:vpc/getPeerConnections:getPeerConnections
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Ids List<string>
    A list of PeerConnection IDs.
    NameRegex string
    A regex string to filter results by PeerConnection name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    PeerConnectionName string
    The name of the resource.
    Status string
    The status of the resource.
    VpcId string
    The ID of the requester VPC.
    Ids []string
    A list of PeerConnection IDs.
    NameRegex string
    A regex string to filter results by PeerConnection name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    PeerConnectionName string
    The name of the resource.
    Status string
    The status of the resource.
    VpcId string
    The ID of the requester VPC.
    ids List<String>
    A list of PeerConnection IDs.
    nameRegex String
    A regex string to filter results by PeerConnection name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    peerConnectionName String
    The name of the resource.
    status String
    The status of the resource.
    vpcId String
    The ID of the requester VPC.
    ids string[]
    A list of PeerConnection IDs.
    nameRegex string
    A regex string to filter results by PeerConnection name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    peerConnectionName string
    The name of the resource.
    status string
    The status of the resource.
    vpcId string
    The ID of the requester VPC.
    ids Sequence[str]
    A list of PeerConnection IDs.
    name_regex str
    A regex string to filter results by PeerConnection name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    peer_connection_name str
    The name of the resource.
    status str
    The status of the resource.
    vpc_id str
    The ID of the requester VPC.
    ids List<String>
    A list of PeerConnection IDs.
    nameRegex String
    A regex string to filter results by PeerConnection name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    peerConnectionName String
    The name of the resource.
    status String
    The status of the resource.
    vpcId String
    The ID of the requester VPC.

    getPeerConnections Result

    The following output properties are available:

    Connections List<Pulumi.AliCloud.Vpc.Outputs.GetPeerConnectionsConnection>
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    NameRegex string
    OutputFile string
    PeerConnectionName string
    Status string
    VpcId string
    Connections []GetPeerConnectionsConnection
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    NameRegex string
    OutputFile string
    PeerConnectionName string
    Status string
    VpcId string
    connections List<GetPeerConnectionsConnection>
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    nameRegex String
    outputFile String
    peerConnectionName String
    status String
    vpcId String
    connections GetPeerConnectionsConnection[]
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    nameRegex string
    outputFile string
    peerConnectionName string
    status string
    vpcId string
    connections Sequence[GetPeerConnectionsConnection]
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    name_regex str
    output_file str
    peer_connection_name str
    status str
    vpc_id str
    connections List<Property Map>
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    nameRegex String
    outputFile String
    peerConnectionName String
    status String
    vpcId String

    Supporting Types

    GetPeerConnectionsConnection

    AcceptingAliUid int
    The ID of the Alibaba Cloud account (primary account) of the receiving end of the VPC peering connection to be created.
    AcceptingRegionId string
    The region ID of the recipient of the VPC peering connection to be created.
    AcceptingVpcId string
    The VPC ID of the receiving end of the VPC peer connection.
    Bandwidth int
    The bandwidth of the VPC peering connection to be modified. Unit: Mbps.
    CreateTime string
    The creation time of the resource.
    Description string
    The description of the VPC peer connection to be created.
    Id string
    The ID of the PeerConnection.
    PeerConnectionId string
    The first ID of the resource.
    PeerConnectionName string
    The name of the resource.
    Status string
    The status of the resource.
    VpcId string
    The ID of the requester VPC.
    AcceptingAliUid int
    The ID of the Alibaba Cloud account (primary account) of the receiving end of the VPC peering connection to be created.
    AcceptingRegionId string
    The region ID of the recipient of the VPC peering connection to be created.
    AcceptingVpcId string
    The VPC ID of the receiving end of the VPC peer connection.
    Bandwidth int
    The bandwidth of the VPC peering connection to be modified. Unit: Mbps.
    CreateTime string
    The creation time of the resource.
    Description string
    The description of the VPC peer connection to be created.
    Id string
    The ID of the PeerConnection.
    PeerConnectionId string
    The first ID of the resource.
    PeerConnectionName string
    The name of the resource.
    Status string
    The status of the resource.
    VpcId string
    The ID of the requester VPC.
    acceptingAliUid Integer
    The ID of the Alibaba Cloud account (primary account) of the receiving end of the VPC peering connection to be created.
    acceptingRegionId String
    The region ID of the recipient of the VPC peering connection to be created.
    acceptingVpcId String
    The VPC ID of the receiving end of the VPC peer connection.
    bandwidth Integer
    The bandwidth of the VPC peering connection to be modified. Unit: Mbps.
    createTime String
    The creation time of the resource.
    description String
    The description of the VPC peer connection to be created.
    id String
    The ID of the PeerConnection.
    peerConnectionId String
    The first ID of the resource.
    peerConnectionName String
    The name of the resource.
    status String
    The status of the resource.
    vpcId String
    The ID of the requester VPC.
    acceptingAliUid number
    The ID of the Alibaba Cloud account (primary account) of the receiving end of the VPC peering connection to be created.
    acceptingRegionId string
    The region ID of the recipient of the VPC peering connection to be created.
    acceptingVpcId string
    The VPC ID of the receiving end of the VPC peer connection.
    bandwidth number
    The bandwidth of the VPC peering connection to be modified. Unit: Mbps.
    createTime string
    The creation time of the resource.
    description string
    The description of the VPC peer connection to be created.
    id string
    The ID of the PeerConnection.
    peerConnectionId string
    The first ID of the resource.
    peerConnectionName string
    The name of the resource.
    status string
    The status of the resource.
    vpcId string
    The ID of the requester VPC.
    accepting_ali_uid int
    The ID of the Alibaba Cloud account (primary account) of the receiving end of the VPC peering connection to be created.
    accepting_region_id str
    The region ID of the recipient of the VPC peering connection to be created.
    accepting_vpc_id str
    The VPC ID of the receiving end of the VPC peer connection.
    bandwidth int
    The bandwidth of the VPC peering connection to be modified. Unit: Mbps.
    create_time str
    The creation time of the resource.
    description str
    The description of the VPC peer connection to be created.
    id str
    The ID of the PeerConnection.
    peer_connection_id str
    The first ID of the resource.
    peer_connection_name str
    The name of the resource.
    status str
    The status of the resource.
    vpc_id str
    The ID of the requester VPC.
    acceptingAliUid Number
    The ID of the Alibaba Cloud account (primary account) of the receiving end of the VPC peering connection to be created.
    acceptingRegionId String
    The region ID of the recipient of the VPC peering connection to be created.
    acceptingVpcId String
    The VPC ID of the receiving end of the VPC peer connection.
    bandwidth Number
    The bandwidth of the VPC peering connection to be modified. Unit: Mbps.
    createTime String
    The creation time of the resource.
    description String
    The description of the VPC peer connection to be created.
    id String
    The ID of the PeerConnection.
    peerConnectionId String
    The first ID of the resource.
    peerConnectionName String
    The name of the resource.
    status String
    The status of the resource.
    vpcId String
    The ID of the requester VPC.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi