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/v4/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,
site_group_id: Optional[float] = None,
mark_utilized: Optional[bool] = None,
is_pool: Optional[bool] = None,
prefix_id: Optional[str] = None,
region_id: Optional[float] = None,
custom_fields: Optional[Mapping[str, str]] = None,
location_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 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,
SiteGroupId = 0,
MarkUtilized = false,
IsPool = false,
PrefixId = "string",
RegionId = 0,
CustomFields =
{
{ "string", "string" },
},
LocationId = 0,
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),
SiteGroupId: pulumi.Float64(0),
MarkUtilized: pulumi.Bool(false),
IsPool: pulumi.Bool(false),
PrefixId: pulumi.String("string"),
RegionId: pulumi.Float64(0),
CustomFields: pulumi.StringMap{
"string": pulumi.String("string"),
},
LocationId: 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 prefixResource = new Prefix("prefixResource", PrefixArgs.builder()
.prefix("string")
.status("string")
.roleId(0.0)
.siteGroupId(0.0)
.markUtilized(false)
.isPool(false)
.prefixId("string")
.regionId(0.0)
.customFields(Map.of("string", "string"))
.locationId(0.0)
.siteId(0.0)
.description("string")
.tags("string")
.tenantId(0.0)
.vlanId(0.0)
.vrfId(0.0)
.build());
prefix_resource = netbox.Prefix("prefixResource",
prefix="string",
status="string",
role_id=0,
site_group_id=0,
mark_utilized=False,
is_pool=False,
prefix_id="string",
region_id=0,
custom_fields={
"string": "string",
},
location_id=0,
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,
siteGroupId: 0,
markUtilized: false,
isPool: false,
prefixId: "string",
regionId: 0,
customFields: {
string: "string",
},
locationId: 0,
siteId: 0,
description: "string",
tags: ["string"],
tenantId: 0,
vlanId: 0,
vrfId: 0,
});
type: netbox:Prefix
properties:
customFields:
string: string
description: string
isPool: false
locationId: 0
markUtilized: false
prefix: string
prefixId: string
regionId: 0
roleId: 0
siteGroupId: 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 - Location
Id double - Conflicts with
site_id
,site_group_id
andregion_id
. - Mark
Utilized bool - Prefix
Id string - The ID of this resource.
- Region
Id double - Conflicts with
location_id
,site_id
andsite_group_id
. - Role
Id double - Site
Group doubleId - Conflicts with
location_id
,site_id
andregion_id
. - Site
Id double - Conflicts with
location_id
,site_group_id
andregion_id
. - 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 - Location
Id float64 - Conflicts with
site_id
,site_group_id
andregion_id
. - Mark
Utilized bool - Prefix
Id string - The ID of this resource.
- Region
Id float64 - Conflicts with
location_id
,site_id
andsite_group_id
. - Role
Id float64 - Site
Group float64Id - Conflicts with
location_id
,site_id
andregion_id
. - Site
Id float64 - Conflicts with
location_id
,site_group_id
andregion_id
. - []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 - location
Id Double - Conflicts with
site_id
,site_group_id
andregion_id
. - mark
Utilized Boolean - prefix
Id String - The ID of this resource.
- region
Id Double - Conflicts with
location_id
,site_id
andsite_group_id
. - role
Id Double - site
Group DoubleId - Conflicts with
location_id
,site_id
andregion_id
. - site
Id Double - Conflicts with
location_id
,site_group_id
andregion_id
. - 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 - location
Id number - Conflicts with
site_id
,site_group_id
andregion_id
. - mark
Utilized boolean - prefix
Id string - The ID of this resource.
- region
Id number - Conflicts with
location_id
,site_id
andsite_group_id
. - role
Id number - site
Group numberId - Conflicts with
location_id
,site_id
andregion_id
. - site
Id number - Conflicts with
location_id
,site_group_id
andregion_id
. - 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 - location_
id float - Conflicts with
site_id
,site_group_id
andregion_id
. - mark_
utilized bool - prefix_
id str - The ID of this resource.
- region_
id float - Conflicts with
location_id
,site_id
andsite_group_id
. - role_
id float - site_
group_ floatid - Conflicts with
location_id
,site_id
andregion_id
. - site_
id float - Conflicts with
location_id
,site_group_id
andregion_id
. - 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 - location
Id Number - Conflicts with
site_id
,site_group_id
andregion_id
. - mark
Utilized Boolean - prefix
Id String - The ID of this resource.
- region
Id Number - Conflicts with
location_id
,site_id
andsite_group_id
. - role
Id Number - site
Group NumberId - Conflicts with
location_id
,site_id
andregion_id
. - site
Id Number - Conflicts with
location_id
,site_group_id
andregion_id
. - 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.
- List<string>
- Id string
- The provider-assigned unique ID for this managed resource.
- []string
- id String
- The provider-assigned unique ID for this managed resource.
- List<String>
- id string
- The provider-assigned unique ID for this managed resource.
- string[]
- id str
- The provider-assigned unique ID for this managed resource.
- Sequence[str]
- id String
- The provider-assigned unique ID for this managed resource.
- List<String>
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,
location_id: Optional[float] = None,
mark_utilized: Optional[bool] = None,
prefix: Optional[str] = None,
prefix_id: Optional[str] = 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) -> 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 - Location
Id double - Conflicts with
site_id
,site_group_id
andregion_id
. - Mark
Utilized bool - Prefix string
- Prefix
Id string - The ID of this resource.
- Region
Id double - Conflicts with
location_id
,site_id
andsite_group_id
. - Role
Id double - Site
Group doubleId - Conflicts with
location_id
,site_id
andregion_id
. - Site
Id double - Conflicts with
location_id
,site_group_id
andregion_id
. - Status string
- Valid values are
active
,container
,reserved
anddeprecated
. - List<string>
- List<string>
- Tenant
Id double - Vlan
Id double - Vrf
Id double
- Custom
Fields map[string]string - Description string
- Is
Pool bool - Location
Id float64 - Conflicts with
site_id
,site_group_id
andregion_id
. - Mark
Utilized bool - Prefix string
- Prefix
Id string - The ID of this resource.
- Region
Id float64 - Conflicts with
location_id
,site_id
andsite_group_id
. - Role
Id float64 - Site
Group float64Id - Conflicts with
location_id
,site_id
andregion_id
. - Site
Id float64 - Conflicts with
location_id
,site_group_id
andregion_id
. - Status string
- Valid values are
active
,container
,reserved
anddeprecated
. - []string
- []string
- Tenant
Id float64 - Vlan
Id float64 - Vrf
Id float64
- custom
Fields Map<String,String> - description String
- is
Pool Boolean - location
Id Double - Conflicts with
site_id
,site_group_id
andregion_id
. - mark
Utilized Boolean - prefix String
- prefix
Id String - The ID of this resource.
- region
Id Double - Conflicts with
location_id
,site_id
andsite_group_id
. - role
Id Double - site
Group DoubleId - Conflicts with
location_id
,site_id
andregion_id
. - site
Id Double - Conflicts with
location_id
,site_group_id
andregion_id
. - status String
- Valid values are
active
,container
,reserved
anddeprecated
. - List<String>
- List<String>
- tenant
Id Double - vlan
Id Double - vrf
Id Double
- custom
Fields {[key: string]: string} - description string
- is
Pool boolean - location
Id number - Conflicts with
site_id
,site_group_id
andregion_id
. - mark
Utilized boolean - prefix string
- prefix
Id string - The ID of this resource.
- region
Id number - Conflicts with
location_id
,site_id
andsite_group_id
. - role
Id number - site
Group numberId - Conflicts with
location_id
,site_id
andregion_id
. - site
Id number - Conflicts with
location_id
,site_group_id
andregion_id
. - status string
- Valid values are
active
,container
,reserved
anddeprecated
. - string[]
- string[]
- tenant
Id number - vlan
Id number - vrf
Id number
- custom_
fields Mapping[str, str] - description str
- is_
pool bool - location_
id float - Conflicts with
site_id
,site_group_id
andregion_id
. - mark_
utilized bool - prefix str
- prefix_
id str - The ID of this resource.
- region_
id float - Conflicts with
location_id
,site_id
andsite_group_id
. - role_
id float - site_
group_ floatid - Conflicts with
location_id
,site_id
andregion_id
. - site_
id float - Conflicts with
location_id
,site_group_id
andregion_id
. - status str
- Valid values are
active
,container
,reserved
anddeprecated
. - Sequence[str]
- Sequence[str]
- tenant_
id float - vlan_
id float - vrf_
id float
- custom
Fields Map<String> - description String
- is
Pool Boolean - location
Id Number - Conflicts with
site_id
,site_group_id
andregion_id
. - mark
Utilized Boolean - prefix String
- prefix
Id String - The ID of this resource.
- region
Id Number - Conflicts with
location_id
,site_id
andsite_group_id
. - role
Id Number - site
Group NumberId - Conflicts with
location_id
,site_id
andregion_id
. - site
Id Number - Conflicts with
location_id
,site_group_id
andregion_id
. - status String
- Valid values are
active
,container
,reserved
anddeprecated
. - List<String>
- 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.