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

netbox.ConfigContext

Explore with Pulumi AI

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

    From the official documentation:

    Context data is made available to devices and/or virtual machines based on their relationships to other objects in NetBox. For example, context data can be associated only with devices assigned to a particular site, or only to virtual machines in a certain cluster.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    const test = new netbox.ConfigContext("test", {data: JSON.stringify({
        testkey: "testval",
    })});
    
    import pulumi
    import json
    import pulumi_netbox as netbox
    
    test = netbox.ConfigContext("test", data=json.dumps({
        "testkey": "testval",
    }))
    
    package main
    
    import (
    	"encoding/json"
    
    	"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 {
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"testkey": "testval",
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = netbox.NewConfigContext(ctx, "test", &netbox.ConfigContextArgs{
    			Data: pulumi.String(json0),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Netbox = Pulumi.Netbox;
    
    return await Deployment.RunAsync(() => 
    {
        var test = new Netbox.ConfigContext("test", new()
        {
            Data = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["testkey"] = "testval",
            }),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netbox.ConfigContext;
    import com.pulumi.netbox.ConfigContextArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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 ConfigContext("test", ConfigContextArgs.builder()
                .data(serializeJson(
                    jsonObject(
                        jsonProperty("testkey", "testval")
                    )))
                .build());
    
        }
    }
    
    resources:
      test:
        type: netbox:ConfigContext
        properties:
          data:
            fn::toJSON:
              testkey: testval
    

    Create ConfigContext Resource

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

    Constructor syntax

    new ConfigContext(name: string, args: ConfigContextArgs, opts?: CustomResourceOptions);
    @overload
    def ConfigContext(resource_name: str,
                      args: ConfigContextArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def ConfigContext(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      data: Optional[str] = None,
                      name: Optional[str] = None,
                      regions: Optional[Sequence[float]] = None,
                      config_context_id: Optional[str] = None,
                      cluster_types: Optional[Sequence[float]] = None,
                      description: Optional[str] = None,
                      device_types: Optional[Sequence[float]] = None,
                      locations: Optional[Sequence[float]] = None,
                      cluster_groups: Optional[Sequence[float]] = None,
                      clusters: Optional[Sequence[float]] = None,
                      roles: Optional[Sequence[float]] = None,
                      platforms: Optional[Sequence[float]] = None,
                      site_groups: Optional[Sequence[float]] = None,
                      sites: Optional[Sequence[float]] = None,
                      tags: Optional[Sequence[str]] = None,
                      tenant_groups: Optional[Sequence[float]] = None,
                      tenants: Optional[Sequence[float]] = None,
                      weight: Optional[float] = None)
    func NewConfigContext(ctx *Context, name string, args ConfigContextArgs, opts ...ResourceOption) (*ConfigContext, error)
    public ConfigContext(string name, ConfigContextArgs args, CustomResourceOptions? opts = null)
    public ConfigContext(String name, ConfigContextArgs args)
    public ConfigContext(String name, ConfigContextArgs args, CustomResourceOptions options)
    
    type: netbox:ConfigContext
    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 ConfigContextArgs
    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 ConfigContextArgs
    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 ConfigContextArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ConfigContextArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ConfigContextArgs
    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 configContextResource = new Netbox.ConfigContext("configContextResource", new()
    {
        Data = "string",
        Name = "string",
        Regions = new[]
        {
            0,
        },
        ConfigContextId = "string",
        ClusterTypes = new[]
        {
            0,
        },
        Description = "string",
        DeviceTypes = new[]
        {
            0,
        },
        Locations = new[]
        {
            0,
        },
        ClusterGroups = new[]
        {
            0,
        },
        Clusters = new[]
        {
            0,
        },
        Roles = new[]
        {
            0,
        },
        Platforms = new[]
        {
            0,
        },
        SiteGroups = new[]
        {
            0,
        },
        Sites = new[]
        {
            0,
        },
        Tags = new[]
        {
            "string",
        },
        TenantGroups = new[]
        {
            0,
        },
        Tenants = new[]
        {
            0,
        },
        Weight = 0,
    });
    
    example, err := netbox.NewConfigContext(ctx, "configContextResource", &netbox.ConfigContextArgs{
    	Data: pulumi.String("string"),
    	Name: pulumi.String("string"),
    	Regions: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	ConfigContextId: pulumi.String("string"),
    	ClusterTypes: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	Description: pulumi.String("string"),
    	DeviceTypes: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	Locations: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	ClusterGroups: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	Clusters: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	Roles: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	Platforms: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	SiteGroups: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	Sites: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	TenantGroups: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	Tenants: pulumi.Float64Array{
    		pulumi.Float64(0),
    	},
    	Weight: pulumi.Float64(0),
    })
    
    var configContextResource = new ConfigContext("configContextResource", ConfigContextArgs.builder()
        .data("string")
        .name("string")
        .regions(0)
        .configContextId("string")
        .clusterTypes(0)
        .description("string")
        .deviceTypes(0)
        .locations(0)
        .clusterGroups(0)
        .clusters(0)
        .roles(0)
        .platforms(0)
        .siteGroups(0)
        .sites(0)
        .tags("string")
        .tenantGroups(0)
        .tenants(0)
        .weight(0)
        .build());
    
    config_context_resource = netbox.ConfigContext("configContextResource",
        data="string",
        name="string",
        regions=[0],
        config_context_id="string",
        cluster_types=[0],
        description="string",
        device_types=[0],
        locations=[0],
        cluster_groups=[0],
        clusters=[0],
        roles=[0],
        platforms=[0],
        site_groups=[0],
        sites=[0],
        tags=["string"],
        tenant_groups=[0],
        tenants=[0],
        weight=0)
    
    const configContextResource = new netbox.ConfigContext("configContextResource", {
        data: "string",
        name: "string",
        regions: [0],
        configContextId: "string",
        clusterTypes: [0],
        description: "string",
        deviceTypes: [0],
        locations: [0],
        clusterGroups: [0],
        clusters: [0],
        roles: [0],
        platforms: [0],
        siteGroups: [0],
        sites: [0],
        tags: ["string"],
        tenantGroups: [0],
        tenants: [0],
        weight: 0,
    });
    
    type: netbox:ConfigContext
    properties:
        clusterGroups:
            - 0
        clusterTypes:
            - 0
        clusters:
            - 0
        configContextId: string
        data: string
        description: string
        deviceTypes:
            - 0
        locations:
            - 0
        name: string
        platforms:
            - 0
        regions:
            - 0
        roles:
            - 0
        siteGroups:
            - 0
        sites:
            - 0
        tags:
            - string
        tenantGroups:
            - 0
        tenants:
            - 0
        weight: 0
    

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

    Data string
    ClusterGroups List<double>
    ClusterTypes List<double>
    Clusters List<double>
    ConfigContextId string
    The ID of this resource.
    Description string
    DeviceTypes List<double>
    Locations List<double>
    Name string
    Platforms List<double>
    Regions List<double>
    Roles List<double>
    SiteGroups List<double>
    Sites List<double>
    Tags List<string>
    TenantGroups List<double>
    Tenants List<double>
    Weight double
    Defaults to 1000.
    Data string
    ClusterGroups []float64
    ClusterTypes []float64
    Clusters []float64
    ConfigContextId string
    The ID of this resource.
    Description string
    DeviceTypes []float64
    Locations []float64
    Name string
    Platforms []float64
    Regions []float64
    Roles []float64
    SiteGroups []float64
    Sites []float64
    Tags []string
    TenantGroups []float64
    Tenants []float64
    Weight float64
    Defaults to 1000.
    data String
    clusterGroups List<Double>
    clusterTypes List<Double>
    clusters List<Double>
    configContextId String
    The ID of this resource.
    description String
    deviceTypes List<Double>
    locations List<Double>
    name String
    platforms List<Double>
    regions List<Double>
    roles List<Double>
    siteGroups List<Double>
    sites List<Double>
    tags List<String>
    tenantGroups List<Double>
    tenants List<Double>
    weight Double
    Defaults to 1000.
    data string
    clusterGroups number[]
    clusterTypes number[]
    clusters number[]
    configContextId string
    The ID of this resource.
    description string
    deviceTypes number[]
    locations number[]
    name string
    platforms number[]
    regions number[]
    roles number[]
    siteGroups number[]
    sites number[]
    tags string[]
    tenantGroups number[]
    tenants number[]
    weight number
    Defaults to 1000.
    data str
    cluster_groups Sequence[float]
    cluster_types Sequence[float]
    clusters Sequence[float]
    config_context_id str
    The ID of this resource.
    description str
    device_types Sequence[float]
    locations Sequence[float]
    name str
    platforms Sequence[float]
    regions Sequence[float]
    roles Sequence[float]
    site_groups Sequence[float]
    sites Sequence[float]
    tags Sequence[str]
    tenant_groups Sequence[float]
    tenants Sequence[float]
    weight float
    Defaults to 1000.
    data String
    clusterGroups List<Number>
    clusterTypes List<Number>
    clusters List<Number>
    configContextId String
    The ID of this resource.
    description String
    deviceTypes List<Number>
    locations List<Number>
    name String
    platforms List<Number>
    regions List<Number>
    roles List<Number>
    siteGroups List<Number>
    sites List<Number>
    tags List<String>
    tenantGroups List<Number>
    tenants List<Number>
    weight Number
    Defaults to 1000.

    Outputs

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

    Get an existing ConfigContext 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?: ConfigContextState, opts?: CustomResourceOptions): ConfigContext
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster_groups: Optional[Sequence[float]] = None,
            cluster_types: Optional[Sequence[float]] = None,
            clusters: Optional[Sequence[float]] = None,
            config_context_id: Optional[str] = None,
            data: Optional[str] = None,
            description: Optional[str] = None,
            device_types: Optional[Sequence[float]] = None,
            locations: Optional[Sequence[float]] = None,
            name: Optional[str] = None,
            platforms: Optional[Sequence[float]] = None,
            regions: Optional[Sequence[float]] = None,
            roles: Optional[Sequence[float]] = None,
            site_groups: Optional[Sequence[float]] = None,
            sites: Optional[Sequence[float]] = None,
            tags: Optional[Sequence[str]] = None,
            tenant_groups: Optional[Sequence[float]] = None,
            tenants: Optional[Sequence[float]] = None,
            weight: Optional[float] = None) -> ConfigContext
    func GetConfigContext(ctx *Context, name string, id IDInput, state *ConfigContextState, opts ...ResourceOption) (*ConfigContext, error)
    public static ConfigContext Get(string name, Input<string> id, ConfigContextState? state, CustomResourceOptions? opts = null)
    public static ConfigContext get(String name, Output<String> id, ConfigContextState state, CustomResourceOptions options)
    resources:  _:    type: netbox:ConfigContext    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:
    ClusterGroups List<double>
    ClusterTypes List<double>
    Clusters List<double>
    ConfigContextId string
    The ID of this resource.
    Data string
    Description string
    DeviceTypes List<double>
    Locations List<double>
    Name string
    Platforms List<double>
    Regions List<double>
    Roles List<double>
    SiteGroups List<double>
    Sites List<double>
    Tags List<string>
    TenantGroups List<double>
    Tenants List<double>
    Weight double
    Defaults to 1000.
    ClusterGroups []float64
    ClusterTypes []float64
    Clusters []float64
    ConfigContextId string
    The ID of this resource.
    Data string
    Description string
    DeviceTypes []float64
    Locations []float64
    Name string
    Platforms []float64
    Regions []float64
    Roles []float64
    SiteGroups []float64
    Sites []float64
    Tags []string
    TenantGroups []float64
    Tenants []float64
    Weight float64
    Defaults to 1000.
    clusterGroups List<Double>
    clusterTypes List<Double>
    clusters List<Double>
    configContextId String
    The ID of this resource.
    data String
    description String
    deviceTypes List<Double>
    locations List<Double>
    name String
    platforms List<Double>
    regions List<Double>
    roles List<Double>
    siteGroups List<Double>
    sites List<Double>
    tags List<String>
    tenantGroups List<Double>
    tenants List<Double>
    weight Double
    Defaults to 1000.
    clusterGroups number[]
    clusterTypes number[]
    clusters number[]
    configContextId string
    The ID of this resource.
    data string
    description string
    deviceTypes number[]
    locations number[]
    name string
    platforms number[]
    regions number[]
    roles number[]
    siteGroups number[]
    sites number[]
    tags string[]
    tenantGroups number[]
    tenants number[]
    weight number
    Defaults to 1000.
    cluster_groups Sequence[float]
    cluster_types Sequence[float]
    clusters Sequence[float]
    config_context_id str
    The ID of this resource.
    data str
    description str
    device_types Sequence[float]
    locations Sequence[float]
    name str
    platforms Sequence[float]
    regions Sequence[float]
    roles Sequence[float]
    site_groups Sequence[float]
    sites Sequence[float]
    tags Sequence[str]
    tenant_groups Sequence[float]
    tenants Sequence[float]
    weight float
    Defaults to 1000.
    clusterGroups List<Number>
    clusterTypes List<Number>
    clusters List<Number>
    configContextId String
    The ID of this resource.
    data String
    description String
    deviceTypes List<Number>
    locations List<Number>
    name String
    platforms List<Number>
    regions List<Number>
    roles List<Number>
    siteGroups List<Number>
    sites List<Number>
    tags List<String>
    tenantGroups List<Number>
    tenants List<Number>
    weight Number
    Defaults to 1000.

    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