1. Packages
  2. Netbox Provider
  3. API Docs
  4. getClusters
netbox 5.1.0 published on Monday, Jan 26, 2026 by e-breuninger
netbox logo
netbox 5.1.0 published on Monday, Jan 26, 2026 by e-breuninger

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    // Get all clusters of a specific type
    const vmware = netbox.getClusterType({
        name: "VMware ESXi",
    });
    const vmwareClusters = vmware.then(vmware => netbox.getClusters({
        filters: [{
            name: "cluster_type_id",
            value: vmware.id,
        }],
    }));
    // Get clusters by name regex
    const prodClusters = netbox.getClusters({
        nameRegex: "prod-.*",
    });
    // Get clusters at a specific site
    const siteClusters = netbox.getClusters({
        filters: [{
            name: "site_id",
            value: main.id,
        }],
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    # Get all clusters of a specific type
    vmware = netbox.get_cluster_type(name="VMware ESXi")
    vmware_clusters = netbox.get_clusters(filters=[{
        "name": "cluster_type_id",
        "value": vmware.id,
    }])
    # Get clusters by name regex
    prod_clusters = netbox.get_clusters(name_regex="prod-.*")
    # Get clusters at a specific site
    site_clusters = netbox.get_clusters(filters=[{
        "name": "site_id",
        "value": main["id"],
    }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v5/netbox"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Get all clusters of a specific type
    		vmware, err := netbox.LookupClusterType(ctx, &netbox.LookupClusterTypeArgs{
    			Name: "VMware ESXi",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = netbox.GetClusters(ctx, &netbox.GetClustersArgs{
    			Filters: []netbox.GetClustersFilter{
    				{
    					Name:  "cluster_type_id",
    					Value: vmware.Id,
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Get clusters by name regex
    		_, err = netbox.GetClusters(ctx, &netbox.GetClustersArgs{
    			NameRegex: pulumi.StringRef("prod-.*"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Get clusters at a specific site
    		_, err = netbox.GetClusters(ctx, &netbox.GetClustersArgs{
    			Filters: []netbox.GetClustersFilter{
    				{
    					Name:  "site_id",
    					Value: main.Id,
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Netbox = Pulumi.Netbox;
    
    return await Deployment.RunAsync(() => 
    {
        // Get all clusters of a specific type
        var vmware = Netbox.GetClusterType.Invoke(new()
        {
            Name = "VMware ESXi",
        });
    
        var vmwareClusters = Netbox.GetClusters.Invoke(new()
        {
            Filters = new[]
            {
                new Netbox.Inputs.GetClustersFilterInputArgs
                {
                    Name = "cluster_type_id",
                    Value = vmware.Apply(getClusterTypeResult => getClusterTypeResult.Id),
                },
            },
        });
    
        // Get clusters by name regex
        var prodClusters = Netbox.GetClusters.Invoke(new()
        {
            NameRegex = "prod-.*",
        });
    
        // Get clusters at a specific site
        var siteClusters = Netbox.GetClusters.Invoke(new()
        {
            Filters = new[]
            {
                new Netbox.Inputs.GetClustersFilterInputArgs
                {
                    Name = "site_id",
                    Value = main.Id,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netbox.NetboxFunctions;
    import com.pulumi.netbox.inputs.GetClusterTypeArgs;
    import com.pulumi.netbox.inputs.GetClustersArgs;
    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) {
            // Get all clusters of a specific type
            final var vmware = NetboxFunctions.getClusterType(GetClusterTypeArgs.builder()
                .name("VMware ESXi")
                .build());
    
            final var vmwareClusters = NetboxFunctions.getClusters(GetClustersArgs.builder()
                .filters(GetClustersFilterArgs.builder()
                    .name("cluster_type_id")
                    .value(vmware.id())
                    .build())
                .build());
    
            // Get clusters by name regex
            final var prodClusters = NetboxFunctions.getClusters(GetClustersArgs.builder()
                .nameRegex("prod-.*")
                .build());
    
            // Get clusters at a specific site
            final var siteClusters = NetboxFunctions.getClusters(GetClustersArgs.builder()
                .filters(GetClustersFilterArgs.builder()
                    .name("site_id")
                    .value(main.id())
                    .build())
                .build());
    
        }
    }
    
    variables:
      # Get all clusters of a specific type
      vmware:
        fn::invoke:
          function: netbox:getClusterType
          arguments:
            name: VMware ESXi
      vmwareClusters:
        fn::invoke:
          function: netbox:getClusters
          arguments:
            filters:
              - name: cluster_type_id
                value: ${vmware.id}
      # Get clusters by name regex
      prodClusters:
        fn::invoke:
          function: netbox:getClusters
          arguments:
            nameRegex: prod-.*
      # Get clusters at a specific site
      siteClusters:
        fn::invoke:
          function: netbox:getClusters
          arguments:
            filters:
              - name: site_id
                value: ${main.id}
    

    Using getClusters

    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 getClusters(args: GetClustersArgs, opts?: InvokeOptions): Promise<GetClustersResult>
    function getClustersOutput(args: GetClustersOutputArgs, opts?: InvokeOptions): Output<GetClustersResult>
    def get_clusters(filters: Optional[Sequence[GetClustersFilter]] = None,
                     id: Optional[str] = None,
                     limit: Optional[float] = None,
                     name_regex: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetClustersResult
    def get_clusters_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetClustersFilterArgs]]]] = None,
                     id: Optional[pulumi.Input[str]] = None,
                     limit: Optional[pulumi.Input[float]] = None,
                     name_regex: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetClustersResult]
    func GetClusters(ctx *Context, args *GetClustersArgs, opts ...InvokeOption) (*GetClustersResult, error)
    func GetClustersOutput(ctx *Context, args *GetClustersOutputArgs, opts ...InvokeOption) GetClustersResultOutput

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

    public static class GetClusters 
    {
        public static Task<GetClustersResult> InvokeAsync(GetClustersArgs args, InvokeOptions? opts = null)
        public static Output<GetClustersResult> Invoke(GetClustersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetClustersResult> getClusters(GetClustersArgs args, InvokeOptions options)
    public static Output<GetClustersResult> getClusters(GetClustersArgs args, InvokeOptions options)
    
    fn::invoke:
      function: netbox:index/getClusters:getClusters
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<GetClustersFilter>
    Id string
    The ID of this resource.
    Limit double
    NameRegex string
    Filters []GetClustersFilter
    Id string
    The ID of this resource.
    Limit float64
    NameRegex string
    filters List<GetClustersFilter>
    id String
    The ID of this resource.
    limit Double
    nameRegex String
    filters GetClustersFilter[]
    id string
    The ID of this resource.
    limit number
    nameRegex string
    filters Sequence[GetClustersFilter]
    id str
    The ID of this resource.
    limit float
    name_regex str
    filters List<Property Map>
    id String
    The ID of this resource.
    limit Number
    nameRegex String

    getClusters Result

    The following output properties are available:

    Clusters []GetClustersCluster
    Id string
    The ID of this resource.
    Filters []GetClustersFilter
    Limit float64
    NameRegex string
    clusters GetClustersCluster[]
    id string
    The ID of this resource.
    filters GetClustersFilter[]
    limit number
    nameRegex string
    clusters List<Property Map>
    id String
    The ID of this resource.
    filters List<Property Map>
    limit Number
    nameRegex String

    Supporting Types

    GetClustersCluster

    ClusterGroupId double
    ClusterId double
    ClusterTypeId double
    Comments string
    CustomFields Dictionary<string, string>
    Description string
    LocationId double
    Name string
    RegionId double
    ScopeId double
    ScopeType string
    SiteGroupId double
    SiteId double
    Tags List<string>
    TenantId double
    ClusterGroupId float64
    ClusterId float64
    ClusterTypeId float64
    Comments string
    CustomFields map[string]string
    Description string
    LocationId float64
    Name string
    RegionId float64
    ScopeId float64
    ScopeType string
    SiteGroupId float64
    SiteId float64
    Tags []string
    TenantId float64
    clusterGroupId Double
    clusterId Double
    clusterTypeId Double
    comments String
    customFields Map<String,String>
    description String
    locationId Double
    name String
    regionId Double
    scopeId Double
    scopeType String
    siteGroupId Double
    siteId Double
    tags List<String>
    tenantId Double
    clusterGroupId number
    clusterId number
    clusterTypeId number
    comments string
    customFields {[key: string]: string}
    description string
    locationId number
    name string
    regionId number
    scopeId number
    scopeType string
    siteGroupId number
    siteId number
    tags string[]
    tenantId number
    cluster_group_id float
    cluster_id float
    cluster_type_id float
    comments str
    custom_fields Mapping[str, str]
    description str
    location_id float
    name str
    region_id float
    scope_id float
    scope_type str
    site_group_id float
    site_id float
    tags Sequence[str]
    tenant_id float
    clusterGroupId Number
    clusterId Number
    clusterTypeId Number
    comments String
    customFields Map<String>
    description String
    locationId Number
    name String
    regionId Number
    scopeId Number
    scopeType String
    siteGroupId Number
    siteId Number
    tags List<String>
    tenantId Number

    GetClustersFilter

    Name string
    Value string
    Name string
    Value string
    name String
    value String
    name string
    value string
    name str
    value str
    name String
    value String

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    netbox logo
    netbox 5.1.0 published on Monday, Jan 26, 2026 by e-breuninger
      Meet Neo: Your AI Platform Teammate