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

netbox.CustomFieldChoiceSet

Explore with Pulumi AI

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

    From the official documentation:

    Single- and multi-selection custom fields must define a set of valid choices from which the user may choose when defining the field value. These choices are defined as sets that may be reused among multiple custom fields.

    A choice set must define a base choice set and/or a set of arbitrary extra choices.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    const test = new netbox.CustomFieldChoiceSet("test", {
        description: "Description",
        extraChoices: [
            "choice1",
            "label1",
            "choice2",
            "choice2",
        ],
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    test = netbox.CustomFieldChoiceSet("test",
        description="Description",
        extra_choices=[
            "choice1",
            "label1",
            "choice2",
            "choice2",
        ])
    
    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.NewCustomFieldChoiceSet(ctx, "test", &netbox.CustomFieldChoiceSetArgs{
    			Description: pulumi.String("Description"),
    			ExtraChoices: pulumi.StringArrayArray{
    				pulumi.StringArray("choice1"),
    				pulumi.StringArray("label1"),
    				pulumi.StringArray("choice2"),
    				pulumi.StringArray("choice2"),
    			},
    		})
    		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.CustomFieldChoiceSet("test", new()
        {
            Description = "Description",
            ExtraChoices = new[]
            {
                "choice1",
                "label1",
                "choice2",
                "choice2",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netbox.CustomFieldChoiceSet;
    import com.pulumi.netbox.CustomFieldChoiceSetArgs;
    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 CustomFieldChoiceSet("test", CustomFieldChoiceSetArgs.builder()
                .description("Description")
                .extraChoices(            
                    "choice1",
                    "label1",
                    "choice2",
                    "choice2")
                .build());
    
        }
    }
    
    resources:
      test:
        type: netbox:CustomFieldChoiceSet
        properties:
          description: Description
          extraChoices:
            - choice1
            - label1
            - choice2
            - choice2
    

    Create CustomFieldChoiceSet Resource

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

    Constructor syntax

    new CustomFieldChoiceSet(name: string, args?: CustomFieldChoiceSetArgs, opts?: CustomResourceOptions);
    @overload
    def CustomFieldChoiceSet(resource_name: str,
                             args: Optional[CustomFieldChoiceSetArgs] = None,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def CustomFieldChoiceSet(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             base_choices: Optional[str] = None,
                             custom_field_choice_set_id: Optional[str] = None,
                             custom_fields: Optional[Mapping[str, str]] = None,
                             description: Optional[str] = None,
                             extra_choices: Optional[Sequence[Sequence[str]]] = None,
                             name: Optional[str] = None,
                             order_alphabetically: Optional[bool] = None)
    func NewCustomFieldChoiceSet(ctx *Context, name string, args *CustomFieldChoiceSetArgs, opts ...ResourceOption) (*CustomFieldChoiceSet, error)
    public CustomFieldChoiceSet(string name, CustomFieldChoiceSetArgs? args = null, CustomResourceOptions? opts = null)
    public CustomFieldChoiceSet(String name, CustomFieldChoiceSetArgs args)
    public CustomFieldChoiceSet(String name, CustomFieldChoiceSetArgs args, CustomResourceOptions options)
    
    type: netbox:CustomFieldChoiceSet
    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 CustomFieldChoiceSetArgs
    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 CustomFieldChoiceSetArgs
    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 CustomFieldChoiceSetArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CustomFieldChoiceSetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CustomFieldChoiceSetArgs
    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 customFieldChoiceSetResource = new Netbox.CustomFieldChoiceSet("customFieldChoiceSetResource", new()
    {
        BaseChoices = "string",
        CustomFieldChoiceSetId = "string",
        CustomFields = 
        {
            { "string", "string" },
        },
        Description = "string",
        ExtraChoices = new[]
        {
            new[]
            {
                "string",
            },
        },
        Name = "string",
        OrderAlphabetically = false,
    });
    
    example, err := netbox.NewCustomFieldChoiceSet(ctx, "customFieldChoiceSetResource", &netbox.CustomFieldChoiceSetArgs{
    	BaseChoices:            pulumi.String("string"),
    	CustomFieldChoiceSetId: pulumi.String("string"),
    	CustomFields: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Description: pulumi.String("string"),
    	ExtraChoices: pulumi.StringArrayArray{
    		pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	Name:                pulumi.String("string"),
    	OrderAlphabetically: pulumi.Bool(false),
    })
    
    var customFieldChoiceSetResource = new CustomFieldChoiceSet("customFieldChoiceSetResource", CustomFieldChoiceSetArgs.builder()
        .baseChoices("string")
        .customFieldChoiceSetId("string")
        .customFields(Map.of("string", "string"))
        .description("string")
        .extraChoices("string")
        .name("string")
        .orderAlphabetically(false)
        .build());
    
    custom_field_choice_set_resource = netbox.CustomFieldChoiceSet("customFieldChoiceSetResource",
        base_choices="string",
        custom_field_choice_set_id="string",
        custom_fields={
            "string": "string",
        },
        description="string",
        extra_choices=[["string"]],
        name="string",
        order_alphabetically=False)
    
    const customFieldChoiceSetResource = new netbox.CustomFieldChoiceSet("customFieldChoiceSetResource", {
        baseChoices: "string",
        customFieldChoiceSetId: "string",
        customFields: {
            string: "string",
        },
        description: "string",
        extraChoices: [["string"]],
        name: "string",
        orderAlphabetically: false,
    });
    
    type: netbox:CustomFieldChoiceSet
    properties:
        baseChoices: string
        customFieldChoiceSetId: string
        customFields:
            string: string
        description: string
        extraChoices:
            - - string
        name: string
        orderAlphabetically: false
    

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

    BaseChoices string
    Valid values are IATA, ISO_3166 and UN_LOCODE. At least one of base_choices or extra_choices must be given.
    CustomFieldChoiceSetId string
    The ID of this resource.
    CustomFields Dictionary<string, string>
    Description string
    ExtraChoices List<ImmutableArray<string>>
    This length of the inner lists must be exactly two, where the first value is the value of a choice and the second value is the label of the choice. At least one of base_choices or extra_choices must be given.
    Name string
    OrderAlphabetically bool
    experimental. Defaults to false.
    BaseChoices string
    Valid values are IATA, ISO_3166 and UN_LOCODE. At least one of base_choices or extra_choices must be given.
    CustomFieldChoiceSetId string
    The ID of this resource.
    CustomFields map[string]string
    Description string
    ExtraChoices [][]string
    This length of the inner lists must be exactly two, where the first value is the value of a choice and the second value is the label of the choice. At least one of base_choices or extra_choices must be given.
    Name string
    OrderAlphabetically bool
    experimental. Defaults to false.
    baseChoices String
    Valid values are IATA, ISO_3166 and UN_LOCODE. At least one of base_choices or extra_choices must be given.
    customFieldChoiceSetId String
    The ID of this resource.
    customFields Map<String,String>
    description String
    extraChoices List<List<String>>
    This length of the inner lists must be exactly two, where the first value is the value of a choice and the second value is the label of the choice. At least one of base_choices or extra_choices must be given.
    name String
    orderAlphabetically Boolean
    experimental. Defaults to false.
    baseChoices string
    Valid values are IATA, ISO_3166 and UN_LOCODE. At least one of base_choices or extra_choices must be given.
    customFieldChoiceSetId string
    The ID of this resource.
    customFields {[key: string]: string}
    description string
    extraChoices string[][]
    This length of the inner lists must be exactly two, where the first value is the value of a choice and the second value is the label of the choice. At least one of base_choices or extra_choices must be given.
    name string
    orderAlphabetically boolean
    experimental. Defaults to false.
    base_choices str
    Valid values are IATA, ISO_3166 and UN_LOCODE. At least one of base_choices or extra_choices must be given.
    custom_field_choice_set_id str
    The ID of this resource.
    custom_fields Mapping[str, str]
    description str
    extra_choices Sequence[Sequence[str]]
    This length of the inner lists must be exactly two, where the first value is the value of a choice and the second value is the label of the choice. At least one of base_choices or extra_choices must be given.
    name str
    order_alphabetically bool
    experimental. Defaults to false.
    baseChoices String
    Valid values are IATA, ISO_3166 and UN_LOCODE. At least one of base_choices or extra_choices must be given.
    customFieldChoiceSetId String
    The ID of this resource.
    customFields Map<String>
    description String
    extraChoices List<List<String>>
    This length of the inner lists must be exactly two, where the first value is the value of a choice and the second value is the label of the choice. At least one of base_choices or extra_choices must be given.
    name String
    orderAlphabetically Boolean
    experimental. Defaults to false.

    Outputs

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

    Get an existing CustomFieldChoiceSet 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?: CustomFieldChoiceSetState, opts?: CustomResourceOptions): CustomFieldChoiceSet
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            base_choices: Optional[str] = None,
            custom_field_choice_set_id: Optional[str] = None,
            custom_fields: Optional[Mapping[str, str]] = None,
            description: Optional[str] = None,
            extra_choices: Optional[Sequence[Sequence[str]]] = None,
            name: Optional[str] = None,
            order_alphabetically: Optional[bool] = None) -> CustomFieldChoiceSet
    func GetCustomFieldChoiceSet(ctx *Context, name string, id IDInput, state *CustomFieldChoiceSetState, opts ...ResourceOption) (*CustomFieldChoiceSet, error)
    public static CustomFieldChoiceSet Get(string name, Input<string> id, CustomFieldChoiceSetState? state, CustomResourceOptions? opts = null)
    public static CustomFieldChoiceSet get(String name, Output<String> id, CustomFieldChoiceSetState state, CustomResourceOptions options)
    resources:  _:    type: netbox:CustomFieldChoiceSet    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:
    BaseChoices string
    Valid values are IATA, ISO_3166 and UN_LOCODE. At least one of base_choices or extra_choices must be given.
    CustomFieldChoiceSetId string
    The ID of this resource.
    CustomFields Dictionary<string, string>
    Description string
    ExtraChoices List<ImmutableArray<string>>
    This length of the inner lists must be exactly two, where the first value is the value of a choice and the second value is the label of the choice. At least one of base_choices or extra_choices must be given.
    Name string
    OrderAlphabetically bool
    experimental. Defaults to false.
    BaseChoices string
    Valid values are IATA, ISO_3166 and UN_LOCODE. At least one of base_choices or extra_choices must be given.
    CustomFieldChoiceSetId string
    The ID of this resource.
    CustomFields map[string]string
    Description string
    ExtraChoices [][]string
    This length of the inner lists must be exactly two, where the first value is the value of a choice and the second value is the label of the choice. At least one of base_choices or extra_choices must be given.
    Name string
    OrderAlphabetically bool
    experimental. Defaults to false.
    baseChoices String
    Valid values are IATA, ISO_3166 and UN_LOCODE. At least one of base_choices or extra_choices must be given.
    customFieldChoiceSetId String
    The ID of this resource.
    customFields Map<String,String>
    description String
    extraChoices List<List<String>>
    This length of the inner lists must be exactly two, where the first value is the value of a choice and the second value is the label of the choice. At least one of base_choices or extra_choices must be given.
    name String
    orderAlphabetically Boolean
    experimental. Defaults to false.
    baseChoices string
    Valid values are IATA, ISO_3166 and UN_LOCODE. At least one of base_choices or extra_choices must be given.
    customFieldChoiceSetId string
    The ID of this resource.
    customFields {[key: string]: string}
    description string
    extraChoices string[][]
    This length of the inner lists must be exactly two, where the first value is the value of a choice and the second value is the label of the choice. At least one of base_choices or extra_choices must be given.
    name string
    orderAlphabetically boolean
    experimental. Defaults to false.
    base_choices str
    Valid values are IATA, ISO_3166 and UN_LOCODE. At least one of base_choices or extra_choices must be given.
    custom_field_choice_set_id str
    The ID of this resource.
    custom_fields Mapping[str, str]
    description str
    extra_choices Sequence[Sequence[str]]
    This length of the inner lists must be exactly two, where the first value is the value of a choice and the second value is the label of the choice. At least one of base_choices or extra_choices must be given.
    name str
    order_alphabetically bool
    experimental. Defaults to false.
    baseChoices String
    Valid values are IATA, ISO_3166 and UN_LOCODE. At least one of base_choices or extra_choices must be given.
    customFieldChoiceSetId String
    The ID of this resource.
    customFields Map<String>
    description String
    extraChoices List<List<String>>
    This length of the inner lists must be exactly two, where the first value is the value of a choice and the second value is the label of the choice. At least one of base_choices or extra_choices must be given.
    name String
    orderAlphabetically Boolean
    experimental. Defaults to false.

    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