1. Packages
  2. Netbox Provider
  3. API Docs
  4. AvailablePrefix
netbox 4.0.0 published on Thursday, Jun 12, 2025 by e-breuninger

netbox.AvailablePrefix

Explore with Pulumi AI

netbox logo
netbox 4.0.0 published on Thursday, Jun 12, 2025 by e-breuninger

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    const testPrefix = netbox.getPrefix({
        cidr: "10.0.0.0/24",
    });
    const testAvailablePrefix = new netbox.AvailablePrefix("testAvailablePrefix", {
        parentPrefixId: testPrefix.then(testPrefix => testPrefix.id),
        prefixLength: 25,
        status: "active",
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    test_prefix = netbox.get_prefix(cidr="10.0.0.0/24")
    test_available_prefix = netbox.AvailablePrefix("testAvailablePrefix",
        parent_prefix_id=test_prefix.id,
        prefix_length=25,
        status="active")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v4/netbox"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		testPrefix, err := netbox.LookupPrefix(ctx, &netbox.LookupPrefixArgs{
    			Cidr: pulumi.StringRef("10.0.0.0/24"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = netbox.NewAvailablePrefix(ctx, "testAvailablePrefix", &netbox.AvailablePrefixArgs{
    			ParentPrefixId: pulumi.Float64(testPrefix.Id),
    			PrefixLength:   pulumi.Float64(25),
    			Status:         pulumi.String("active"),
    		})
    		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 testPrefix = Netbox.GetPrefix.Invoke(new()
        {
            Cidr = "10.0.0.0/24",
        });
    
        var testAvailablePrefix = new Netbox.AvailablePrefix("testAvailablePrefix", new()
        {
            ParentPrefixId = testPrefix.Apply(getPrefixResult => getPrefixResult.Id),
            PrefixLength = 25,
            Status = "active",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netbox.NetboxFunctions;
    import com.pulumi.netbox.inputs.GetPrefixArgs;
    import com.pulumi.netbox.AvailablePrefix;
    import com.pulumi.netbox.AvailablePrefixArgs;
    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) {
            final var testPrefix = NetboxFunctions.getPrefix(GetPrefixArgs.builder()
                .cidr("10.0.0.0/24")
                .build());
    
            var testAvailablePrefix = new AvailablePrefix("testAvailablePrefix", AvailablePrefixArgs.builder()
                .parentPrefixId(testPrefix.applyValue(getPrefixResult -> getPrefixResult.id()))
                .prefixLength(25)
                .status("active")
                .build());
    
        }
    }
    
    resources:
      testAvailablePrefix:
        type: netbox:AvailablePrefix
        properties:
          parentPrefixId: ${testPrefix.id}
          prefixLength: 25
          status: active
    variables:
      testPrefix:
        fn::invoke:
          function: netbox:getPrefix
          arguments:
            cidr: 10.0.0.0/24
    

    Create AvailablePrefix Resource

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

    Constructor syntax

    new AvailablePrefix(name: string, args: AvailablePrefixArgs, opts?: CustomResourceOptions);
    @overload
    def AvailablePrefix(resource_name: str,
                        args: AvailablePrefixArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def AvailablePrefix(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        parent_prefix_id: Optional[float] = None,
                        status: Optional[str] = None,
                        prefix_length: Optional[float] = None,
                        role_id: Optional[float] = None,
                        mark_utilized: Optional[bool] = None,
                        location_id: Optional[float] = None,
                        is_pool: Optional[bool] = None,
                        region_id: Optional[float] = None,
                        available_prefix_id: Optional[str] = None,
                        site_group_id: Optional[float] = None,
                        site_id: Optional[float] = None,
                        description: Optional[str] = None,
                        tags: Optional[Sequence[str]] = None,
                        tenant_id: Optional[float] = None,
                        vlan_id: Optional[float] = None,
                        vrf_id: Optional[float] = None)
    func NewAvailablePrefix(ctx *Context, name string, args AvailablePrefixArgs, opts ...ResourceOption) (*AvailablePrefix, error)
    public AvailablePrefix(string name, AvailablePrefixArgs args, CustomResourceOptions? opts = null)
    public AvailablePrefix(String name, AvailablePrefixArgs args)
    public AvailablePrefix(String name, AvailablePrefixArgs args, CustomResourceOptions options)
    
    type: netbox:AvailablePrefix
    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 AvailablePrefixArgs
    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 AvailablePrefixArgs
    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 AvailablePrefixArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AvailablePrefixArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AvailablePrefixArgs
    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 availablePrefixResource = new Netbox.AvailablePrefix("availablePrefixResource", new()
    {
        ParentPrefixId = 0,
        Status = "string",
        PrefixLength = 0,
        RoleId = 0,
        MarkUtilized = false,
        LocationId = 0,
        IsPool = false,
        RegionId = 0,
        AvailablePrefixId = "string",
        SiteGroupId = 0,
        SiteId = 0,
        Description = "string",
        Tags = new[]
        {
            "string",
        },
        TenantId = 0,
        VlanId = 0,
        VrfId = 0,
    });
    
    example, err := netbox.NewAvailablePrefix(ctx, "availablePrefixResource", &netbox.AvailablePrefixArgs{
    	ParentPrefixId:    pulumi.Float64(0),
    	Status:            pulumi.String("string"),
    	PrefixLength:      pulumi.Float64(0),
    	RoleId:            pulumi.Float64(0),
    	MarkUtilized:      pulumi.Bool(false),
    	LocationId:        pulumi.Float64(0),
    	IsPool:            pulumi.Bool(false),
    	RegionId:          pulumi.Float64(0),
    	AvailablePrefixId: pulumi.String("string"),
    	SiteGroupId:       pulumi.Float64(0),
    	SiteId:            pulumi.Float64(0),
    	Description:       pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	TenantId: pulumi.Float64(0),
    	VlanId:   pulumi.Float64(0),
    	VrfId:    pulumi.Float64(0),
    })
    
    var availablePrefixResource = new AvailablePrefix("availablePrefixResource", AvailablePrefixArgs.builder()
        .parentPrefixId(0.0)
        .status("string")
        .prefixLength(0.0)
        .roleId(0.0)
        .markUtilized(false)
        .locationId(0.0)
        .isPool(false)
        .regionId(0.0)
        .availablePrefixId("string")
        .siteGroupId(0.0)
        .siteId(0.0)
        .description("string")
        .tags("string")
        .tenantId(0.0)
        .vlanId(0.0)
        .vrfId(0.0)
        .build());
    
    available_prefix_resource = netbox.AvailablePrefix("availablePrefixResource",
        parent_prefix_id=0,
        status="string",
        prefix_length=0,
        role_id=0,
        mark_utilized=False,
        location_id=0,
        is_pool=False,
        region_id=0,
        available_prefix_id="string",
        site_group_id=0,
        site_id=0,
        description="string",
        tags=["string"],
        tenant_id=0,
        vlan_id=0,
        vrf_id=0)
    
    const availablePrefixResource = new netbox.AvailablePrefix("availablePrefixResource", {
        parentPrefixId: 0,
        status: "string",
        prefixLength: 0,
        roleId: 0,
        markUtilized: false,
        locationId: 0,
        isPool: false,
        regionId: 0,
        availablePrefixId: "string",
        siteGroupId: 0,
        siteId: 0,
        description: "string",
        tags: ["string"],
        tenantId: 0,
        vlanId: 0,
        vrfId: 0,
    });
    
    type: netbox:AvailablePrefix
    properties:
        availablePrefixId: string
        description: string
        isPool: false
        locationId: 0
        markUtilized: false
        parentPrefixId: 0
        prefixLength: 0
        regionId: 0
        roleId: 0
        siteGroupId: 0
        siteId: 0
        status: string
        tags:
            - string
        tenantId: 0
        vlanId: 0
        vrfId: 0
    

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

    ParentPrefixId double
    PrefixLength double
    Status string
    Valid values are active, container, reserved and deprecated.
    AvailablePrefixId string
    The ID of this resource.
    Description string
    IsPool bool
    LocationId double
    Conflicts with site_id, site_group_id and region_id.
    MarkUtilized bool
    RegionId double
    Conflicts with location_id, site_id and site_group_id.
    RoleId double
    SiteGroupId double
    Conflicts with location_id, site_id and region_id.
    SiteId double
    Conflicts with location_id, site_group_id and region_id.
    Tags List<string>
    TenantId double
    VlanId double
    VrfId double
    ParentPrefixId float64
    PrefixLength float64
    Status string
    Valid values are active, container, reserved and deprecated.
    AvailablePrefixId string
    The ID of this resource.
    Description string
    IsPool bool
    LocationId float64
    Conflicts with site_id, site_group_id and region_id.
    MarkUtilized bool
    RegionId float64
    Conflicts with location_id, site_id and site_group_id.
    RoleId float64
    SiteGroupId float64
    Conflicts with location_id, site_id and region_id.
    SiteId float64
    Conflicts with location_id, site_group_id and region_id.
    Tags []string
    TenantId float64
    VlanId float64
    VrfId float64
    parentPrefixId Double
    prefixLength Double
    status String
    Valid values are active, container, reserved and deprecated.
    availablePrefixId String
    The ID of this resource.
    description String
    isPool Boolean
    locationId Double
    Conflicts with site_id, site_group_id and region_id.
    markUtilized Boolean
    regionId Double
    Conflicts with location_id, site_id and site_group_id.
    roleId Double
    siteGroupId Double
    Conflicts with location_id, site_id and region_id.
    siteId Double
    Conflicts with location_id, site_group_id and region_id.
    tags List<String>
    tenantId Double
    vlanId Double
    vrfId Double
    parentPrefixId number
    prefixLength number
    status string
    Valid values are active, container, reserved and deprecated.
    availablePrefixId string
    The ID of this resource.
    description string
    isPool boolean
    locationId number
    Conflicts with site_id, site_group_id and region_id.
    markUtilized boolean
    regionId number
    Conflicts with location_id, site_id and site_group_id.
    roleId number
    siteGroupId number
    Conflicts with location_id, site_id and region_id.
    siteId number
    Conflicts with location_id, site_group_id and region_id.
    tags string[]
    tenantId number
    vlanId number
    vrfId number
    parent_prefix_id float
    prefix_length float
    status str
    Valid values are active, container, reserved and deprecated.
    available_prefix_id str
    The ID of this resource.
    description str
    is_pool bool
    location_id float
    Conflicts with site_id, site_group_id and region_id.
    mark_utilized bool
    region_id float
    Conflicts with location_id, site_id and site_group_id.
    role_id float
    site_group_id float
    Conflicts with location_id, site_id and region_id.
    site_id float
    Conflicts with location_id, site_group_id and region_id.
    tags Sequence[str]
    tenant_id float
    vlan_id float
    vrf_id float
    parentPrefixId Number
    prefixLength Number
    status String
    Valid values are active, container, reserved and deprecated.
    availablePrefixId String
    The ID of this resource.
    description String
    isPool Boolean
    locationId Number
    Conflicts with site_id, site_group_id and region_id.
    markUtilized Boolean
    regionId Number
    Conflicts with location_id, site_id and site_group_id.
    roleId Number
    siteGroupId Number
    Conflicts with location_id, site_id and region_id.
    siteId Number
    Conflicts with location_id, site_group_id and region_id.
    tags List<String>
    tenantId Number
    vlanId Number
    vrfId Number

    Outputs

    All input properties are implicitly available as output properties. Additionally, the AvailablePrefix resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Prefix string
    TagsAlls List<string>
    Id string
    The provider-assigned unique ID for this managed resource.
    Prefix string
    TagsAlls []string
    id String
    The provider-assigned unique ID for this managed resource.
    prefix String
    tagsAlls List<String>
    id string
    The provider-assigned unique ID for this managed resource.
    prefix string
    tagsAlls string[]
    id str
    The provider-assigned unique ID for this managed resource.
    prefix str
    tags_alls Sequence[str]
    id String
    The provider-assigned unique ID for this managed resource.
    prefix String
    tagsAlls List<String>

    Look up Existing AvailablePrefix Resource

    Get an existing AvailablePrefix 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?: AvailablePrefixState, opts?: CustomResourceOptions): AvailablePrefix
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            available_prefix_id: Optional[str] = None,
            description: Optional[str] = None,
            is_pool: Optional[bool] = None,
            location_id: Optional[float] = None,
            mark_utilized: Optional[bool] = None,
            parent_prefix_id: Optional[float] = None,
            prefix: Optional[str] = None,
            prefix_length: Optional[float] = None,
            region_id: Optional[float] = None,
            role_id: Optional[float] = None,
            site_group_id: Optional[float] = None,
            site_id: Optional[float] = None,
            status: Optional[str] = None,
            tags: Optional[Sequence[str]] = None,
            tags_alls: Optional[Sequence[str]] = None,
            tenant_id: Optional[float] = None,
            vlan_id: Optional[float] = None,
            vrf_id: Optional[float] = None) -> AvailablePrefix
    func GetAvailablePrefix(ctx *Context, name string, id IDInput, state *AvailablePrefixState, opts ...ResourceOption) (*AvailablePrefix, error)
    public static AvailablePrefix Get(string name, Input<string> id, AvailablePrefixState? state, CustomResourceOptions? opts = null)
    public static AvailablePrefix get(String name, Output<String> id, AvailablePrefixState state, CustomResourceOptions options)
    resources:  _:    type: netbox:AvailablePrefix    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:
    AvailablePrefixId string
    The ID of this resource.
    Description string
    IsPool bool
    LocationId double
    Conflicts with site_id, site_group_id and region_id.
    MarkUtilized bool
    ParentPrefixId double
    Prefix string
    PrefixLength double
    RegionId double
    Conflicts with location_id, site_id and site_group_id.
    RoleId double
    SiteGroupId double
    Conflicts with location_id, site_id and region_id.
    SiteId double
    Conflicts with location_id, site_group_id and region_id.
    Status string
    Valid values are active, container, reserved and deprecated.
    Tags List<string>
    TagsAlls List<string>
    TenantId double
    VlanId double
    VrfId double
    AvailablePrefixId string
    The ID of this resource.
    Description string
    IsPool bool
    LocationId float64
    Conflicts with site_id, site_group_id and region_id.
    MarkUtilized bool
    ParentPrefixId float64
    Prefix string
    PrefixLength float64
    RegionId float64
    Conflicts with location_id, site_id and site_group_id.
    RoleId float64
    SiteGroupId float64
    Conflicts with location_id, site_id and region_id.
    SiteId float64
    Conflicts with location_id, site_group_id and region_id.
    Status string
    Valid values are active, container, reserved and deprecated.
    Tags []string
    TagsAlls []string
    TenantId float64
    VlanId float64
    VrfId float64
    availablePrefixId String
    The ID of this resource.
    description String
    isPool Boolean
    locationId Double
    Conflicts with site_id, site_group_id and region_id.
    markUtilized Boolean
    parentPrefixId Double
    prefix String
    prefixLength Double
    regionId Double
    Conflicts with location_id, site_id and site_group_id.
    roleId Double
    siteGroupId Double
    Conflicts with location_id, site_id and region_id.
    siteId Double
    Conflicts with location_id, site_group_id and region_id.
    status String
    Valid values are active, container, reserved and deprecated.
    tags List<String>
    tagsAlls List<String>
    tenantId Double
    vlanId Double
    vrfId Double
    availablePrefixId string
    The ID of this resource.
    description string
    isPool boolean
    locationId number
    Conflicts with site_id, site_group_id and region_id.
    markUtilized boolean
    parentPrefixId number
    prefix string
    prefixLength number
    regionId number
    Conflicts with location_id, site_id and site_group_id.
    roleId number
    siteGroupId number
    Conflicts with location_id, site_id and region_id.
    siteId number
    Conflicts with location_id, site_group_id and region_id.
    status string
    Valid values are active, container, reserved and deprecated.
    tags string[]
    tagsAlls string[]
    tenantId number
    vlanId number
    vrfId number
    available_prefix_id str
    The ID of this resource.
    description str
    is_pool bool
    location_id float
    Conflicts with site_id, site_group_id and region_id.
    mark_utilized bool
    parent_prefix_id float
    prefix str
    prefix_length float
    region_id float
    Conflicts with location_id, site_id and site_group_id.
    role_id float
    site_group_id float
    Conflicts with location_id, site_id and region_id.
    site_id float
    Conflicts with location_id, site_group_id and region_id.
    status str
    Valid values are active, container, reserved and deprecated.
    tags Sequence[str]
    tags_alls Sequence[str]
    tenant_id float
    vlan_id float
    vrf_id float
    availablePrefixId String
    The ID of this resource.
    description String
    isPool Boolean
    locationId Number
    Conflicts with site_id, site_group_id and region_id.
    markUtilized Boolean
    parentPrefixId Number
    prefix String
    prefixLength Number
    regionId Number
    Conflicts with location_id, site_id and site_group_id.
    roleId Number
    siteGroupId Number
    Conflicts with location_id, site_id and region_id.
    siteId Number
    Conflicts with location_id, site_group_id and region_id.
    status String
    Valid values are active, container, reserved and deprecated.
    tags List<String>
    tagsAlls List<String>
    tenantId Number
    vlanId Number
    vrfId Number

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    netbox logo
    netbox 4.0.0 published on Thursday, Jun 12, 2025 by e-breuninger