@@ -14,6 +14,8 @@ func TestAccNetboxModule_basic(t *testing.T) {
1414	testDevice  :=  testAccGetTestName ("device" )
1515	testModuleType  :=  testAccGetTestName ("module_type" )
1616	testModuleBay  :=  testAccGetTestName ("module_bay" )
17+ 	testSite  :=  testAccGetTestName ("site" )
18+ 	testDeviceRole  :=  testAccGetTestName ("device_role" )
1719	resource .ParallelTest (t , resource.TestCase {
1820		Providers : testAccProviders ,
1921		PreCheck :  func () { testAccPreCheck (t ) },
@@ -29,9 +31,20 @@ resource "netbox_device_type" "test" {
2931  manufacturer_id = netbox_manufacturer.test.id 
3032} 
3133
34+ resource "netbox_site" "test" { 
35+   name = "%s" 
36+ } 
37+ 
38+ resource "netbox_device_role" "test" { 
39+   name = "%s" 
40+   color_hex = "ff0000" 
41+ } 
42+ 
3243resource "netbox_device" "test" { 
3344  name          = "%s" 
3445  device_type_id = netbox_device_type.test.id 
46+   site_id       = netbox_site.test.id 
47+   role_id       = netbox_device_role.test.id 
3548} 
3649
3750resource "netbox_module_type" "test" { 
@@ -52,7 +65,7 @@ resource "netbox_module" "test" {
5265  serial        = "%s" 
5366  asset_tag     = "MT-001" 
5467  description   = "Test module" 
55- }` , testManufacturer , testDeviceType , testDevice , testModuleType , testModuleBay , testSerial ),
68+ }` , testManufacturer , testDeviceType , testSite ,  testDeviceRole ,  testDevice , testModuleType , testModuleBay , testSerial ),
5669				Check : resource .ComposeTestCheckFunc (
5770					resource .TestCheckResourceAttr ("netbox_module.test" , "status" , "active" ),
5871					resource .TestCheckResourceAttr ("netbox_module.test" , "serial" , testSerial ),
@@ -75,6 +88,8 @@ func TestAccNetboxModule_minimal(t *testing.T) {
7588	testDevice  :=  testAccGetTestName ("device" )
7689	testModuleType  :=  testAccGetTestName ("module_type" )
7790	testModuleBay  :=  testAccGetTestName ("module_bay" )
91+ 	testSite  :=  testAccGetTestName ("site" )
92+ 	testDeviceRole  :=  testAccGetTestName ("device_role" )
7893	resource .ParallelTest (t , resource.TestCase {
7994		Providers : testAccProviders ,
8095		PreCheck :  func () { testAccPreCheck (t ) },
@@ -90,9 +105,20 @@ resource "netbox_device_type" "test" {
90105  manufacturer_id = netbox_manufacturer.test.id 
91106} 
92107
108+ resource "netbox_site" "test" { 
109+   name = "%s" 
110+ } 
111+ 
112+ resource "netbox_device_role" "test" { 
113+   name = "%s" 
114+   color_hex = "ff0000" 
115+ } 
116+ 
93117resource "netbox_device" "test" { 
94118  name          = "%s" 
95119  device_type_id = netbox_device_type.test.id 
120+   site_id       = netbox_site.test.id 
121+   role_id       = netbox_device_role.test.id 
96122} 
97123
98124resource "netbox_module_type" "test" { 
@@ -110,7 +136,7 @@ resource "netbox_module" "test" {
110136  module_bay_id  = netbox_device_module_bay.test.id 
111137  module_type_id = netbox_module_type.test.id 
112138  status        = "planned" 
113- }` , testManufacturer , testDeviceType , testDevice , testModuleType , testModuleBay ),
139+ }` , testManufacturer , testDeviceType , testSite ,  testDeviceRole ,  testDevice , testModuleType , testModuleBay ),
114140				Check : resource .ComposeTestCheckFunc (
115141					resource .TestCheckResourceAttr ("netbox_module.test" , "status" , "planned" ),
116142				),
@@ -127,6 +153,8 @@ func TestAccNetboxModule_withTags(t *testing.T) {
127153	testModuleType  :=  testAccGetTestName ("module_type" )
128154	testModuleBay  :=  testAccGetTestName ("module_bay" )
129155	testTag  :=  testAccGetTestName ("tag" )
156+ 	testSite  :=  testAccGetTestName ("site" )
157+ 	testDeviceRole  :=  testAccGetTestName ("device_role" )
130158	resource .ParallelTest (t , resource.TestCase {
131159		Providers : testAccProviders ,
132160		PreCheck :  func () { testAccPreCheck (t ) },
@@ -142,9 +170,20 @@ resource "netbox_device_type" "test" {
142170  manufacturer_id = netbox_manufacturer.test.id 
143171} 
144172
173+ resource "netbox_site" "test" { 
174+   name = "%s" 
175+ } 
176+ 
177+ resource "netbox_device_role" "test" { 
178+   name = "%s" 
179+   color_hex = "ff0000" 
180+ } 
181+ 
145182resource "netbox_device" "test" { 
146183  name          = "%s" 
147184  device_type_id = netbox_device_type.test.id 
185+   site_id       = netbox_site.test.id 
186+   role_id       = netbox_device_role.test.id 
148187} 
149188
150189resource "netbox_module_type" "test" { 
@@ -168,7 +207,7 @@ resource "netbox_module" "test" {
168207  status        = "active" 
169208  serial        = "%s" 
170209  tags          = [netbox_tag.test.slug] 
171- }` , testManufacturer , testDeviceType , testDevice , testModuleType , testModuleBay , testTag , testSerial ),
210+ }` , testManufacturer , testDeviceType , testSite ,  testDeviceRole ,  testDevice , testModuleType , testModuleBay , testTag , testSerial ),
172211				Check : resource .ComposeTestCheckFunc (
173212					resource .TestCheckResourceAttr ("netbox_module.test" , "status" , "active" ),
174213					resource .TestCheckResourceAttr ("netbox_module.test" , "serial" , testSerial ),
0 commit comments