1. Registry
  2. Packages
  3. Netbox Provider
  4. API Docs
  5. DeviceTag
Viewing docs for netbox 5.8.0
published on Friday, Sep 4, 2026 by e-breuninger
Viewing docs for netbox 5.8.0
published on Friday, Sep 4, 2026 by e-breuninger

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    // This example attaches a tag to a device that already exists in NetBox but
    // is not otherwise managed by Terraform (e.g. it was onboarded automatically).
    const managedByTerraform = new netbox.Tag("managed_by_terraform", {name: "managed-by-terraform"});
    const example = new netbox.DeviceTag("example", {
        deviceId: 123,
        tag: managedByTerraform.name,
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    # This example attaches a tag to a device that already exists in NetBox but
    # is not otherwise managed by Terraform (e.g. it was onboarded automatically).
    managed_by_terraform = netbox.Tag("managed_by_terraform", name="managed-by-terraform")
    example = netbox.DeviceTag("example",
        device_id=123,
        tag=managed_by_terraform.name)
    
    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 {
    		// This example attaches a tag to a device that already exists in NetBox but
    		// is not otherwise managed by Terraform (e.g. it was onboarded automatically).
    		managedByTerraform, err := netbox.NewTag(ctx, "managed_by_terraform", &netbox.TagArgs{
    			Name: pulumi.String("managed-by-terraform"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = netbox.NewDeviceTag(ctx, "example", &netbox.DeviceTagArgs{
    			DeviceId: pulumi.Float64(123),
    			Tag:      managedByTerraform.Name,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Netbox = Pulumi.Netbox;
    
    return await Deployment.RunAsync(() => 
    {
        // This example attaches a tag to a device that already exists in NetBox but
        // is not otherwise managed by Terraform (e.g. it was onboarded automatically).
        var managedByTerraform = new Netbox.Tag("managed_by_terraform", new()
        {
            Name = "managed-by-terraform",
        });
    
        var example = new Netbox.DeviceTag("example", new()
        {
            DeviceId = 123,
            Tag = managedByTerraform.Name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netbox.Tag;
    import com.pulumi.netbox.TagArgs;
    import com.pulumi.netbox.DeviceTag;
    import com.pulumi.netbox.DeviceTagArgs;
    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) {
            // This example attaches a tag to a device that already exists in NetBox but
            // is not otherwise managed by Terraform (e.g. it was onboarded automatically).
            var managedByTerraform = new Tag("managedByTerraform", TagArgs.builder()
                .name("managed-by-terraform")
                .build());
    
            var example = new DeviceTag("example", DeviceTagArgs.builder()
                .deviceId(123.0)
                .tag(managedByTerraform.name())
                .build());
    
        }
    }
    
    resources:
      # This example attaches a tag to a device that already exists in NetBox but
      # is not otherwise managed by Terraform (e.g. it was onboarded automatically).
      managedByTerraform:
        type: netbox:Tag
        name: managed_by_terraform
        properties:
          name: managed-by-terraform
      example:
        type: netbox:DeviceTag
        properties:
          deviceId: 123
          tag: ${managedByTerraform.name}
    
    Example coming soon!
    

    Create DeviceTag Resource

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

    Constructor syntax

    new DeviceTag(name: string, args: DeviceTagArgs, opts?: CustomResourceOptions);
    @overload
    def DeviceTag(resource_name: str,
                  args: DeviceTagArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def DeviceTag(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  device_id: Optional[float] = None,
                  tag: Optional[str] = None,
                  device_tag_id: Optional[str] = None)
    func NewDeviceTag(ctx *Context, name string, args DeviceTagArgs, opts ...ResourceOption) (*DeviceTag, error)
    public DeviceTag(string name, DeviceTagArgs args, CustomResourceOptions? opts = null)
    public DeviceTag(String name, DeviceTagArgs args)
    public DeviceTag(String name, DeviceTagArgs args, CustomResourceOptions options)
    
    type: netbox:DeviceTag
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "netbox_device_tag" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args DeviceTagArgs
    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 DeviceTagArgs
    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 DeviceTagArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DeviceTagArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DeviceTagArgs
    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 deviceTagResource = new Netbox.DeviceTag("deviceTagResource", new()
    {
        DeviceId = 0.0,
        Tag = "string",
        DeviceTagId = "string",
    });
    
    example, err := netbox.NewDeviceTag(ctx, "deviceTagResource", &netbox.DeviceTagArgs{
    	DeviceId:    pulumi.Float64(0),
    	Tag:         pulumi.String("string"),
    	DeviceTagId: pulumi.String("string"),
    })
    
    resource "netbox_device_tag" "deviceTagResource" {
      lifecycle {
        create_before_destroy = true
      }
      device_id     = 0
      tag           = "string"
      device_tag_id = "string"
    }
    
    var deviceTagResource = new DeviceTag("deviceTagResource", DeviceTagArgs.builder()
        .deviceId(0.0)
        .tag("string")
        .deviceTagId("string")
        .build());
    
    device_tag_resource = netbox.DeviceTag("deviceTagResource",
        device_id=float(0),
        tag="string",
        device_tag_id="string")
    
    const deviceTagResource = new netbox.DeviceTag("deviceTagResource", {
        deviceId: 0,
        tag: "string",
        deviceTagId: "string",
    });
    
    type: netbox:DeviceTag
    properties:
        deviceId: 0
        deviceTagId: string
        tag: string
    

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

    DeviceId double
    Tag string
    DeviceTagId string
    The ID of this resource.
    DeviceId float64
    Tag string
    DeviceTagId string
    The ID of this resource.
    device_id number
    tag string
    device_tag_id string
    The ID of this resource.
    deviceId Double
    tag String
    deviceTagId String
    The ID of this resource.
    deviceId number
    tag string
    deviceTagId string
    The ID of this resource.
    device_id float
    tag str
    device_tag_id str
    The ID of this resource.
    deviceId Number
    tag String
    deviceTagId String
    The ID of this resource.

    Outputs

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

    Get an existing DeviceTag 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?: DeviceTagState, opts?: CustomResourceOptions): DeviceTag
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            device_id: Optional[float] = None,
            device_tag_id: Optional[str] = None,
            tag: Optional[str] = None) -> DeviceTag
    func GetDeviceTag(ctx *Context, name string, id IDInput, state *DeviceTagState, opts ...ResourceOption) (*DeviceTag, error)
    public static DeviceTag Get(string name, Input<string> id, DeviceTagState? state, CustomResourceOptions? opts = null)
    public static DeviceTag get(String name, Output<String> id, DeviceTagState state, CustomResourceOptions options)
    resources:  _:    type: netbox:DeviceTag    get:      id: ${id}
    import {
      to = netbox_device_tag.example
      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:
    DeviceId double
    DeviceTagId string
    The ID of this resource.
    Tag string
    DeviceId float64
    DeviceTagId string
    The ID of this resource.
    Tag string
    device_id number
    device_tag_id string
    The ID of this resource.
    tag string
    deviceId Double
    deviceTagId String
    The ID of this resource.
    tag String
    deviceId number
    deviceTagId string
    The ID of this resource.
    tag string
    device_id float
    device_tag_id str
    The ID of this resource.
    tag str
    deviceId Number
    deviceTagId String
    The ID of this resource.
    tag String

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    Viewing docs for netbox 5.8.0
    published on Friday, Sep 4, 2026 by e-breuninger

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial