Skip to content

Commit

Permalink
feat: Add scope field to VLAN group resource
Browse files Browse the repository at this point in the history
Fixes: 193
  • Loading branch information
amhn authored and smutel committed Mar 14, 2023
1 parent 53382b9 commit 67e7628
Show file tree
Hide file tree
Showing 5 changed files with 482 additions and 34 deletions.
85 changes: 80 additions & 5 deletions examples/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,92 @@ data "netbox_dcim_site" "site_test" {
}

resource "netbox_ipam_vlan_group" "vlan_group_test" {
name = "Test_VlanGroup"
slug = "Test_VlanGroup"
name = "TestVlanGroup"
slug = "TestVlanGroup"

max_vid = 4094
min_vid = 1

scope {
id = 1
type = "dcim.site"
}

tag {
name = "tag1"
slug = "tag1"
}

tag {
name = "tag2"
slug = "tag2"
custom_field {
name = "cf_boolean"
type = "boolean"
value = "true"
}

custom_field {
name = "cf_date"
type = "date"
value = "2020-12-25"
}

custom_field {
name = "cf_text"
type = "text"
value = "some text"
}

custom_field {
name = "cf_integer"
type = "integer"
value = "10"
}

custom_field {
name = "cf_selection"
type = "select"
value = "1"
}

custom_field {
name = "cf_url"
type = "url"
value = "https://github.com"
}

custom_field {
name = "cf_multi_selection"
type = "multiselect"
value = jsonencode([
"0",
"1"
])
}

custom_field {
name = "cf_json"
type = "json"
value = jsonencode({
stringvalue = "string"
boolvalue = false
dictionary = {
numbervalue = 5
}
})
}

custom_field {
name = "cf_object"
type = "object"
value = 1
}

custom_field {
name = "cf_multi_object"
type = "multiobject"
value = jsonencode([
1,
2
])
}
}

Expand Down
2 changes: 2 additions & 0 deletions examples/resources/netbox_ipam_vlan_group/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# VLAN groups can be imported by id
terraform import netbox_ipam_vlan_group.vlan_group_test 1
80 changes: 80 additions & 0 deletions examples/resources/netbox_ipam_vlan_group/resource.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,89 @@
resource "netbox_ipam_vlan_group" "vlan_group_test" {
name = "TestVlanGroup"
slug = "TestVlanGroup"
description = "Vlan group created by terraform"
max_vid = 4094
min_vid = 1

scope {
id = 1
type = "dcim.site"
}

tag {
name = "tag1"
slug = "tag1"
}

custom_field {
name = "cf_boolean"
type = "boolean"
value = "true"
}

custom_field {
name = "cf_date"
type = "date"
value = "2020-12-25"
}

custom_field {
name = "cf_text"
type = "text"
value = "some text"
}

custom_field {
name = "cf_integer"
type = "integer"
value = "10"
}

custom_field {
name = "cf_selection"
type = "select"
value = "1"
}

custom_field {
name = "cf_url"
type = "url"
value = "https://github.com"
}

custom_field {
name = "cf_multi_selection"
type = "multiselect"
value = jsonencode([
"0",
"1"
])
}

custom_field {
name = "cf_json"
type = "json"
value = jsonencode({
stringvalue = "string"
boolvalue = false
dictionary = {
numbervalue = 5
}
})
}

custom_field {
name = "cf_object"
type = "object"
value = 1
}

custom_field {
name = "cf_multi_object"
type = "multiobject"
value = jsonencode([
1,
2
])
}
}
Loading

0 comments on commit 67e7628

Please sign in to comment.