1. Packages
  2. Equinix
  3. API Docs
  4. metal
  5. getDeviceBgpNeighbors
Equinix v0.27.1 published on Wednesday, Oct 29, 2025 by Equinix

equinix.metal.getDeviceBgpNeighbors

Start a Neo task
Explain and create an equinix.metal.getDeviceBgpNeighbors resource
equinix logo
Equinix v0.27.1 published on Wednesday, Oct 29, 2025 by Equinix

    Use this datasource to retrieve list of BGP neighbors of a device in the Equinix Metal host.

    To have any BGP neighbors listed, the device must be in BGP-enabled project and have a BGP session assigned.

    To learn more about using BGP in Equinix Metal, see the equinix.metal.BgpSession resource documentation.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as equinix from "@pulumi/equinix";
    
    const test = equinix.metal.getDeviceBgpNeighbors({
        deviceId: "4c641195-25e5-4c3c-b2b7-4cd7a42c7b40",
    });
    export const bgpNeighborsListing = test.then(test => test.bgpNeighbors);
    
    import pulumi
    import pulumi_equinix as equinix
    
    test = equinix.metal.get_device_bgp_neighbors(device_id="4c641195-25e5-4c3c-b2b7-4cd7a42c7b40")
    pulumi.export("bgpNeighborsListing", test.bgp_neighbors)
    
    package main
    
    import (
    	"github.com/equinix/pulumi-equinix/sdk/go/equinix/metal"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		test, err := metal.GetDeviceBgpNeighbors(ctx, &metal.GetDeviceBgpNeighborsArgs{
    			DeviceId: "4c641195-25e5-4c3c-b2b7-4cd7a42c7b40",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("bgpNeighborsListing", test.BgpNeighbors)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Equinix = Pulumi.Equinix;
    
    return await Deployment.RunAsync(() => 
    {
        var test = Equinix.Metal.GetDeviceBgpNeighbors.Invoke(new()
        {
            DeviceId = "4c641195-25e5-4c3c-b2b7-4cd7a42c7b40",
        });
    
        return new Dictionary<string, object?>
        {
            ["bgpNeighborsListing"] = test.Apply(getDeviceBgpNeighborsResult => getDeviceBgpNeighborsResult.BgpNeighbors),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.equinix.metal.MetalFunctions;
    import com.pulumi.equinix.metal.inputs.GetDeviceBgpNeighborsArgs;
    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 test = MetalFunctions.getDeviceBgpNeighbors(GetDeviceBgpNeighborsArgs.builder()
                .deviceId("4c641195-25e5-4c3c-b2b7-4cd7a42c7b40")
                .build());
    
            ctx.export("bgpNeighborsListing", test.applyValue(getDeviceBgpNeighborsResult -> getDeviceBgpNeighborsResult.bgpNeighbors()));
        }
    }
    
    variables:
      test:
        fn::invoke:
          function: equinix:metal:getDeviceBgpNeighbors
          arguments:
            deviceId: 4c641195-25e5-4c3c-b2b7-4cd7a42c7b40
    outputs:
      bgpNeighborsListing: ${test.bgpNeighbors}
    

    Using getDeviceBgpNeighbors

    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 getDeviceBgpNeighbors(args: GetDeviceBgpNeighborsArgs, opts?: InvokeOptions): Promise<GetDeviceBgpNeighborsResult>
    function getDeviceBgpNeighborsOutput(args: GetDeviceBgpNeighborsOutputArgs, opts?: InvokeOptions): Output<GetDeviceBgpNeighborsResult>
    def get_device_bgp_neighbors(device_id: Optional[str] = None,
                                 opts: Optional[InvokeOptions] = None) -> GetDeviceBgpNeighborsResult
    def get_device_bgp_neighbors_output(device_id: Optional[pulumi.Input[str]] = None,
                                 opts: Optional[InvokeOptions] = None) -> Output[GetDeviceBgpNeighborsResult]
    func GetDeviceBgpNeighbors(ctx *Context, args *GetDeviceBgpNeighborsArgs, opts ...InvokeOption) (*GetDeviceBgpNeighborsResult, error)
    func GetDeviceBgpNeighborsOutput(ctx *Context, args *GetDeviceBgpNeighborsOutputArgs, opts ...InvokeOption) GetDeviceBgpNeighborsResultOutput

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

    public static class GetDeviceBgpNeighbors 
    {
        public static Task<GetDeviceBgpNeighborsResult> InvokeAsync(GetDeviceBgpNeighborsArgs args, InvokeOptions? opts = null)
        public static Output<GetDeviceBgpNeighborsResult> Invoke(GetDeviceBgpNeighborsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDeviceBgpNeighborsResult> getDeviceBgpNeighbors(GetDeviceBgpNeighborsArgs args, InvokeOptions options)
    public static Output<GetDeviceBgpNeighborsResult> getDeviceBgpNeighbors(GetDeviceBgpNeighborsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: equinix:metal/getDeviceBgpNeighbors:getDeviceBgpNeighbors
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DeviceId string
    UUID of BGP-enabled device whose neighbors to list.
    DeviceId string
    UUID of BGP-enabled device whose neighbors to list.
    deviceId String
    UUID of BGP-enabled device whose neighbors to list.
    deviceId string
    UUID of BGP-enabled device whose neighbors to list.
    device_id str
    UUID of BGP-enabled device whose neighbors to list.
    deviceId String
    UUID of BGP-enabled device whose neighbors to list.

    getDeviceBgpNeighbors Result

    The following output properties are available:

    BgpNeighbors List<GetDeviceBgpNeighborsBgpNeighbor>
    array of BGP neighbor records with attributes:
    DeviceId string
    Id string
    The provider-assigned unique ID for this managed resource.
    BgpNeighbors []GetDeviceBgpNeighborsBgpNeighbor
    array of BGP neighbor records with attributes:
    DeviceId string
    Id string
    The provider-assigned unique ID for this managed resource.
    bgpNeighbors List<GetDeviceBgpNeighborsBgpNeighbor>
    array of BGP neighbor records with attributes:
    deviceId String
    id String
    The provider-assigned unique ID for this managed resource.
    bgpNeighbors GetDeviceBgpNeighborsBgpNeighbor[]
    array of BGP neighbor records with attributes:
    deviceId string
    id string
    The provider-assigned unique ID for this managed resource.
    bgp_neighbors Sequence[GetDeviceBgpNeighborsBgpNeighbor]
    array of BGP neighbor records with attributes:
    device_id str
    id str
    The provider-assigned unique ID for this managed resource.
    bgpNeighbors List<Property Map>
    array of BGP neighbor records with attributes:
    deviceId String
    id String
    The provider-assigned unique ID for this managed resource.

    Supporting Types

    GetDeviceBgpNeighborsBgpNeighbor

    AddressFamily int
    IP address version, 4 or 6.
    CustomerAs int
    Local autonomous system number.
    CustomerIp string
    Local used peer IP address.
    Md5Enabled bool
    Whether BGP session is password enabled.
    Md5Password string
    BGP session password in plaintext (not a checksum).
    Multihop bool
    Whether the neighbor is in EBGP multihop session.
    PeerAs int
    Peer AS number (different than customer_as for EBGP).
    RoutesIns List<GetDeviceBgpNeighborsBgpNeighborRoutesIn>
    Array of incoming routes.
    RoutesOuts List<GetDeviceBgpNeighborsBgpNeighborRoutesOut>
    Array of outgoing routes in the same format.
    PeerIps List<string>
    Array of IP addresses of this neighbor's peers.
    AddressFamily int
    IP address version, 4 or 6.
    CustomerAs int
    Local autonomous system number.
    CustomerIp string
    Local used peer IP address.
    Md5Enabled bool
    Whether BGP session is password enabled.
    Md5Password string
    BGP session password in plaintext (not a checksum).
    Multihop bool
    Whether the neighbor is in EBGP multihop session.
    PeerAs int
    Peer AS number (different than customer_as for EBGP).
    RoutesIns []GetDeviceBgpNeighborsBgpNeighborRoutesIn
    Array of incoming routes.
    RoutesOuts []GetDeviceBgpNeighborsBgpNeighborRoutesOut
    Array of outgoing routes in the same format.
    PeerIps []string
    Array of IP addresses of this neighbor's peers.
    addressFamily Integer
    IP address version, 4 or 6.
    customerAs Integer
    Local autonomous system number.
    customerIp String
    Local used peer IP address.
    md5Enabled Boolean
    Whether BGP session is password enabled.
    md5Password String
    BGP session password in plaintext (not a checksum).
    multihop Boolean
    Whether the neighbor is in EBGP multihop session.
    peerAs Integer
    Peer AS number (different than customer_as for EBGP).
    routesIns List<GetDeviceBgpNeighborsBgpNeighborRoutesIn>
    Array of incoming routes.
    routesOuts List<GetDeviceBgpNeighborsBgpNeighborRoutesOut>
    Array of outgoing routes in the same format.
    peerIps List<String>
    Array of IP addresses of this neighbor's peers.
    addressFamily number
    IP address version, 4 or 6.
    customerAs number
    Local autonomous system number.
    customerIp string
    Local used peer IP address.
    md5Enabled boolean
    Whether BGP session is password enabled.
    md5Password string
    BGP session password in plaintext (not a checksum).
    multihop boolean
    Whether the neighbor is in EBGP multihop session.
    peerAs number
    Peer AS number (different than customer_as for EBGP).
    routesIns GetDeviceBgpNeighborsBgpNeighborRoutesIn[]
    Array of incoming routes.
    routesOuts GetDeviceBgpNeighborsBgpNeighborRoutesOut[]
    Array of outgoing routes in the same format.
    peerIps string[]
    Array of IP addresses of this neighbor's peers.
    address_family int
    IP address version, 4 or 6.
    customer_as int
    Local autonomous system number.
    customer_ip str
    Local used peer IP address.
    md5_enabled bool
    Whether BGP session is password enabled.
    md5_password str
    BGP session password in plaintext (not a checksum).
    multihop bool
    Whether the neighbor is in EBGP multihop session.
    peer_as int
    Peer AS number (different than customer_as for EBGP).
    routes_ins Sequence[GetDeviceBgpNeighborsBgpNeighborRoutesIn]
    Array of incoming routes.
    routes_outs Sequence[GetDeviceBgpNeighborsBgpNeighborRoutesOut]
    Array of outgoing routes in the same format.
    peer_ips Sequence[str]
    Array of IP addresses of this neighbor's peers.
    addressFamily Number
    IP address version, 4 or 6.
    customerAs Number
    Local autonomous system number.
    customerIp String
    Local used peer IP address.
    md5Enabled Boolean
    Whether BGP session is password enabled.
    md5Password String
    BGP session password in plaintext (not a checksum).
    multihop Boolean
    Whether the neighbor is in EBGP multihop session.
    peerAs Number
    Peer AS number (different than customer_as for EBGP).
    routesIns List<Property Map>
    Array of incoming routes.
    routesOuts List<Property Map>
    Array of outgoing routes in the same format.
    peerIps List<String>
    Array of IP addresses of this neighbor's peers.

    GetDeviceBgpNeighborsBgpNeighborRoutesIn

    Exact bool
    (bool) Whether the route is exact.
    Route string
    CIDR expression of route (IP/mask).
    Exact bool
    (bool) Whether the route is exact.
    Route string
    CIDR expression of route (IP/mask).
    exact Boolean
    (bool) Whether the route is exact.
    route String
    CIDR expression of route (IP/mask).
    exact boolean
    (bool) Whether the route is exact.
    route string
    CIDR expression of route (IP/mask).
    exact bool
    (bool) Whether the route is exact.
    route str
    CIDR expression of route (IP/mask).
    exact Boolean
    (bool) Whether the route is exact.
    route String
    CIDR expression of route (IP/mask).

    GetDeviceBgpNeighborsBgpNeighborRoutesOut

    Exact bool
    (bool) Whether the route is exact.
    Route string
    CIDR expression of route (IP/mask).
    Exact bool
    (bool) Whether the route is exact.
    Route string
    CIDR expression of route (IP/mask).
    exact Boolean
    (bool) Whether the route is exact.
    route String
    CIDR expression of route (IP/mask).
    exact boolean
    (bool) Whether the route is exact.
    route string
    CIDR expression of route (IP/mask).
    exact bool
    (bool) Whether the route is exact.
    route str
    CIDR expression of route (IP/mask).
    exact Boolean
    (bool) Whether the route is exact.
    route String
    CIDR expression of route (IP/mask).

    Package Details

    Repository
    equinix equinix/pulumi-equinix
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the equinix Terraform Provider.
    equinix logo
    Equinix v0.27.1 published on Wednesday, Oct 29, 2025 by Equinix
      Meet Neo: Your AI Platform Teammate