-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add netbox_extras_custom_field resource
- Loading branch information
Showing
15 changed files
with
1,923 additions
and
0 deletions.
There are no files selected for viewing
148 changes: 148 additions & 0 deletions
148
examples/resources/netbox_extras_custom_field/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
resource "netbox_extras_custom_field" "cf_text" { | ||
name = "cf_text" | ||
label = "CF Text" | ||
type = "text" | ||
content_types = [ | ||
"dcim.site", | ||
] | ||
|
||
description = "Test text field" | ||
weight = 50 | ||
required = true | ||
filter_logic = "exact" | ||
default = "Default value" | ||
validation_regex = "^.*$" | ||
} | ||
|
||
resource "netbox_extras_custom_field" "cf_boolean" { | ||
name = "cf_boolean" | ||
label = "CF Boolean" | ||
type = "boolean" | ||
content_types = [ | ||
"dcim.site", | ||
] | ||
|
||
description = "Test boolean field" | ||
weight = 50 | ||
filter_logic = "exact" | ||
# Fixed in Netbox 3.3 | ||
# required = true | ||
# default = jsonencode(false) | ||
} | ||
|
||
resource "netbox_extras_custom_field" "cf_integer" { | ||
name = "cf_integer" | ||
label = "CF Integer" | ||
type = "integer" | ||
content_types = [ | ||
"dcim.site", | ||
] | ||
|
||
description = "Test integer field" | ||
weight = 50 | ||
filter_logic = "loose" | ||
# Fixed in Netbox 3.3 | ||
# required = true | ||
# default = jsonencode(5) | ||
} | ||
|
||
resource "netbox_extras_custom_field" "cf_select" { | ||
name = "cf_select" | ||
label = "CF Select" | ||
type = "select" | ||
content_types = [ | ||
"dcim.site", | ||
] | ||
|
||
choices = [ | ||
"choice 1", | ||
"choice 2", | ||
] | ||
|
||
description = "Test select field" | ||
weight = 50 | ||
filter_logic = "loose" | ||
required = true | ||
default = "choice 1" | ||
} | ||
|
||
resource "netbox_extras_custom_field" "cf_multi_select" { | ||
name = "cf_mulit_select" | ||
label = "CF Multiselect" | ||
type = "multiselect" | ||
content_types = [ | ||
"dcim.site", | ||
] | ||
|
||
choices = [ | ||
"choice 1", | ||
"choice 2", | ||
] | ||
|
||
description = "Test multiselect field" | ||
weight = 50 | ||
filter_logic = "loose" | ||
# Fixed in netbox 3.3 | ||
# required = true | ||
# default = jsonencode([ | ||
# "choice 1", | ||
# ]) | ||
} | ||
|
||
resource "netbox_extras_custom_field" "cf_object" { | ||
name = "cf_object" | ||
label = "CF object" | ||
type = "object" | ||
content_types = [ | ||
"dcim.site", | ||
] | ||
|
||
object_type = "dcim.platform" | ||
description = "Test object field" | ||
weight = 50 | ||
filter_logic = "loose" | ||
# Fixed in netbox 3.3 | ||
# required = true | ||
#default = jsonencode(netbox_dcim_platform.test.id) | ||
} | ||
|
||
resource "netbox_extras_custom_field" "cf_multi_object" { | ||
name = "cf_mulit_object" | ||
label = "CF Multiobject" | ||
type = "multiobject" | ||
content_types = [ | ||
"dcim.site", | ||
] | ||
|
||
object_type = "dcim.platform" | ||
description = "Test multiobject field" | ||
weight = 50 | ||
filter_logic = "loose" | ||
# Fixed in netbox 3.3 | ||
# required = true | ||
# default = jsonencode([ | ||
# netbox_dcim_platform.test.id, | ||
# ]) | ||
} | ||
|
||
resource "netbox_extras_custom_field" "cf_json" { | ||
name = "cf_json" | ||
label = "CF Json" | ||
type = "json" | ||
content_types = [ | ||
"dcim.site", | ||
] | ||
|
||
description = "Test multiobject field" | ||
weight = 50 | ||
filter_logic = "loose" | ||
# Fixed in netbox 3.3 | ||
# required = true | ||
#default = jsonencode({ | ||
# bool = false | ||
# number = 1.5 | ||
# dict = { | ||
# text = "Some text"} | ||
# } | ||
#}) | ||
} |
Oops, something went wrong.