@@ -396,7 +396,47 @@ func TestAccTencentCloudClbListener_tcpssl(t *testing.T) {
396396 },
397397 })
398398}
399+ func TestAccTencentCloudClbListener_udp (t * testing.T ) {
400+ t .Parallel ()
399401
402+ resource .Test (t , resource.TestCase {
403+ PreCheck : func () { tcacctest .AccPreCheck (t ) },
404+ Providers : tcacctest .AccProviders ,
405+ CheckDestroy : testAccCheckClbListenerDestroy ,
406+ Steps : []resource.TestStep {
407+ {
408+ Config : testAccClbListener_udp ,
409+ Check : resource .ComposeTestCheckFunc (
410+ testAccCheckClbListenerExists ("tencentcloud_clb_listener.listener_basic_udp" ),
411+ resource .TestCheckResourceAttrSet ("tencentcloud_clb_listener.listener_basic_udp" , "clb_id" ),
412+ resource .TestCheckResourceAttr ("tencentcloud_clb_listener.listener_basic_udp" , "protocol" , "UDP" ),
413+ resource .TestCheckResourceAttr ("tencentcloud_clb_listener.listener_basic_udp" , "listener_name" , "listener_basic_udp" ),
414+ resource .TestCheckResourceAttr ("tencentcloud_clb_listener.listener_basic_udp" , "session_expire_time" , "30" ),
415+ resource .TestCheckResourceAttr ("tencentcloud_clb_listener.listener_basic_udp" , "port" , "1" ),
416+ resource .TestCheckResourceAttr ("tencentcloud_clb_listener.listener_basic_udp" , "scheduler" , "WRR" ),
417+ ),
418+ },
419+ {
420+ Config : testAccClbListener_udpUpdate ,
421+ Check : resource .ComposeTestCheckFunc (
422+ testAccCheckClbListenerExists ("tencentcloud_clb_listener.listener_basic_udp" ),
423+ resource .TestCheckResourceAttrSet ("tencentcloud_clb_listener.listener_basic_udp" , "clb_id" ),
424+ resource .TestCheckResourceAttr ("tencentcloud_clb_listener.listener_basic_udp" , "protocol" , "UDP" ),
425+ resource .TestCheckResourceAttr ("tencentcloud_clb_listener.listener_basic_udp" , "listener_name" , "listener_basic_udp_update" ),
426+ resource .TestCheckResourceAttr ("tencentcloud_clb_listener.listener_basic_udp" , "session_expire_time" , "30" ),
427+ resource .TestCheckResourceAttr ("tencentcloud_clb_listener.listener_basic_udp" , "port" , "1" ),
428+ resource .TestCheckResourceAttr ("tencentcloud_clb_listener.listener_basic_udp" , "scheduler" , "WRR" ),
429+ resource .TestCheckResourceAttr ("tencentcloud_clb_listener.listener_basic_udp" , "health_check_type" , "CUSTOM" ),
430+ ),
431+ },
432+ {
433+ ResourceName : "tencentcloud_clb_listener.listener_basic_udp" ,
434+ ImportState : true ,
435+ ImportStateVerify : true ,
436+ },
437+ },
438+ })
439+ }
400440func testAccCheckClbListenerDestroy (s * terraform.State ) error {
401441 logId := tccommon .GetLogId (tccommon .ContextNil )
402442 ctx := context .WithValue (context .TODO (), tccommon .LogIdKey , logId )
@@ -471,7 +511,39 @@ resource "tencentcloud_clb_listener" "listener_basic" {
471511 target_type = "TARGETGROUP"
472512}
473513`
514+ const testAccClbListener_udp = `
515+ resource "tencentcloud_clb_instance" "clb_basic_udp" {
516+ network_type = "OPEN"
517+ clb_name = "tf-clb-listener-basic"
518+ }
519+
520+ resource "tencentcloud_clb_listener" "listener_basic_udp" {
521+ clb_id = tencentcloud_clb_instance.clb_basic_udp.id
522+ port = 1
523+ protocol = "UDP"
524+ listener_name = "listener_basic_udp"
525+ session_expire_time = 30
526+ scheduler = "WRR"
527+ target_type = "TARGETGROUP"
528+ }
529+ `
530+ const testAccClbListener_udpUpdate = `
531+ resource "tencentcloud_clb_instance" "clb_basic_udp" {
532+ network_type = "OPEN"
533+ clb_name = "tf-clb-listener-basic"
534+ }
474535
536+ resource "tencentcloud_clb_listener" "listener_basic_udp" {
537+ clb_id = tencentcloud_clb_instance.clb_basic_udp.id
538+ port = 1
539+ protocol = "UDP"
540+ listener_name = "listener_basic_udp_update"
541+ session_expire_time = 30
542+ scheduler = "WRR"
543+ target_type = "TARGETGROUP"
544+ health_check_type = "CUSTOM"
545+ }
546+ `
475547const testAccClbListener_portRange = `
476548resource "tencentcloud_clb_instance" "clb_basic" {
477549 network_type = "OPEN"
0 commit comments