netbox.CustomField
Explore with Pulumi AI
From the official documentation:
Each model in NetBox is represented in the database as a discrete table, and each attribute of a model exists as a column within its table. For example, sites are stored in the dcim_site table, which has columns named name, facility, physical_address, and so on. As new attributes are added to objects throughout the development of NetBox, tables are expanded to include new rows.
However, some users might want to store additional object attributes that are somewhat esoteric in nature, and that would not make sense to include in the core NetBox database schema. For instance, suppose your organization needs to associate each device with a ticket number correlating it with an internal support system record. This is certainly a legitimate use for NetBox, but it’s not a common enough need to warrant including a field for every NetBox installation. Instead, you can create a custom field to hold this data.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";
const test = new netbox.CustomField("test", {
contentTypes: ["virtualization.vminterface"],
type: "text",
validationRegex: "^.*$",
weight: 100,
});
import pulumi
import pulumi_netbox as netbox
test = netbox.CustomField("test",
content_types=["virtualization.vminterface"],
type="text",
validation_regex="^.*$",
weight=100)
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.NewCustomField(ctx, "test", &netbox.CustomFieldArgs{
ContentTypes: pulumi.StringArray{
pulumi.String("virtualization.vminterface"),
},
Type: pulumi.String("text"),
ValidationRegex: pulumi.String("^.*$"),
Weight: pulumi.Float64(100),
})
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 test = new Netbox.CustomField("test", new()
{
ContentTypes = new[]
{
"virtualization.vminterface",
},
Type = "text",
ValidationRegex = "^.*$",
Weight = 100,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.CustomField;
import com.pulumi.netbox.CustomFieldArgs;
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 test = new CustomField("test", CustomFieldArgs.builder()
.contentTypes("virtualization.vminterface")
.type("text")
.validationRegex("^.*$")
.weight(100)
.build());
}
}
resources:
test:
type: netbox:CustomField
properties:
contentTypes:
- virtualization.vminterface
type: text
validationRegex: ^.*$
weight: 100
Create CustomField Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CustomField(name: string, args: CustomFieldArgs, opts?: CustomResourceOptions);
@overload
def CustomField(resource_name: str,
args: CustomFieldArgs,
opts: Optional[ResourceOptions] = None)
@overload
def CustomField(resource_name: str,
opts: Optional[ResourceOptions] = None,
type: Optional[str] = None,
content_types: Optional[Sequence[str]] = None,
default: Optional[str] = None,
choice_set_id: Optional[float] = None,
description: Optional[str] = None,
group_name: Optional[str] = None,
label: Optional[str] = None,
name: Optional[str] = None,
required: Optional[bool] = None,
custom_field_id: Optional[str] = None,
validation_maximum: Optional[float] = None,
validation_minimum: Optional[float] = None,
validation_regex: Optional[str] = None,
weight: Optional[float] = None)
func NewCustomField(ctx *Context, name string, args CustomFieldArgs, opts ...ResourceOption) (*CustomField, error)
public CustomField(string name, CustomFieldArgs args, CustomResourceOptions? opts = null)
public CustomField(String name, CustomFieldArgs args)
public CustomField(String name, CustomFieldArgs args, CustomResourceOptions options)
type: netbox:CustomField
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 CustomFieldArgs
- 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 CustomFieldArgs
- 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 CustomFieldArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CustomFieldArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CustomFieldArgs
- 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 customFieldResource = new Netbox.CustomField("customFieldResource", new()
{
Type = "string",
ContentTypes = new[]
{
"string",
},
Default = "string",
ChoiceSetId = 0,
Description = "string",
GroupName = "string",
Label = "string",
Name = "string",
Required = false,
CustomFieldId = "string",
ValidationMaximum = 0,
ValidationMinimum = 0,
ValidationRegex = "string",
Weight = 0,
});
example, err := netbox.NewCustomField(ctx, "customFieldResource", &netbox.CustomFieldArgs{
Type: pulumi.String("string"),
ContentTypes: pulumi.StringArray{
pulumi.String("string"),
},
Default: pulumi.String("string"),
ChoiceSetId: pulumi.Float64(0),
Description: pulumi.String("string"),
GroupName: pulumi.String("string"),
Label: pulumi.String("string"),
Name: pulumi.String("string"),
Required: pulumi.Bool(false),
CustomFieldId: pulumi.String("string"),
ValidationMaximum: pulumi.Float64(0),
ValidationMinimum: pulumi.Float64(0),
ValidationRegex: pulumi.String("string"),
Weight: pulumi.Float64(0),
})
var customFieldResource = new CustomField("customFieldResource", CustomFieldArgs.builder()
.type("string")
.contentTypes("string")
.default_("string")
.choiceSetId(0)
.description("string")
.groupName("string")
.label("string")
.name("string")
.required(false)
.customFieldId("string")
.validationMaximum(0)
.validationMinimum(0)
.validationRegex("string")
.weight(0)
.build());
custom_field_resource = netbox.CustomField("customFieldResource",
type="string",
content_types=["string"],
default="string",
choice_set_id=0,
description="string",
group_name="string",
label="string",
name="string",
required=False,
custom_field_id="string",
validation_maximum=0,
validation_minimum=0,
validation_regex="string",
weight=0)
const customFieldResource = new netbox.CustomField("customFieldResource", {
type: "string",
contentTypes: ["string"],
"default": "string",
choiceSetId: 0,
description: "string",
groupName: "string",
label: "string",
name: "string",
required: false,
customFieldId: "string",
validationMaximum: 0,
validationMinimum: 0,
validationRegex: "string",
weight: 0,
});
type: netbox:CustomField
properties:
choiceSetId: 0
contentTypes:
- string
customFieldId: string
default: string
description: string
groupName: string
label: string
name: string
required: false
type: string
validationMaximum: 0
validationMinimum: 0
validationRegex: string
weight: 0
CustomField 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 CustomField resource accepts the following input properties:
- Content
Types List<string> - Type string
- Choice
Set doubleId - Custom
Field stringId - The ID of this resource.
- Default string
- Description string
- Group
Name string - Label string
- Name string
- Required bool
- Validation
Maximum double - Validation
Minimum double - Validation
Regex string - Weight double
- Content
Types []string - Type string
- Choice
Set float64Id - Custom
Field stringId - The ID of this resource.
- Default string
- Description string
- Group
Name string - Label string
- Name string
- Required bool
- Validation
Maximum float64 - Validation
Minimum float64 - Validation
Regex string - Weight float64
- content
Types List<String> - type String
- choice
Set DoubleId - custom
Field StringId - The ID of this resource.
- default_ String
- description String
- group
Name String - label String
- name String
- required Boolean
- validation
Maximum Double - validation
Minimum Double - validation
Regex String - weight Double
- content
Types string[] - type string
- choice
Set numberId - custom
Field stringId - The ID of this resource.
- default string
- description string
- group
Name string - label string
- name string
- required boolean
- validation
Maximum number - validation
Minimum number - validation
Regex string - weight number
- content_
types Sequence[str] - type str
- choice_
set_ floatid - custom_
field_ strid - The ID of this resource.
- default str
- description str
- group_
name str - label str
- name str
- required bool
- validation_
maximum float - validation_
minimum float - validation_
regex str - weight float
- content
Types List<String> - type String
- choice
Set NumberId - custom
Field StringId - The ID of this resource.
- default String
- description String
- group
Name String - label String
- name String
- required Boolean
- validation
Maximum Number - validation
Minimum Number - validation
Regex String - weight Number
Outputs
All input properties are implicitly available as output properties. Additionally, the CustomField 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 CustomField Resource
Get an existing CustomField 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?: CustomFieldState, opts?: CustomResourceOptions): CustomField
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
choice_set_id: Optional[float] = None,
content_types: Optional[Sequence[str]] = None,
custom_field_id: Optional[str] = None,
default: Optional[str] = None,
description: Optional[str] = None,
group_name: Optional[str] = None,
label: Optional[str] = None,
name: Optional[str] = None,
required: Optional[bool] = None,
type: Optional[str] = None,
validation_maximum: Optional[float] = None,
validation_minimum: Optional[float] = None,
validation_regex: Optional[str] = None,
weight: Optional[float] = None) -> CustomField
func GetCustomField(ctx *Context, name string, id IDInput, state *CustomFieldState, opts ...ResourceOption) (*CustomField, error)
public static CustomField Get(string name, Input<string> id, CustomFieldState? state, CustomResourceOptions? opts = null)
public static CustomField get(String name, Output<String> id, CustomFieldState state, CustomResourceOptions options)
resources: _: type: netbox:CustomField 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.
- Choice
Set doubleId - Content
Types List<string> - Custom
Field stringId - The ID of this resource.
- Default string
- Description string
- Group
Name string - Label string
- Name string
- Required bool
- Type string
- Validation
Maximum double - Validation
Minimum double - Validation
Regex string - Weight double
- Choice
Set float64Id - Content
Types []string - Custom
Field stringId - The ID of this resource.
- Default string
- Description string
- Group
Name string - Label string
- Name string
- Required bool
- Type string
- Validation
Maximum float64 - Validation
Minimum float64 - Validation
Regex string - Weight float64
- choice
Set DoubleId - content
Types List<String> - custom
Field StringId - The ID of this resource.
- default_ String
- description String
- group
Name String - label String
- name String
- required Boolean
- type String
- validation
Maximum Double - validation
Minimum Double - validation
Regex String - weight Double
- choice
Set numberId - content
Types string[] - custom
Field stringId - The ID of this resource.
- default string
- description string
- group
Name string - label string
- name string
- required boolean
- type string
- validation
Maximum number - validation
Minimum number - validation
Regex string - weight number
- choice_
set_ floatid - content_
types Sequence[str] - custom_
field_ strid - The ID of this resource.
- default str
- description str
- group_
name str - label str
- name str
- required bool
- type str
- validation_
maximum float - validation_
minimum float - validation_
regex str - weight float
- choice
Set NumberId - content
Types List<String> - custom
Field StringId - The ID of this resource.
- default String
- description String
- group
Name String - label String
- name String
- required Boolean
- type String
- validation
Maximum Number - validation
Minimum Number - validation
Regex String - weight Number
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the
netbox
Terraform Provider.