Skip to content

Commit

Permalink
define custom_field in test before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
a-willem committed Dec 14, 2024
1 parent 7a1fb20 commit 32eb9f4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions netbox/data_source_netbox_vlans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ resource "netbox_vlan" "test_2" {
resource "netbox_vlan" "test_3" {
name = "VLAN1236"
vid = 1236
}
type = "text"
content_types = ["ipam.vlan"]
weight = 100
default = "red"
validation_regex = "^.*$"
}
resource "netbox_custom_field" "test_field2" {
name = "field2"
type = "text"
content_types = ["ipam.vlan"]
weight = 100
default = "red"
validation_regex = "^.*$"
}
resource "netbox_vlan" "test_with_custom_fields" {
name = "VLAN_CUSTOM"
Expand Down
16 changes: 16 additions & 0 deletions netbox/resource_netbox_vlan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ resource "netbox_vlan_group" "test_group" {

func testAccNetboxVlanWithCustomFields(testName string) string {
return fmt.Sprintf(`
resource "netbox_custom_field" "test_field1" {
name = "field1"
type = "text"
content_types = ["ipam.vlan"]
weight = 100
default = "red"
validation_regex = "^.*$"
}
resource "netbox_custom_field" "test_field2" {
name = "field2"
type = "text"
content_types = ["ipam.vlan"]
weight = 100
default = "red"
validation_regex = "^.*$"
}
resource "netbox_vlan" "test_with_custom_fields" {
name = "%s"
vid = 888
Expand Down

0 comments on commit 32eb9f4

Please sign in to comment.