1. Packages
  2. Netbox Provider
  3. API Docs
  4. Cluster
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

netbox.Cluster

Explore with Pulumi AI

netbox logo
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

    From the official documentation:

    A cluster is a logical grouping of physical resources within which virtual machines run. A cluster must be assigned a type (technological classification), and may optionally be assigned to a cluster group, site, and/or tenant. Each cluster must have a unique name within its assigned group and/or site, if any.

    Physical devices may be associated with clusters as hosts. This allows users to track on which host(s) a particular virtual machine may reside. However, NetBox does not support pinning a specific VM within a cluster to a particular host device.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    const dcWest = netbox.getClusterGroup({
        name: "dc-west",
    });
    const vmwVsphere = new netbox.ClusterType("vmwVsphere", {});
    const vmwCluster01 = new netbox.Cluster("vmwCluster01", {
        clusterTypeId: vmwVsphere.clusterTypeId,
        clusterGroupId: dcWest.then(dcWest => dcWest.id),
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    dc_west = netbox.get_cluster_group(name="dc-west")
    vmw_vsphere = netbox.ClusterType("vmwVsphere")
    vmw_cluster01 = netbox.Cluster("vmwCluster01",
        cluster_type_id=vmw_vsphere.cluster_type_id,
        cluster_group_id=dc_west.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v3/netbox"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		dcWest, err := netbox.LookupClusterGroup(ctx, &netbox.LookupClusterGroupArgs{
    			Name: "dc-west",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		vmwVsphere, err := netbox.NewClusterType(ctx, "vmwVsphere", nil)
    		if err != nil {
    			return err
    		}
    		_, err = netbox.NewCluster(ctx, "vmwCluster01", &netbox.ClusterArgs{
    			ClusterTypeId:  vmwVsphere.ClusterTypeId,
    			ClusterGroupId: pulumi.String(dcWest.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Netbox = Pulumi.Netbox;
    
    return await Deployment.RunAsync(() => 
    {
        var dcWest = Netbox.GetClusterGroup.Invoke(new()
        {
            Name = "dc-west",
        });
    
        var vmwVsphere = new Netbox.ClusterType("vmwVsphere");
    
        var vmwCluster01 = new Netbox.Cluster("vmwCluster01", new()
        {
            ClusterTypeId = vmwVsphere.ClusterTypeId,
            ClusterGroupId = dcWest.Apply(getClusterGroupResult => getClusterGroupResult.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.GetClusterGroupArgs;
    import com.pulumi.netbox.ClusterType;
    import com.pulumi.netbox.Cluster;
    import com.pulumi.netbox.ClusterArgs;
    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 dcWest = NetboxFunctions.getClusterGroup(GetClusterGroupArgs.builder()
                .name("dc-west")
                .build());
    
            var vmwVsphere = new ClusterType("vmwVsphere");
    
            var vmwCluster01 = new Cluster("vmwCluster01", ClusterArgs.builder()
                .clusterTypeId(vmwVsphere.clusterTypeId())
                .clusterGroupId(dcWest.applyValue(getClusterGroupResult -> getClusterGroupResult.id()))
                .build());
    
        }
    }
    
    resources:
      vmwVsphere:
        type: netbox:ClusterType
      vmwCluster01:
        type: netbox:Cluster
        properties:
          clusterTypeId: ${vmwVsphere.clusterTypeId}
          clusterGroupId: ${dcWest.id}
    variables:
      dcWest:
        fn::invoke:
          function: netbox:getClusterGroup
          arguments:
            name: dc-west
    

    Create Cluster Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Cluster(name: string, args: ClusterArgs, opts?: CustomResourceOptions);
    @overload
    def Cluster(resource_name: str,
                args: ClusterArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Cluster(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                cluster_type_id: Optional[float] = None,
                cluster_group_id: Optional[float] = None,
                cluster_id: Optional[str] = None,
                comments: Optional[str] = None,
                description: Optional[str] = None,
                name: Optional[str] = None,
                site_id: Optional[float] = None,
                tags: Optional[Sequence[str]] = None,
                tenant_id: Optional[float] = None)
    func NewCluster(ctx *Context, name string, args ClusterArgs, opts ...ResourceOption) (*Cluster, error)
    public Cluster(string name, ClusterArgs args, CustomResourceOptions? opts = null)
    public Cluster(String name, ClusterArgs args)
    public Cluster(String name, ClusterArgs args, CustomResourceOptions options)
    
    type: netbox:Cluster
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ClusterArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ClusterArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ClusterArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ClusterArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ClusterArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var clusterResource = new Netbox.Cluster("clusterResource", new()
    {
        ClusterTypeId = 0,
        ClusterGroupId = 0,
        ClusterId = "string",
        Comments = "string",
        Description = "string",
        Name = "string",
        SiteId = 0,
        Tags = new[]
        {
            "string",
        },
        TenantId = 0,
    });
    
    example, err := netbox.NewCluster(ctx, "clusterResource", &netbox.ClusterArgs{
    	ClusterTypeId:  pulumi.Float64(0),
    	ClusterGroupId: pulumi.Float64(0),
    	ClusterId:      pulumi.String("string"),
    	Comments:       pulumi.String("string"),
    	Description:    pulumi.String("string"),
    	Name:           pulumi.String("string"),
    	SiteId:         pulumi.Float64(0),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	TenantId: pulumi.Float64(0),
    })
    
    var clusterResource = new Cluster("clusterResource", ClusterArgs.builder()
        .clusterTypeId(0)
        .clusterGroupId(0)
        .clusterId("string")
        .comments("string")
        .description("string")
        .name("string")
        .siteId(0)
        .tags("string")
        .tenantId(0)
        .build());
    
    cluster_resource = netbox.Cluster("clusterResource",
        cluster_type_id=0,
        cluster_group_id=0,
        cluster_id="string",
        comments="string",
        description="string",
        name="string",
        site_id=0,
        tags=["string"],
        tenant_id=0)
    
    const clusterResource = new netbox.Cluster("clusterResource", {
        clusterTypeId: 0,
        clusterGroupId: 0,
        clusterId: "string",
        comments: "string",
        description: "string",
        name: "string",
        siteId: 0,
        tags: ["string"],
        tenantId: 0,
    });
    
    type: netbox:Cluster
    properties:
        clusterGroupId: 0
        clusterId: string
        clusterTypeId: 0
        comments: string
        description: string
        name: string
        siteId: 0
        tags:
            - string
        tenantId: 0
    

    Cluster Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Cluster resource accepts the following input properties:

    ClusterTypeId double
    ClusterGroupId double
    ClusterId string
    The ID of this resource.
    Comments string
    Description string
    Name string
    SiteId double
    Tags List<string>
    TenantId double
    ClusterTypeId float64
    ClusterGroupId float64
    ClusterId string
    The ID of this resource.
    Comments string
    Description string
    Name string
    SiteId float64
    Tags []string
    TenantId float64
    clusterTypeId Double
    clusterGroupId Double
    clusterId String
    The ID of this resource.
    comments String
    description String
    name String
    siteId Double
    tags List<String>
    tenantId Double
    clusterTypeId number
    clusterGroupId number
    clusterId string
    The ID of this resource.
    comments string
    description string
    name string
    siteId number
    tags string[]
    tenantId number
    cluster_type_id float
    cluster_group_id float
    cluster_id str
    The ID of this resource.
    comments str
    description str
    name str
    site_id float
    tags Sequence[str]
    tenant_id float
    clusterTypeId Number
    clusterGroupId Number
    clusterId String
    The ID of this resource.
    comments String
    description String
    name String
    siteId Number
    tags List<String>
    tenantId Number

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Cluster resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Cluster Resource

    Get an existing Cluster resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ClusterState, opts?: CustomResourceOptions): Cluster
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster_group_id: Optional[float] = None,
            cluster_id: Optional[str] = None,
            cluster_type_id: Optional[float] = None,
            comments: Optional[str] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            site_id: Optional[float] = None,
            tags: Optional[Sequence[str]] = None,
            tenant_id: Optional[float] = None) -> Cluster
    func GetCluster(ctx *Context, name string, id IDInput, state *ClusterState, opts ...ResourceOption) (*Cluster, error)
    public static Cluster Get(string name, Input<string> id, ClusterState? state, CustomResourceOptions? opts = null)
    public static Cluster get(String name, Output<String> id, ClusterState state, CustomResourceOptions options)
    resources:  _:    type: netbox:Cluster    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ClusterGroupId double
    ClusterId string
    The ID of this resource.
    ClusterTypeId double
    Comments string
    Description string
    Name string
    SiteId double
    Tags List<string>
    TenantId double
    ClusterGroupId float64
    ClusterId string
    The ID of this resource.
    ClusterTypeId float64
    Comments string
    Description string
    Name string
    SiteId float64
    Tags []string
    TenantId float64
    clusterGroupId Double
    clusterId String
    The ID of this resource.
    clusterTypeId Double
    comments String
    description String
    name String
    siteId Double
    tags List<String>
    tenantId Double
    clusterGroupId number
    clusterId string
    The ID of this resource.
    clusterTypeId number
    comments string
    description string
    name string
    siteId number
    tags string[]
    tenantId number
    cluster_group_id float
    cluster_id str
    The ID of this resource.
    cluster_type_id float
    comments str
    description str
    name str
    site_id float
    tags Sequence[str]
    tenant_id float
    clusterGroupId Number
    clusterId String
    The ID of this resource.
    clusterTypeId Number
    comments String
    description String
    name String
    siteId Number
    tags List<String>
    tenantId Number

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    netbox logo
    netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger