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

netbox.DeviceRole

Explore with Pulumi AI

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

    From the official documentation:

    Devices can be organized by functional roles, which are fully customizable by the user. For example, you might create roles for core switches, distribution switches, and access switches within your network.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    const coreSw = new netbox.DeviceRole("coreSw", {colorHex: "FF00FF"});
    
    import pulumi
    import pulumi_netbox as netbox
    
    core_sw = netbox.DeviceRole("coreSw", color_hex="FF00FF")
    
    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 {
    		_, err := netbox.NewDeviceRole(ctx, "coreSw", &netbox.DeviceRoleArgs{
    			ColorHex: pulumi.String("FF00FF"),
    		})
    		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 coreSw = new Netbox.DeviceRole("coreSw", new()
        {
            ColorHex = "FF00FF",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netbox.DeviceRole;
    import com.pulumi.netbox.DeviceRoleArgs;
    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) {
            var coreSw = new DeviceRole("coreSw", DeviceRoleArgs.builder()
                .colorHex("FF00FF")
                .build());
    
        }
    }
    
    resources:
      coreSw:
        type: netbox:DeviceRole
        properties:
          colorHex: FF00FF
    

    Create DeviceRole Resource

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

    Constructor syntax

    new DeviceRole(name: string, args: DeviceRoleArgs, opts?: CustomResourceOptions);
    @overload
    def DeviceRole(resource_name: str,
                   args: DeviceRoleArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def DeviceRole(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   color_hex: Optional[str] = None,
                   description: Optional[str] = None,
                   device_role_id: Optional[str] = None,
                   name: Optional[str] = None,
                   slug: Optional[str] = None,
                   tags: Optional[Sequence[str]] = None,
                   vm_role: Optional[bool] = None)
    func NewDeviceRole(ctx *Context, name string, args DeviceRoleArgs, opts ...ResourceOption) (*DeviceRole, error)
    public DeviceRole(string name, DeviceRoleArgs args, CustomResourceOptions? opts = null)
    public DeviceRole(String name, DeviceRoleArgs args)
    public DeviceRole(String name, DeviceRoleArgs args, CustomResourceOptions options)
    
    type: netbox:DeviceRole
    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 DeviceRoleArgs
    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 DeviceRoleArgs
    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 DeviceRoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DeviceRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DeviceRoleArgs
    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 deviceRoleResource = new Netbox.DeviceRole("deviceRoleResource", new()
    {
        ColorHex = "string",
        Description = "string",
        DeviceRoleId = "string",
        Name = "string",
        Slug = "string",
        Tags = new[]
        {
            "string",
        },
        VmRole = false,
    });
    
    example, err := netbox.NewDeviceRole(ctx, "deviceRoleResource", &netbox.DeviceRoleArgs{
    	ColorHex:     pulumi.String("string"),
    	Description:  pulumi.String("string"),
    	DeviceRoleId: pulumi.String("string"),
    	Name:         pulumi.String("string"),
    	Slug:         pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	VmRole: pulumi.Bool(false),
    })
    
    var deviceRoleResource = new DeviceRole("deviceRoleResource", DeviceRoleArgs.builder()
        .colorHex("string")
        .description("string")
        .deviceRoleId("string")
        .name("string")
        .slug("string")
        .tags("string")
        .vmRole(false)
        .build());
    
    device_role_resource = netbox.DeviceRole("deviceRoleResource",
        color_hex="string",
        description="string",
        device_role_id="string",
        name="string",
        slug="string",
        tags=["string"],
        vm_role=False)
    
    const deviceRoleResource = new netbox.DeviceRole("deviceRoleResource", {
        colorHex: "string",
        description: "string",
        deviceRoleId: "string",
        name: "string",
        slug: "string",
        tags: ["string"],
        vmRole: false,
    });
    
    type: netbox:DeviceRole
    properties:
        colorHex: string
        description: string
        deviceRoleId: string
        name: string
        slug: string
        tags:
            - string
        vmRole: false
    

    DeviceRole 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 DeviceRole resource accepts the following input properties:

    ColorHex string
    Description string
    DeviceRoleId string
    The ID of this resource.
    Name string
    Slug string
    Tags List<string>
    VmRole bool
    Defaults to true.
    ColorHex string
    Description string
    DeviceRoleId string
    The ID of this resource.
    Name string
    Slug string
    Tags []string
    VmRole bool
    Defaults to true.
    colorHex String
    description String
    deviceRoleId String
    The ID of this resource.
    name String
    slug String
    tags List<String>
    vmRole Boolean
    Defaults to true.
    colorHex string
    description string
    deviceRoleId string
    The ID of this resource.
    name string
    slug string
    tags string[]
    vmRole boolean
    Defaults to true.
    color_hex str
    description str
    device_role_id str
    The ID of this resource.
    name str
    slug str
    tags Sequence[str]
    vm_role bool
    Defaults to true.
    colorHex String
    description String
    deviceRoleId String
    The ID of this resource.
    name String
    slug String
    tags List<String>
    vmRole Boolean
    Defaults to true.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the DeviceRole 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 DeviceRole Resource

    Get an existing DeviceRole 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?: DeviceRoleState, opts?: CustomResourceOptions): DeviceRole
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            color_hex: Optional[str] = None,
            description: Optional[str] = None,
            device_role_id: Optional[str] = None,
            name: Optional[str] = None,
            slug: Optional[str] = None,
            tags: Optional[Sequence[str]] = None,
            vm_role: Optional[bool] = None) -> DeviceRole
    func GetDeviceRole(ctx *Context, name string, id IDInput, state *DeviceRoleState, opts ...ResourceOption) (*DeviceRole, error)
    public static DeviceRole Get(string name, Input<string> id, DeviceRoleState? state, CustomResourceOptions? opts = null)
    public static DeviceRole get(String name, Output<String> id, DeviceRoleState state, CustomResourceOptions options)
    resources:  _:    type: netbox:DeviceRole    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:
    ColorHex string
    Description string
    DeviceRoleId string
    The ID of this resource.
    Name string
    Slug string
    Tags List<string>
    VmRole bool
    Defaults to true.
    ColorHex string
    Description string
    DeviceRoleId string
    The ID of this resource.
    Name string
    Slug string
    Tags []string
    VmRole bool
    Defaults to true.
    colorHex String
    description String
    deviceRoleId String
    The ID of this resource.
    name String
    slug String
    tags List<String>
    vmRole Boolean
    Defaults to true.
    colorHex string
    description string
    deviceRoleId string
    The ID of this resource.
    name string
    slug string
    tags string[]
    vmRole boolean
    Defaults to true.
    color_hex str
    description str
    device_role_id str
    The ID of this resource.
    name str
    slug str
    tags Sequence[str]
    vm_role bool
    Defaults to true.
    colorHex String
    description String
    deviceRoleId String
    The ID of this resource.
    name String
    slug String
    tags List<String>
    vmRole Boolean
    Defaults to true.

    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