netbox.Location
Explore with Pulumi AI
From the official documentation:
Racks and devices can be grouped by location within a site. A location may represent a floor, room, cage, or similar organizational unit. Locations can be nested to form a hierarchy. For example, you may have floors within a site, and rooms within a floor.
Each location must have a name that is unique within its parent site and location, if any.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";
const testSite = new netbox.Site("testSite", {});
const testTenant = new netbox.Tenant("testTenant", {});
const testLocation = new netbox.Location("testLocation", {
    description: "my description",
    siteId: testSite.siteId,
    tenantId: testTenant.tenantId,
});
import pulumi
import pulumi_netbox as netbox
test_site = netbox.Site("testSite")
test_tenant = netbox.Tenant("testTenant")
test_location = netbox.Location("testLocation",
    description="my description",
    site_id=test_site.site_id,
    tenant_id=test_tenant.tenant_id)
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 {
		testSite, err := netbox.NewSite(ctx, "testSite", nil)
		if err != nil {
			return err
		}
		testTenant, err := netbox.NewTenant(ctx, "testTenant", nil)
		if err != nil {
			return err
		}
		_, err = netbox.NewLocation(ctx, "testLocation", &netbox.LocationArgs{
			Description: pulumi.String("my description"),
			SiteId:      testSite.SiteId,
			TenantId:    testTenant.TenantId,
		})
		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 testSite = new Netbox.Site("testSite");
    var testTenant = new Netbox.Tenant("testTenant");
    var testLocation = new Netbox.Location("testLocation", new()
    {
        Description = "my description",
        SiteId = testSite.SiteId,
        TenantId = testTenant.TenantId,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.Site;
import com.pulumi.netbox.Tenant;
import com.pulumi.netbox.Location;
import com.pulumi.netbox.LocationArgs;
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 testSite = new Site("testSite");
        var testTenant = new Tenant("testTenant");
        var testLocation = new Location("testLocation", LocationArgs.builder()
            .description("my description")
            .siteId(testSite.siteId())
            .tenantId(testTenant.tenantId())
            .build());
    }
}
resources:
  testSite:
    type: netbox:Site
  testTenant:
    type: netbox:Tenant
  testLocation:
    type: netbox:Location
    properties:
      description: my description
      siteId: ${testSite.siteId}
      tenantId: ${testTenant.tenantId}
Create Location Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Location(name: string, args?: LocationArgs, opts?: CustomResourceOptions);@overload
def Location(resource_name: str,
             args: Optional[LocationArgs] = None,
             opts: Optional[ResourceOptions] = None)
@overload
def Location(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             custom_fields: Optional[Mapping[str, str]] = None,
             description: Optional[str] = None,
             location_id: Optional[str] = None,
             name: Optional[str] = None,
             parent_id: Optional[float] = None,
             site_id: Optional[float] = None,
             slug: Optional[str] = None,
             tags: Optional[Sequence[str]] = None,
             tenant_id: Optional[float] = None)func NewLocation(ctx *Context, name string, args *LocationArgs, opts ...ResourceOption) (*Location, error)public Location(string name, LocationArgs? args = null, CustomResourceOptions? opts = null)
public Location(String name, LocationArgs args)
public Location(String name, LocationArgs args, CustomResourceOptions options)
type: netbox:Location
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 LocationArgs
- 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 LocationArgs
- 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 LocationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args LocationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args LocationArgs
- 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 locationResource = new Netbox.Location("locationResource", new()
{
    CustomFields = 
    {
        { "string", "string" },
    },
    Description = "string",
    LocationId = "string",
    Name = "string",
    ParentId = 0,
    SiteId = 0,
    Slug = "string",
    Tags = new[]
    {
        "string",
    },
    TenantId = 0,
});
example, err := netbox.NewLocation(ctx, "locationResource", &netbox.LocationArgs{
CustomFields: pulumi.StringMap{
"string": pulumi.String("string"),
},
Description: pulumi.String("string"),
LocationId: pulumi.String("string"),
Name: pulumi.String("string"),
ParentId: pulumi.Float64(0),
SiteId: pulumi.Float64(0),
Slug: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
TenantId: pulumi.Float64(0),
})
var locationResource = new Location("locationResource", LocationArgs.builder()
    .customFields(Map.of("string", "string"))
    .description("string")
    .locationId("string")
    .name("string")
    .parentId(0)
    .siteId(0)
    .slug("string")
    .tags("string")
    .tenantId(0)
    .build());
location_resource = netbox.Location("locationResource",
    custom_fields={
        "string": "string",
    },
    description="string",
    location_id="string",
    name="string",
    parent_id=0,
    site_id=0,
    slug="string",
    tags=["string"],
    tenant_id=0)
const locationResource = new netbox.Location("locationResource", {
    customFields: {
        string: "string",
    },
    description: "string",
    locationId: "string",
    name: "string",
    parentId: 0,
    siteId: 0,
    slug: "string",
    tags: ["string"],
    tenantId: 0,
});
type: netbox:Location
properties:
    customFields:
        string: string
    description: string
    locationId: string
    name: string
    parentId: 0
    siteId: 0
    slug: string
    tags:
        - string
    tenantId: 0
Location 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 Location resource accepts the following input properties:
- CustomFields Dictionary<string, string>
- Description string
- LocationId string
- The ID of this resource.
- Name string
- ParentId double
- SiteId double
- Slug string
- List<string>
- TenantId double
- CustomFields map[string]string
- Description string
- LocationId string
- The ID of this resource.
- Name string
- ParentId float64
- SiteId float64
- Slug string
- []string
- TenantId float64
- customFields Map<String,String>
- description String
- locationId String
- The ID of this resource.
- name String
- parentId Double
- siteId Double
- slug String
- List<String>
- tenantId Double
- customFields {[key: string]: string}
- description string
- locationId string
- The ID of this resource.
- name string
- parentId number
- siteId number
- slug string
- string[]
- tenantId number
- custom_fields Mapping[str, str]
- description str
- location_id str
- The ID of this resource.
- name str
- parent_id float
- site_id float
- slug str
- Sequence[str]
- tenant_id float
- customFields Map<String>
- description String
- locationId String
- The ID of this resource.
- name String
- parentId Number
- siteId Number
- slug String
- List<String>
- tenantId Number
Outputs
All input properties are implicitly available as output properties. Additionally, the Location 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 Location Resource
Get an existing Location 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?: LocationState, opts?: CustomResourceOptions): Location@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        custom_fields: Optional[Mapping[str, str]] = None,
        description: Optional[str] = None,
        location_id: Optional[str] = None,
        name: Optional[str] = None,
        parent_id: Optional[float] = None,
        site_id: Optional[float] = None,
        slug: Optional[str] = None,
        tags: Optional[Sequence[str]] = None,
        tenant_id: Optional[float] = None) -> Locationfunc GetLocation(ctx *Context, name string, id IDInput, state *LocationState, opts ...ResourceOption) (*Location, error)public static Location Get(string name, Input<string> id, LocationState? state, CustomResourceOptions? opts = null)public static Location get(String name, Output<String> id, LocationState state, CustomResourceOptions options)resources:  _:    type: netbox:Location    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.
- CustomFields Dictionary<string, string>
- Description string
- LocationId string
- The ID of this resource.
- Name string
- ParentId double
- SiteId double
- Slug string
- List<string>
- TenantId double
- CustomFields map[string]string
- Description string
- LocationId string
- The ID of this resource.
- Name string
- ParentId float64
- SiteId float64
- Slug string
- []string
- TenantId float64
- customFields Map<String,String>
- description String
- locationId String
- The ID of this resource.
- name String
- parentId Double
- siteId Double
- slug String
- List<String>
- tenantId Double
- customFields {[key: string]: string}
- description string
- locationId string
- The ID of this resource.
- name string
- parentId number
- siteId number
- slug string
- string[]
- tenantId number
- custom_fields Mapping[str, str]
- description str
- location_id str
- The ID of this resource.
- name str
- parent_id float
- site_id float
- slug str
- Sequence[str]
- tenant_id float
- customFields Map<String>
- description String
- locationId String
- The ID of this resource.
- name String
- parentId Number
- siteId Number
- slug String
- List<String>
- tenantId Number
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the netboxTerraform Provider.