get Bgp Peers
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);
Content copied to clipboard
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)
Content copied to clipboard
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),
};
});
Content copied to clipboard
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
})
}
Content copied to clipboard
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.peers()[0].id());
final var bgpGroupId = VpcFunctions.getBgpPeers(GetBgpPeersArgs.builder()
.bgpGroupId("example_value")
.build());
ctx.export("vpcBgpPeerId2", bgpGroupId.peers()[0].id());
final var routerId = VpcFunctions.getBgpPeers(GetBgpPeersArgs.builder()
.routerId("example_value")
.build());
ctx.export("vpcBgpPeerId3", routerId.peers()[0].id());
final var status = VpcFunctions.getBgpPeers(GetBgpPeersArgs.builder()
.status("Available")
.build());
ctx.export("vpcBgpPeerId4", status.peers()[0].id());
}
}
Content copied to clipboard
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}
Content copied to clipboard
Return
A collection of values returned by getBgpPeers.
Parameters
argument
A collection of arguments for invoking getBgpPeers.
suspend fun getBgpPeers(bgpGroupId: String? = null, ids: List<String>? = null, outputFile: String? = null, routerId: String? = null, status: String? = null): GetBgpPeersResult
Return
A collection of values returned by getBgpPeers.
Parameters
bgp Group Id
The ID of the BGP group to which the BGP peer that you want to query belongs.
ids
A list of Bgp Peer IDs.
output File
File name where to save data source results (after running pulumi preview
).
router Id
The ID of the virtual border router (VBR) that is associated with the BGP peer that you want to query.
status
The status of the BGP peer. Valid values: Available
, Deleted
, Deleting
, Modifying
, Pending
.
See also
suspend fun getBgpPeers(argument: suspend GetBgpPeersPlainArgsBuilder.() -> Unit): GetBgpPeersResult
Return
A collection of values returned by getBgpPeers.
Parameters
argument
Builder for com.pulumi.alicloud.vpc.kotlin.inputs.GetBgpPeersPlainArgs.