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

netbox.Tag

Explore with Pulumi AI

From the official documentation:

Tags are user-defined labels which can be applied to a variety of objects within NetBox. They can be used to establish dimensions of organization beyond the relationships built into NetBox. For example, you might create a tag to identify a particular ownership or condition across several types of objects.

Each tag has a label, color, and a URL-friendly slug. For example, the slug for a tag named “Dunder Mifflin, Inc.” would be dunder-mifflin-inc. The slug is generated automatically and makes tags easier to work with as URL parameters. Each tag can also be assigned a description indicating its purpose.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";

const dmz = new netbox.Tag("dmz", {colorHex: "ff00ff"});
Copy
import pulumi
import pulumi_netbox as netbox

dmz = netbox.Tag("dmz", color_hex="ff00ff")
Copy
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.NewTag(ctx, "dmz", &netbox.TagArgs{
			ColorHex: pulumi.String("ff00ff"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netbox = Pulumi.Netbox;

return await Deployment.RunAsync(() => 
{
    var dmz = new Netbox.Tag("dmz", new()
    {
        ColorHex = "ff00ff",
    });

});
Copy
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 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 dmz = new Tag("dmz", TagArgs.builder()
            .colorHex("ff00ff")
            .build());

    }
}
Copy
resources:
  dmz:
    type: netbox:Tag
    properties:
      colorHex: ff00ff
Copy

Create Tag Resource

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

Constructor syntax

new Tag(name: string, args?: TagArgs, opts?: CustomResourceOptions);
@overload
def Tag(resource_name: str,
        args: Optional[TagArgs] = None,
        opts: Optional[ResourceOptions] = None)

@overload
def Tag(resource_name: str,
        opts: Optional[ResourceOptions] = None,
        color_hex: Optional[str] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        slug: Optional[str] = None,
        tag_id: Optional[str] = None,
        tags: Optional[Sequence[str]] = None)
func NewTag(ctx *Context, name string, args *TagArgs, opts ...ResourceOption) (*Tag, error)
public Tag(string name, TagArgs? args = null, CustomResourceOptions? opts = null)
public Tag(String name, TagArgs args)
public Tag(String name, TagArgs args, CustomResourceOptions options)
type: netbox:Tag
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args TagArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args TagArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args TagArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args TagArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. TagArgs
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 tagResource = new Netbox.Tag("tagResource", new()
{
    ColorHex = "string",
    Description = "string",
    Name = "string",
    Slug = "string",
    TagId = "string",
    Tags = new[]
    {
        "string",
    },
});
Copy
example, err := netbox.NewTag(ctx, "tagResource", &netbox.TagArgs{
	ColorHex:    pulumi.String("string"),
	Description: pulumi.String("string"),
	Name:        pulumi.String("string"),
	Slug:        pulumi.String("string"),
	TagId:       pulumi.String("string"),
	Tags: pulumi.StringArray{
		pulumi.String("string"),
	},
})
Copy
var tagResource = new Tag("tagResource", TagArgs.builder()
    .colorHex("string")
    .description("string")
    .name("string")
    .slug("string")
    .tagId("string")
    .tags("string")
    .build());
Copy
tag_resource = netbox.Tag("tagResource",
    color_hex="string",
    description="string",
    name="string",
    slug="string",
    tag_id="string",
    tags=["string"])
Copy
const tagResource = new netbox.Tag("tagResource", {
    colorHex: "string",
    description: "string",
    name: "string",
    slug: "string",
    tagId: "string",
    tags: ["string"],
});
Copy
type: netbox:Tag
properties:
    colorHex: string
    description: string
    name: string
    slug: string
    tagId: string
    tags:
        - string
Copy

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

ColorHex string
Defaults to 9e9e9e.
Description string
Name string
Slug string
TagId string
The ID of this resource.
Tags List<string>
ColorHex string
Defaults to 9e9e9e.
Description string
Name string
Slug string
TagId string
The ID of this resource.
Tags []string
colorHex String
Defaults to 9e9e9e.
description String
name String
slug String
tagId String
The ID of this resource.
tags List<String>
colorHex string
Defaults to 9e9e9e.
description string
name string
slug string
tagId string
The ID of this resource.
tags string[]
color_hex str
Defaults to 9e9e9e.
description str
name str
slug str
tag_id str
The ID of this resource.
tags Sequence[str]
colorHex String
Defaults to 9e9e9e.
description String
name String
slug String
tagId String
The ID of this resource.
tags List<String>

Outputs

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

Get an existing Tag 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?: TagState, opts?: CustomResourceOptions): Tag
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        color_hex: Optional[str] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        slug: Optional[str] = None,
        tag_id: Optional[str] = None,
        tags: Optional[Sequence[str]] = None) -> Tag
func GetTag(ctx *Context, name string, id IDInput, state *TagState, opts ...ResourceOption) (*Tag, error)
public static Tag Get(string name, Input<string> id, TagState? state, CustomResourceOptions? opts = null)
public static Tag get(String name, Output<String> id, TagState state, CustomResourceOptions options)
resources:  _:    type: netbox:Tag    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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
Defaults to 9e9e9e.
Description string
Name string
Slug string
TagId string
The ID of this resource.
Tags List<string>
ColorHex string
Defaults to 9e9e9e.
Description string
Name string
Slug string
TagId string
The ID of this resource.
Tags []string
colorHex String
Defaults to 9e9e9e.
description String
name String
slug String
tagId String
The ID of this resource.
tags List<String>
colorHex string
Defaults to 9e9e9e.
description string
name string
slug string
tagId string
The ID of this resource.
tags string[]
color_hex str
Defaults to 9e9e9e.
description str
name str
slug str
tag_id str
The ID of this resource.
tags Sequence[str]
colorHex String
Defaults to 9e9e9e.
description String
name String
slug String
tagId String
The ID of this resource.
tags List<String>

Package Details

Repository
netbox e-breuninger/terraform-provider-netbox
License
Notes
This Pulumi package is based on the netbox Terraform Provider.