1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. vpc
  5. getBgpPeers
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.vpc.getBgpPeers

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

This data source provides the Vpc Bgp Peers of the current Alibaba Cloud user.

NOTE: Available in v1.153.0+.

Example Usage

Basic Usage

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

const ids = alicloud.vpc.getBgpPeers({
    ids: [
        "example_value-1",
        "example_value-2",
    ],
});
export const vpcBgpPeerId1 = ids.then(ids => ids.peers?.[0]?.id);
const bgpGroupId = alicloud.vpc.getBgpPeers({
    bgpGroupId: "example_value",
});
export const vpcBgpPeerId2 = bgpGroupId.then(bgpGroupId => bgpGroupId.peers?.[0]?.id);
const routerId = alicloud.vpc.getBgpPeers({
    routerId: "example_value",
});
export const vpcBgpPeerId3 = routerId.then(routerId => routerId.peers?.[0]?.id);
const status = alicloud.vpc.getBgpPeers({
    status: "Available",
});
export const vpcBgpPeerId4 = status.then(status => status.peers?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.vpc.get_bgp_peers(ids=[
    "example_value-1",
    "example_value-2",
])
pulumi.export("vpcBgpPeerId1", ids.peers[0].id)
bgp_group_id = alicloud.vpc.get_bgp_peers(bgp_group_id="example_value")
pulumi.export("vpcBgpPeerId2", bgp_group_id.peers[0].id)
router_id = alicloud.vpc.get_bgp_peers(router_id="example_value")
pulumi.export("vpcBgpPeerId3", router_id.peers[0].id)
status = alicloud.vpc.get_bgp_peers(status="Available")
pulumi.export("vpcBgpPeerId4", status.peers[0].id)
Copy
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.GetBgpPeers(ctx, &vpc.GetBgpPeersArgs{
			Ids: []string{
				"example_value-1",
				"example_value-2",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcBgpPeerId1", ids.Peers[0].Id)
		bgpGroupId, err := vpc.GetBgpPeers(ctx, &vpc.GetBgpPeersArgs{
			BgpGroupId: pulumi.StringRef("example_value"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcBgpPeerId2", bgpGroupId.Peers[0].Id)
		routerId, err := vpc.GetBgpPeers(ctx, &vpc.GetBgpPeersArgs{
			RouterId: pulumi.StringRef("example_value"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcBgpPeerId3", routerId.Peers[0].Id)
		status, err := vpc.GetBgpPeers(ctx, &vpc.GetBgpPeersArgs{
			Status: pulumi.StringRef("Available"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcBgpPeerId4", status.Peers[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.Vpc.GetBgpPeers.Invoke(new()
    {
        Ids = new[]
        {
            "example_value-1",
            "example_value-2",
        },
    });

    var bgpGroupId = AliCloud.Vpc.GetBgpPeers.Invoke(new()
    {
        BgpGroupId = "example_value",
    });

    var routerId = AliCloud.Vpc.GetBgpPeers.Invoke(new()
    {
        RouterId = "example_value",
    });

    var status = AliCloud.Vpc.GetBgpPeers.Invoke(new()
    {
        Status = "Available",
    });

    return new Dictionary<string, object?>
    {
        ["vpcBgpPeerId1"] = ids.Apply(getBgpPeersResult => getBgpPeersResult.Peers[0]?.Id),
        ["vpcBgpPeerId2"] = bgpGroupId.Apply(getBgpPeersResult => getBgpPeersResult.Peers[0]?.Id),
        ["vpcBgpPeerId3"] = routerId.Apply(getBgpPeersResult => getBgpPeersResult.Peers[0]?.Id),
        ["vpcBgpPeerId4"] = status.Apply(getBgpPeersResult => getBgpPeersResult.Peers[0]?.Id),
    };
});
Copy
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.GetBgpPeersArgs;
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.getBgpPeers(GetBgpPeersArgs.builder()
            .ids(            
                "example_value-1",
                "example_value-2")
            .build());

        ctx.export("vpcBgpPeerId1", ids.applyValue(getBgpPeersResult -> getBgpPeersResult.peers()[0].id()));
        final var bgpGroupId = VpcFunctions.getBgpPeers(GetBgpPeersArgs.builder()
            .bgpGroupId("example_value")
            .build());

        ctx.export("vpcBgpPeerId2", bgpGroupId.applyValue(getBgpPeersResult -> getBgpPeersResult.peers()[0].id()));
        final var routerId = VpcFunctions.getBgpPeers(GetBgpPeersArgs.builder()
            .routerId("example_value")
            .build());

        ctx.export("vpcBgpPeerId3", routerId.applyValue(getBgpPeersResult -> getBgpPeersResult.peers()[0].id()));
        final var status = VpcFunctions.getBgpPeers(GetBgpPeersArgs.builder()
            .status("Available")
            .build());

        ctx.export("vpcBgpPeerId4", status.applyValue(getBgpPeersResult -> getBgpPeersResult.peers()[0].id()));
    }
}
Copy
variables:
  ids:
    fn::invoke:
      function: alicloud:vpc:getBgpPeers
      arguments:
        ids:
          - example_value-1
          - example_value-2
  bgpGroupId:
    fn::invoke:
      function: alicloud:vpc:getBgpPeers
      arguments:
        bgpGroupId: example_value
  routerId:
    fn::invoke:
      function: alicloud:vpc:getBgpPeers
      arguments:
        routerId: example_value
  status:
    fn::invoke:
      function: alicloud:vpc:getBgpPeers
      arguments:
        status: Available
outputs:
  vpcBgpPeerId1: ${ids.peers[0].id}
  vpcBgpPeerId2: ${bgpGroupId.peers[0].id}
  vpcBgpPeerId3: ${routerId.peers[0].id}
  vpcBgpPeerId4: ${status.peers[0].id}
Copy

Using getBgpPeers

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 getBgpPeers(args: GetBgpPeersArgs, opts?: InvokeOptions): Promise<GetBgpPeersResult>
function getBgpPeersOutput(args: GetBgpPeersOutputArgs, opts?: InvokeOptions): Output<GetBgpPeersResult>
Copy
def get_bgp_peers(bgp_group_id: Optional[str] = None,
                  ids: Optional[Sequence[str]] = None,
                  output_file: Optional[str] = None,
                  router_id: Optional[str] = None,
                  status: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetBgpPeersResult
def get_bgp_peers_output(bgp_group_id: Optional[pulumi.Input[str]] = None,
                  ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  output_file: Optional[pulumi.Input[str]] = None,
                  router_id: Optional[pulumi.Input[str]] = None,
                  status: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetBgpPeersResult]
Copy
func GetBgpPeers(ctx *Context, args *GetBgpPeersArgs, opts ...InvokeOption) (*GetBgpPeersResult, error)
func GetBgpPeersOutput(ctx *Context, args *GetBgpPeersOutputArgs, opts ...InvokeOption) GetBgpPeersResultOutput
Copy

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

public static class GetBgpPeers 
{
    public static Task<GetBgpPeersResult> InvokeAsync(GetBgpPeersArgs args, InvokeOptions? opts = null)
    public static Output<GetBgpPeersResult> Invoke(GetBgpPeersInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetBgpPeersResult> getBgpPeers(GetBgpPeersArgs args, InvokeOptions options)
public static Output<GetBgpPeersResult> getBgpPeers(GetBgpPeersArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:vpc/getBgpPeers:getBgpPeers
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

BgpGroupId Changes to this property will trigger replacement. string
The ID of the BGP group to which the BGP peer that you want to query belongs.
Ids Changes to this property will trigger replacement. List<string>
A list of Bgp Peer IDs.
OutputFile string
File name where to save data source results (after running pulumi preview).
RouterId Changes to this property will trigger replacement. string
The ID of the virtual border router (VBR) that is associated with the BGP peer that you want to query.
Status Changes to this property will trigger replacement. string
The status of the BGP peer. Valid values: Available, Deleted, Deleting, Modifying, Pending.
BgpGroupId Changes to this property will trigger replacement. string
The ID of the BGP group to which the BGP peer that you want to query belongs.
Ids Changes to this property will trigger replacement. []string
A list of Bgp Peer IDs.
OutputFile string
File name where to save data source results (after running pulumi preview).
RouterId Changes to this property will trigger replacement. string
The ID of the virtual border router (VBR) that is associated with the BGP peer that you want to query.
Status Changes to this property will trigger replacement. string
The status of the BGP peer. Valid values: Available, Deleted, Deleting, Modifying, Pending.
bgpGroupId Changes to this property will trigger replacement. String
The ID of the BGP group to which the BGP peer that you want to query belongs.
ids Changes to this property will trigger replacement. List<String>
A list of Bgp Peer IDs.
outputFile String
File name where to save data source results (after running pulumi preview).
routerId Changes to this property will trigger replacement. String
The ID of the virtual border router (VBR) that is associated with the BGP peer that you want to query.
status Changes to this property will trigger replacement. String
The status of the BGP peer. Valid values: Available, Deleted, Deleting, Modifying, Pending.
bgpGroupId Changes to this property will trigger replacement. string
The ID of the BGP group to which the BGP peer that you want to query belongs.
ids Changes to this property will trigger replacement. string[]
A list of Bgp Peer IDs.
outputFile string
File name where to save data source results (after running pulumi preview).
routerId Changes to this property will trigger replacement. string
The ID of the virtual border router (VBR) that is associated with the BGP peer that you want to query.
status Changes to this property will trigger replacement. string
The status of the BGP peer. Valid values: Available, Deleted, Deleting, Modifying, Pending.
bgp_group_id Changes to this property will trigger replacement. str
The ID of the BGP group to which the BGP peer that you want to query belongs.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Bgp Peer IDs.
output_file str
File name where to save data source results (after running pulumi preview).
router_id Changes to this property will trigger replacement. str
The ID of the virtual border router (VBR) that is associated with the BGP peer that you want to query.
status Changes to this property will trigger replacement. str
The status of the BGP peer. Valid values: Available, Deleted, Deleting, Modifying, Pending.
bgpGroupId Changes to this property will trigger replacement. String
The ID of the BGP group to which the BGP peer that you want to query belongs.
ids Changes to this property will trigger replacement. List<String>
A list of Bgp Peer IDs.
outputFile String
File name where to save data source results (after running pulumi preview).
routerId Changes to this property will trigger replacement. String
The ID of the virtual border router (VBR) that is associated with the BGP peer that you want to query.
status Changes to this property will trigger replacement. String
The status of the BGP peer. Valid values: Available, Deleted, Deleting, Modifying, Pending.

getBgpPeers Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Peers List<Pulumi.AliCloud.Vpc.Outputs.GetBgpPeersPeer>
BgpGroupId string
OutputFile string
RouterId string
Status string
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Peers []GetBgpPeersPeer
BgpGroupId string
OutputFile string
RouterId string
Status string
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
peers List<GetBgpPeersPeer>
bgpGroupId String
outputFile String
routerId String
status String
id string
The provider-assigned unique ID for this managed resource.
ids string[]
peers GetBgpPeersPeer[]
bgpGroupId string
outputFile string
routerId string
status string
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
peers Sequence[GetBgpPeersPeer]
bgp_group_id str
output_file str
router_id str
status str
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
peers List<Property Map>
bgpGroupId String
outputFile String
routerId String
status String

Supporting Types

GetBgpPeersPeer

AuthKey This property is required. string
The authentication key of the BGP group.
BfdMultiHop This property is required. int
The BFD hop count.
BgpGroupId This property is required. string
The ID of the BGP group.
BgpPeerId This property is required. string
The ID of the BGP neighbor.
BgpPeerName This property is required. string
The name of the BGP neighbor.
BgpStatus This property is required. string
The status of the BGP connection.
Description This property is required. string
The description of the BGP group.
EnableBfd This property is required. bool
Indicates whether the Bidirectional Forwarding Detection (BFD) protocol is enabled.
Hold This property is required. string
The hold time.
Id This property is required. string
The ID of the Bgp Peer.
IpVersion This property is required. string
The IP version.
IsFake This property is required. bool
Indicates whether a fake AS number is used.
Keepalive This property is required. string
The keepalive time.
LocalAsn This property is required. string
The AS number of the device on the Alibaba Cloud side.
PeerAsn This property is required. string
The autonomous system (AS) number of the BGP peer.
PeerIpAddress This property is required. string
The IP address of the BGP neighbor.
RouteLimit This property is required. string
The limit on routes.
RouterId This property is required. string
The ID of the router.
Status This property is required. string
The status of the BGP peer.
AuthKey This property is required. string
The authentication key of the BGP group.
BfdMultiHop This property is required. int
The BFD hop count.
BgpGroupId This property is required. string
The ID of the BGP group.
BgpPeerId This property is required. string
The ID of the BGP neighbor.
BgpPeerName This property is required. string
The name of the BGP neighbor.
BgpStatus This property is required. string
The status of the BGP connection.
Description This property is required. string
The description of the BGP group.
EnableBfd This property is required. bool
Indicates whether the Bidirectional Forwarding Detection (BFD) protocol is enabled.
Hold This property is required. string
The hold time.
Id This property is required. string
The ID of the Bgp Peer.
IpVersion This property is required. string
The IP version.
IsFake This property is required. bool
Indicates whether a fake AS number is used.
Keepalive This property is required. string
The keepalive time.
LocalAsn This property is required. string
The AS number of the device on the Alibaba Cloud side.
PeerAsn This property is required. string
The autonomous system (AS) number of the BGP peer.
PeerIpAddress This property is required. string
The IP address of the BGP neighbor.
RouteLimit This property is required. string
The limit on routes.
RouterId This property is required. string
The ID of the router.
Status This property is required. string
The status of the BGP peer.
authKey This property is required. String
The authentication key of the BGP group.
bfdMultiHop This property is required. Integer
The BFD hop count.
bgpGroupId This property is required. String
The ID of the BGP group.
bgpPeerId This property is required. String
The ID of the BGP neighbor.
bgpPeerName This property is required. String
The name of the BGP neighbor.
bgpStatus This property is required. String
The status of the BGP connection.
description This property is required. String
The description of the BGP group.
enableBfd This property is required. Boolean
Indicates whether the Bidirectional Forwarding Detection (BFD) protocol is enabled.
hold This property is required. String
The hold time.
id This property is required. String
The ID of the Bgp Peer.
ipVersion This property is required. String
The IP version.
isFake This property is required. Boolean
Indicates whether a fake AS number is used.
keepalive This property is required. String
The keepalive time.
localAsn This property is required. String
The AS number of the device on the Alibaba Cloud side.
peerAsn This property is required. String
The autonomous system (AS) number of the BGP peer.
peerIpAddress This property is required. String
The IP address of the BGP neighbor.
routeLimit This property is required. String
The limit on routes.
routerId This property is required. String
The ID of the router.
status This property is required. String
The status of the BGP peer.
authKey This property is required. string
The authentication key of the BGP group.
bfdMultiHop This property is required. number
The BFD hop count.
bgpGroupId This property is required. string
The ID of the BGP group.
bgpPeerId This property is required. string
The ID of the BGP neighbor.
bgpPeerName This property is required. string
The name of the BGP neighbor.
bgpStatus This property is required. string
The status of the BGP connection.
description This property is required. string
The description of the BGP group.
enableBfd This property is required. boolean
Indicates whether the Bidirectional Forwarding Detection (BFD) protocol is enabled.
hold This property is required. string
The hold time.
id This property is required. string
The ID of the Bgp Peer.
ipVersion This property is required. string
The IP version.
isFake This property is required. boolean
Indicates whether a fake AS number is used.
keepalive This property is required. string
The keepalive time.
localAsn This property is required. string
The AS number of the device on the Alibaba Cloud side.
peerAsn This property is required. string
The autonomous system (AS) number of the BGP peer.
peerIpAddress This property is required. string
The IP address of the BGP neighbor.
routeLimit This property is required. string
The limit on routes.
routerId This property is required. string
The ID of the router.
status This property is required. string
The status of the BGP peer.
auth_key This property is required. str
The authentication key of the BGP group.
bfd_multi_hop This property is required. int
The BFD hop count.
bgp_group_id This property is required. str
The ID of the BGP group.
bgp_peer_id This property is required. str
The ID of the BGP neighbor.
bgp_peer_name This property is required. str
The name of the BGP neighbor.
bgp_status This property is required. str
The status of the BGP connection.
description This property is required. str
The description of the BGP group.
enable_bfd This property is required. bool
Indicates whether the Bidirectional Forwarding Detection (BFD) protocol is enabled.
hold This property is required. str
The hold time.
id This property is required. str
The ID of the Bgp Peer.
ip_version This property is required. str
The IP version.
is_fake This property is required. bool
Indicates whether a fake AS number is used.
keepalive This property is required. str
The keepalive time.
local_asn This property is required. str
The AS number of the device on the Alibaba Cloud side.
peer_asn This property is required. str
The autonomous system (AS) number of the BGP peer.
peer_ip_address This property is required. str
The IP address of the BGP neighbor.
route_limit This property is required. str
The limit on routes.
router_id This property is required. str
The ID of the router.
status This property is required. str
The status of the BGP peer.
authKey This property is required. String
The authentication key of the BGP group.
bfdMultiHop This property is required. Number
The BFD hop count.
bgpGroupId This property is required. String
The ID of the BGP group.
bgpPeerId This property is required. String
The ID of the BGP neighbor.
bgpPeerName This property is required. String
The name of the BGP neighbor.
bgpStatus This property is required. String
The status of the BGP connection.
description This property is required. String
The description of the BGP group.
enableBfd This property is required. Boolean
Indicates whether the Bidirectional Forwarding Detection (BFD) protocol is enabled.
hold This property is required. String
The hold time.
id This property is required. String
The ID of the Bgp Peer.
ipVersion This property is required. String
The IP version.
isFake This property is required. Boolean
Indicates whether a fake AS number is used.
keepalive This property is required. String
The keepalive time.
localAsn This property is required. String
The AS number of the device on the Alibaba Cloud side.
peerAsn This property is required. String
The autonomous system (AS) number of the BGP peer.
peerIpAddress This property is required. String
The IP address of the BGP neighbor.
routeLimit This property is required. String
The limit on routes.
routerId This property is required. String
The ID of the router.
status This property is required. String
The status of the BGP peer.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi