netbox.Prefix
Explore with Pulumi AI
From the official documentation:
A prefix is an IPv4 or IPv6 network and mask expressed in CIDR notation (e.g. 192.0.2.0/24). A prefix entails only the “network portion” of an IP address: All bits in the address not covered by the mask must be zero. (In other words, a prefix cannot be a specific IP address.)
Prefixes are automatically organized by their parent aggregates. Additionally, each prefix can be assigned to a particular site and virtual routing and forwarding instance (VRF). Each VRF represents a separate IP space or routing table. All prefixes not assigned to a VRF are considered to be in the “global” table.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";
const myPrefix = new netbox.Prefix("myPrefix", {
description: "test prefix",
prefix: "10.0.0.0/24",
status: "active",
});
import pulumi
import pulumi_netbox as netbox
my_prefix = netbox.Prefix("myPrefix",
description="test prefix",
prefix="10.0.0.0/24",
status="active")
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.NewPrefix(ctx, "myPrefix", &netbox.PrefixArgs{
Description: pulumi.String("test prefix"),
Prefix: pulumi.String("10.0.0.0/24"),
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 myPrefix = new Netbox.Prefix("myPrefix", new()
{
Description = "test prefix",
Prefix = "10.0.0.0/24",
Status = "active",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.Prefix;
import com.pulumi.netbox.PrefixArgs;
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 myPrefix = new Prefix("myPrefix", PrefixArgs.builder()
.description("test prefix")
.prefix("10.0.0.0/24")
.status("active")
.build());
}
}
resources:
myPrefix:
type: netbox:Prefix
properties:
description: test prefix
prefix: 10.0.0.0/24
status: active
Create Prefix Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Prefix(name: string, args: PrefixArgs, opts?: CustomResourceOptions);
@overload
def Prefix(resource_name: str,
args: PrefixArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Prefix(resource_name: str,
opts: Optional[ResourceOptions] = None,
prefix: Optional[str] = None,
status: Optional[str] = None,
role_id: Optional[float] = None,
mark_utilized: Optional[bool] = None,
is_pool: Optional[bool] = None,
prefix_id: Optional[str] = None,
custom_fields: Optional[Mapping[str, str]] = 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 NewPrefix(ctx *Context, name string, args PrefixArgs, opts ...ResourceOption) (*Prefix, error)
public Prefix(string name, PrefixArgs args, CustomResourceOptions? opts = null)
public Prefix(String name, PrefixArgs args)
public Prefix(String name, PrefixArgs args, CustomResourceOptions options)
type: netbox:Prefix
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 PrefixArgs
- 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 PrefixArgs
- 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 PrefixArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PrefixArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PrefixArgs
- 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 prefixResource = new Netbox.Prefix("prefixResource", new()
{
Prefix = "string",
Status = "string",
RoleId = 0,
MarkUtilized = false,
IsPool = false,
PrefixId = "string",
CustomFields =
{
{ "string", "string" },
},
SiteId = 0,
Description = "string",
Tags = new[]
{
"string",
},
TenantId = 0,
VlanId = 0,
VrfId = 0,
});
example, err := netbox.NewPrefix(ctx, "prefixResource", &netbox.PrefixArgs{
Prefix: pulumi.String("string"),
Status: pulumi.String("string"),
RoleId: pulumi.Float64(0),
MarkUtilized: pulumi.Bool(false),
IsPool: pulumi.Bool(false),
PrefixId: pulumi.String("string"),
CustomFields: pulumi.StringMap{
"string": pulumi.String("string"),
},
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 prefixResource = new Prefix("prefixResource", PrefixArgs.builder()
.prefix("string")
.status("string")
.roleId(0)
.markUtilized(false)
.isPool(false)
.prefixId("string")
.customFields(Map.of("string", "string"))
.siteId(0)
.description("string")
.tags("string")
.tenantId(0)
.vlanId(0)
.vrfId(0)
.build());
prefix_resource = netbox.Prefix("prefixResource",
prefix="string",
status="string",
role_id=0,
mark_utilized=False,
is_pool=False,
prefix_id="string",
custom_fields={
"string": "string",
},
site_id=0,
description="string",
tags=["string"],
tenant_id=0,
vlan_id=0,
vrf_id=0)
const prefixResource = new netbox.Prefix("prefixResource", {
prefix: "string",
status: "string",
roleId: 0,
markUtilized: false,
isPool: false,
prefixId: "string",
customFields: {
string: "string",
},
siteId: 0,
description: "string",
tags: ["string"],
tenantId: 0,
vlanId: 0,
vrfId: 0,
});
type: netbox:Prefix
properties:
customFields:
string: string
description: string
isPool: false
markUtilized: false
prefix: string
prefixId: string
roleId: 0
siteId: 0
status: string
tags:
- string
tenantId: 0
vlanId: 0
vrfId: 0
Prefix 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 Prefix resource accepts the following input properties:
- Prefix string
- Status string
- Valid values are
active
,container
,reserved
anddeprecated
. - Custom
Fields Dictionary<string, string> - Description string
- Is
Pool bool - Mark
Utilized bool - Prefix
Id string - The ID of this resource.
- Role
Id double - Site
Id double - List<string>
- Tenant
Id double - Vlan
Id double - Vrf
Id double
- Prefix string
- Status string
- Valid values are
active
,container
,reserved
anddeprecated
. - Custom
Fields map[string]string - Description string
- Is
Pool bool - Mark
Utilized bool - Prefix
Id string - The ID of this resource.
- Role
Id float64 - Site
Id float64 - []string
- Tenant
Id float64 - Vlan
Id float64 - Vrf
Id float64
- prefix String
- status String
- Valid values are
active
,container
,reserved
anddeprecated
. - custom
Fields Map<String,String> - description String
- is
Pool Boolean - mark
Utilized Boolean - prefix
Id String - The ID of this resource.
- role
Id Double - site
Id Double - List<String>
- tenant
Id Double - vlan
Id Double - vrf
Id Double
- prefix string
- status string
- Valid values are
active
,container
,reserved
anddeprecated
. - custom
Fields {[key: string]: string} - description string
- is
Pool boolean - mark
Utilized boolean - prefix
Id string - The ID of this resource.
- role
Id number - site
Id number - string[]
- tenant
Id number - vlan
Id number - vrf
Id number
- prefix str
- status str
- Valid values are
active
,container
,reserved
anddeprecated
. - custom_
fields Mapping[str, str] - description str
- is_
pool bool - mark_
utilized bool - prefix_
id str - The ID of this resource.
- role_
id float - site_
id float - Sequence[str]
- tenant_
id float - vlan_
id float - vrf_
id float
- prefix String
- status String
- Valid values are
active
,container
,reserved
anddeprecated
. - custom
Fields Map<String> - description String
- is
Pool Boolean - mark
Utilized Boolean - prefix
Id String - The ID of this resource.
- role
Id Number - site
Id Number - List<String>
- tenant
Id Number - vlan
Id Number - vrf
Id Number
Outputs
All input properties are implicitly available as output properties. Additionally, the Prefix 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 Prefix Resource
Get an existing Prefix 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?: PrefixState, opts?: CustomResourceOptions): Prefix
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
custom_fields: Optional[Mapping[str, str]] = None,
description: Optional[str] = None,
is_pool: Optional[bool] = None,
mark_utilized: Optional[bool] = None,
prefix: Optional[str] = None,
prefix_id: Optional[str] = None,
role_id: Optional[float] = None,
site_id: Optional[float] = None,
status: Optional[str] = None,
tags: Optional[Sequence[str]] = None,
tenant_id: Optional[float] = None,
vlan_id: Optional[float] = None,
vrf_id: Optional[float] = None) -> Prefix
func GetPrefix(ctx *Context, name string, id IDInput, state *PrefixState, opts ...ResourceOption) (*Prefix, error)
public static Prefix Get(string name, Input<string> id, PrefixState? state, CustomResourceOptions? opts = null)
public static Prefix get(String name, Output<String> id, PrefixState state, CustomResourceOptions options)
resources: _: type: netbox:Prefix 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.
- Custom
Fields Dictionary<string, string> - Description string
- Is
Pool bool - Mark
Utilized bool - Prefix string
- Prefix
Id string - The ID of this resource.
- Role
Id double - Site
Id double - Status string
- Valid values are
active
,container
,reserved
anddeprecated
. - List<string>
- Tenant
Id double - Vlan
Id double - Vrf
Id double
- Custom
Fields map[string]string - Description string
- Is
Pool bool - Mark
Utilized bool - Prefix string
- Prefix
Id string - The ID of this resource.
- Role
Id float64 - Site
Id float64 - Status string
- Valid values are
active
,container
,reserved
anddeprecated
. - []string
- Tenant
Id float64 - Vlan
Id float64 - Vrf
Id float64
- custom
Fields Map<String,String> - description String
- is
Pool Boolean - mark
Utilized Boolean - prefix String
- prefix
Id String - The ID of this resource.
- role
Id Double - site
Id Double - status String
- Valid values are
active
,container
,reserved
anddeprecated
. - List<String>
- tenant
Id Double - vlan
Id Double - vrf
Id Double
- custom
Fields {[key: string]: string} - description string
- is
Pool boolean - mark
Utilized boolean - prefix string
- prefix
Id string - The ID of this resource.
- role
Id number - site
Id number - status string
- Valid values are
active
,container
,reserved
anddeprecated
. - string[]
- tenant
Id number - vlan
Id number - vrf
Id number
- custom_
fields Mapping[str, str] - description str
- is_
pool bool - mark_
utilized bool - prefix str
- prefix_
id str - The ID of this resource.
- role_
id float - site_
id float - status str
- Valid values are
active
,container
,reserved
anddeprecated
. - Sequence[str]
- tenant_
id float - vlan_
id float - vrf_
id float
- custom
Fields Map<String> - description String
- is
Pool Boolean - mark
Utilized Boolean - prefix String
- prefix
Id String - The ID of this resource.
- role
Id Number - site
Id Number - status String
- Valid values are
active
,container
,reserved
anddeprecated
. - List<String>
- tenant
Id Number - vlan
Id Number - vrf
Id Number
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the
netbox
Terraform Provider.