@@ -324,6 +324,108 @@ func TestAccScalewayLbBackend_WithFailoverHost(t *testing.T) {
324324	})
325325}
326326
327+ func  TestAccScalewayLbBackend_HealthCheck_Port (t  * testing.T ) {
328+ 	tt  :=  NewTestTools (t )
329+ 	defer  tt .Cleanup ()
330+ 	resource .ParallelTest (t , resource.TestCase {
331+ 		PreCheck :          func () { testAccPreCheck (t ) },
332+ 		ProviderFactories : tt .ProviderFactories ,
333+ 		CheckDestroy :      testAccCheckScalewayLbBackendDestroy (tt ),
334+ 		Steps : []resource.TestStep {
335+ 			{
336+ 				Config : ` 
337+ 				resource scaleway_lb_ip ip01 {} 
338+ 				resource scaleway_lb lb01 { 
339+ 					ip_id = scaleway_lb_ip.ip01.id 
340+ 					name = "test-lb" 
341+ 					type = "lb-s" 
342+ 				} 
343+ 
344+ 				resource scaleway_lb_backend bkd01 { 
345+ 					lb_id = scaleway_lb.lb01.id 
346+ 					name = "bkd01" 
347+ 					forward_protocol = "tcp" 
348+ 					forward_port = "3333" 
349+ 				} 
350+ 				` ,
351+ 				Check : resource .ComposeTestCheckFunc (
352+ 					testAccCheckScalewayLbBackendExists (tt , "scaleway_lb_backend.bkd01" ),
353+ 					resource .TestCheckResourceAttr ("scaleway_lb_backend.bkd01" , "forward_port" , "3333" ),
354+ 					resource .TestCheckResourceAttr ("scaleway_lb_backend.bkd01" , "health_check_port" , "3333" ),
355+ 				),
356+ 			},
357+ 			{
358+ 				Config : ` 
359+ 				resource scaleway_lb_ip ip01 {} 
360+ 				resource scaleway_lb lb01 { 
361+ 					ip_id = scaleway_lb_ip.ip01.id 
362+ 					name = "test-lb" 
363+ 					type = "lb-s" 
364+ 				} 
365+ 
366+ 				resource scaleway_lb_backend bkd01 { 
367+ 					lb_id = scaleway_lb.lb01.id 
368+ 					name = "bkd01" 
369+ 					forward_protocol = "tcp" 
370+ 					forward_port = "4444" 
371+ 				} 
372+ 				` ,
373+ 				Check : resource .ComposeTestCheckFunc (
374+ 					testAccCheckScalewayLbBackendExists (tt , "scaleway_lb_backend.bkd01" ),
375+ 					resource .TestCheckResourceAttr ("scaleway_lb_backend.bkd01" , "forward_port" , "4444" ),
376+ 					resource .TestCheckResourceAttr ("scaleway_lb_backend.bkd01" , "health_check_port" , "4444" ),
377+ 				),
378+ 			},
379+ 			{
380+ 				Config : ` 
381+ 				resource scaleway_lb_ip ip01 {} 
382+ 				resource scaleway_lb lb01 { 
383+ 					ip_id = scaleway_lb_ip.ip01.id 
384+ 					name = "test-lb" 
385+ 					type = "lb-s" 
386+ 				} 
387+ 
388+ 				resource scaleway_lb_backend bkd01 { 
389+ 					lb_id = scaleway_lb.lb01.id 
390+ 					name = "bkd01" 
391+ 					forward_protocol = "tcp" 
392+ 					forward_port = "4444" 
393+ 					health_check_port = "4444" 
394+ 				} 
395+ 				` ,
396+ 				Check : resource .ComposeTestCheckFunc (
397+ 					testAccCheckScalewayLbBackendExists (tt , "scaleway_lb_backend.bkd01" ),
398+ 					resource .TestCheckResourceAttr ("scaleway_lb_backend.bkd01" , "forward_port" , "4444" ),
399+ 					resource .TestCheckResourceAttr ("scaleway_lb_backend.bkd01" , "health_check_port" , "4444" ),
400+ 				),
401+ 			},
402+ 			{
403+ 				Config : ` 
404+ 				resource scaleway_lb_ip ip01 {} 
405+ 				resource scaleway_lb lb01 { 
406+ 					ip_id = scaleway_lb_ip.ip01.id 
407+ 					name = "test-lb" 
408+ 					type = "lb-s" 
409+ 				} 
410+ 
411+ 				resource scaleway_lb_backend bkd01 { 
412+ 					lb_id = scaleway_lb.lb01.id 
413+ 					name = "bkd01" 
414+ 					forward_protocol = "tcp" 
415+ 					forward_port = "5555" 
416+ 					health_check_port = "4444" 
417+ 				} 
418+ 				` ,
419+ 				Check : resource .ComposeTestCheckFunc (
420+ 					testAccCheckScalewayLbBackendExists (tt , "scaleway_lb_backend.bkd01" ),
421+ 					resource .TestCheckResourceAttr ("scaleway_lb_backend.bkd01" , "forward_port" , "5555" ),
422+ 					resource .TestCheckResourceAttr ("scaleway_lb_backend.bkd01" , "health_check_port" , "4444" ),
423+ 				),
424+ 			},
425+ 		},
426+ 	})
427+ }
428+ 
327429func  testAccCheckScalewayLbBackendExists (tt  * TestTools , n  string ) resource.TestCheckFunc  {
328430	return  func (state  * terraform.State ) error  {
329431		rs , ok  :=  state .RootModule ().Resources [n ]
0 commit comments