From e674ec473b9153366eda8bc4d26773f3c54fc649 Mon Sep 17 00:00:00 2001 From: Kagashino Date: Tue, 5 Jul 2022 17:22:26 +0800 Subject: [PATCH 1/7] feat: clb target - support bind eni ip --- tencentcloud/basic_test.go | 1 + .../resource_tc_alb_server_attachment.go | 6 +- .../resource_tc_alb_server_attachment_test.go | 4 +- tencentcloud/resource_tc_clb_attachment.go | 98 +++++++++++++++---- .../resource_tc_clb_attachment_test.go | 13 ++- tencentcloud/resource_tc_clb_instance_test.go | 2 +- tencentcloud/service_tencentcloud_clb.go | 33 ++++--- website/docs/r/clb_attachment.html.markdown | 15 +-- 8 files changed, 121 insertions(+), 51 deletions(-) diff --git a/tencentcloud/basic_test.go b/tencentcloud/basic_test.go index 3ff1cbf47d..232640f754 100644 --- a/tencentcloud/basic_test.go +++ b/tencentcloud/basic_test.go @@ -425,6 +425,7 @@ data "tencentcloud_instances" "instance" { locals { cvm_id = data.tencentcloud_instances.instance.instance_list.0.instance_id cvm_az = "` + defaultAZone + `" + cvm_private_ip = data.tencentcloud_instances.instance.instance_list.0.private_ip } ` diff --git a/tencentcloud/resource_tc_alb_server_attachment.go b/tencentcloud/resource_tc_alb_server_attachment.go index b864ef57c8..d331c890ca 100644 --- a/tencentcloud/resource_tc_alb_server_attachment.go +++ b/tencentcloud/resource_tc_alb_server_attachment.go @@ -132,7 +132,7 @@ func resourceTencentCloudAlbServerAttachmentCreate(d *schema.ResourceData, meta for _, inst_ := range d.Get("backends").(*schema.Set).List() { inst := inst_.(map[string]interface{}) - request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["port"], inst["weight"])) + request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["eni_ip"], inst["port"], inst["weight"])) } err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { @@ -277,7 +277,7 @@ func resourceTencentCloudAlbServerAttachementRemove(d *schema.ResourceData, meta } for _, inst_ := range remove { inst := inst_.(map[string]interface{}) - request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["port"], inst["weight"])) + request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["eni_ip"], inst["port"], inst["weight"])) } err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { @@ -325,7 +325,7 @@ func resourceTencentCloudAlbServerAttachementAdd(d *schema.ResourceData, meta in for _, inst_ := range add { inst := inst_.(map[string]interface{}) - request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["port"], inst["weight"])) + request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["eni_ip"], inst["port"], inst["weight"])) } err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { requestId := "" diff --git a/tencentcloud/resource_tc_alb_server_attachment_test.go b/tencentcloud/resource_tc_alb_server_attachment_test.go index e219b04221..870c002da1 100644 --- a/tencentcloud/resource_tc_alb_server_attachment_test.go +++ b/tencentcloud/resource_tc_alb_server_attachment_test.go @@ -12,7 +12,7 @@ import ( ) func TestAccTencentCloudAlbServerAttachmentTcp(t *testing.T) { - t.Parallel() + t.Skipf("Deprecated resource TestAccTencentCloudAlbServerAttachmentTcp, skip testing") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -42,7 +42,7 @@ func TestAccTencentCloudAlbServerAttachmentTcp(t *testing.T) { } func TestAccTencentCloudAlbServerAttachmentHttp(t *testing.T) { - t.Parallel() + t.Skipf("Deprecated resource TestAccTencentCloudAlbServerAttachmentTcp, skip testing") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, diff --git a/tencentcloud/resource_tc_clb_attachment.go b/tencentcloud/resource_tc_clb_attachment.go index b1a5a7f0b9..f9a939cd83 100644 --- a/tencentcloud/resource_tc_clb_attachment.go +++ b/tencentcloud/resource_tc_clb_attachment.go @@ -85,8 +85,13 @@ func resourceTencentCloudClbServerAttachment() *schema.Resource { Schema: map[string]*schema.Schema{ "instance_id": { Type: schema.TypeString, - Required: true, - Description: "Id of the backend server.", + Optional: true, + Description: "CVM Instance Id of the backend server, conflict with `eni_ip` but must specify one of them.", + }, + "eni_ip": { + Type: schema.TypeString, + Optional: true, + Description: "Eni IP address of the backend server, conflict with `instance_id` but must specify one of them.", }, "port": { Type: schema.TypeInt, @@ -147,7 +152,7 @@ func resourceTencentCloudClbServerAttachmentCreate(d *schema.ResourceData, meta break } inst := insList[index].(map[string]interface{}) - request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["port"], inst["weight"])) + request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["eni_ip"], inst["port"], inst["weight"])) } err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { @@ -220,7 +225,7 @@ func resourceTencentCloudClbServerAttachmentDelete(d *schema.ResourceData, meta break } inst := insList[index].(map[string]interface{}) - request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["port"], inst["weight"])) + request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["eni_ip"], inst["port"], inst["weight"])) } err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { @@ -318,9 +323,9 @@ func resourceTencentCloudClbServerAttachmentAdd(d *schema.ResourceData, meta int } } - for _, inst_ := range add { - inst := inst_.(map[string]interface{}) - request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["port"], inst["weight"])) + for _, v := range add { + inst := v.(map[string]interface{}) + request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["eni_ip"], inst["port"], inst["weight"])) } err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { requestId := "" @@ -432,21 +437,44 @@ func resourceTencentCloudClbServerAttachmentRead(d *schema.ResourceData, meta in //this may cause problems when there are members in two dimensions array //need to read state of the tfstate file to clear the relationships //in this situation, import action is not supported + // TL,DR: just update partial targets which this resource declared. stateTargets := d.Get("targets").(*schema.Set) if stateTargets.Len() != 0 { //the old state exist //create a new attachment with state - exactTargets := make([]*clb.Backend, 0) - for _, v := range onlineTargets { - if stateTargets.Contains(map[string]interface{}{ - "weight": int(*v.Weight), - "port": int(*v.Port), - "instance_id": *v.InstanceId, - }) { - exactTargets = append(exactTargets, v) + exactTargets := make([]interface{}, 0) + for i := range onlineTargets { + v := onlineTargets[i] + if v.InstanceId != nil { + target := map[string]interface{}{ + "weight": int(*v.Weight), + "port": int(*v.Port), + "instance_id": *v.InstanceId, + } + if stateTargets.Contains(target) { + exactTargets = append(exactTargets, map[string]interface{}{ + "weight": int(*v.Weight), + "port": int(*v.Port), + "instance_id": *v.InstanceId, + }) + } + + } else if len(v.PrivateIpAddresses) > 0 && *v.PrivateIpAddresses[0] != "" { + target := map[string]interface{}{ + "weight": int(*v.Weight), + "port": int(*v.Port), + "eni_ip": *v.PrivateIpAddresses[0], + } + if stateTargets.Contains(target) { + exactTargets = append(exactTargets, map[string]interface{}{ + "weight": int(*v.Weight), + "port": int(*v.Port), + "eni_ip": *v.PrivateIpAddresses[0], + }) + } } } - _ = d.Set("targets", flattenBackendList(exactTargets)) + _ = d.Set("targets", exactTargets) } else { _ = d.Set("targets", flattenBackendList(onlineTargets)) } @@ -466,7 +494,7 @@ func getRemoveCandidates(ctx context.Context, clbService ClbService, clbId strin for _, item := range remove { target := item.(map[string]interface{}) - if targetGroupContainsInstance(existTargetGroups, target["instance_id"].(string)) { + if targetGroupContainsInstance(existTargetGroups, target["instance_id"]) || targetGroupContainsEni(existTargetGroups, target["eni_ip"]) { removeCandidates = append(removeCandidates, target) } } @@ -474,14 +502,42 @@ func getRemoveCandidates(ctx context.Context, clbService ClbService, clbId strin return removeCandidates } -func targetGroupContainsInstance(targets []*clb.Backend, instanceId string) (contains bool) { +func targetGroupContainsInstance(targets []*clb.Backend, instanceId interface{}) (contains bool) { contains = false + id, ok := instanceId.(string) + if !ok || id == "" { + return + } for _, target := range targets { - if instanceId == *target.InstanceId { - log.Printf("[WARN] Instance %s applied.", instanceId) + if target.InstanceId == nil { + continue + } + if id == *target.InstanceId { + log.Printf("[WARN] Instance %s applied.", id) return true } } - log.Printf("[WARN] Instance %s not exist, skip deregister.", instanceId) + log.Printf("[WARN] Instance %s not exist, skip deregister.", id) + + return +} + +func targetGroupContainsEni(targets []*clb.Backend, eniIp interface{}) (contains bool) { + contains = false + ip, ok := eniIp.(string) + if !ok || ip == "" { + return + } + for _, target := range targets { + if len(target.PrivateIpAddresses) > 0 && target.PrivateIpAddresses[0] != nil { + continue + } + if ip == *target.PrivateIpAddresses[0] { + log.Printf("[WARN] IP %s applied.", ip) + return true + } + } + log.Printf("[WARN] IP %s not exist, skip deregister.", ip) + return } diff --git a/tencentcloud/resource_tc_clb_attachment_test.go b/tencentcloud/resource_tc_clb_attachment_test.go index 48084e76e5..24c9b8be87 100644 --- a/tencentcloud/resource_tc_clb_attachment_test.go +++ b/tencentcloud/resource_tc_clb_attachment_test.go @@ -199,7 +199,7 @@ resource "tencentcloud_clb_attachment" "foo" { } ` -const testAccClbServerAttachment_tcp_update = instanceCommonTestCase + ` +const testAccClbServerAttachment_tcp_update = instanceCommonTestCase + presetCVM + ` data "tencentcloud_ssl_certificates" "foo" { name = "keep" } @@ -208,6 +208,7 @@ resource "tencentcloud_clb_instance" "foo" { network_type = "OPEN" clb_name = "tf-clb-attach-tcp-test" vpc_id = var.cvm_vpc_id + snat_pro = true } resource "tencentcloud_clb_listener" "foo" { @@ -229,14 +230,14 @@ resource "tencentcloud_clb_attachment" "foo" { listener_id = tencentcloud_clb_listener.foo.listener_id targets { - instance_id = tencentcloud_instance.default.id + eni_ip = local.cvm_private_ip port = 23 weight = 50 } } ` -const testAccClbServerAttachment_tcp_update_ssl = instanceCommonTestCase + ` +const testAccClbServerAttachment_tcp_update_ssl = instanceCommonTestCase + presetCVM + ` data "tencentcloud_ssl_certificates" "foo" { name = "keep" } @@ -245,6 +246,7 @@ resource "tencentcloud_clb_instance" "foo" { network_type = "OPEN" clb_name = "tf-clb-attach-tcp-ssl" vpc_id = var.cvm_vpc_id + snat_pro = true } # This is will force new as expected @@ -263,15 +265,16 @@ resource "tencentcloud_clb_attachment" "foo" { clb_id = tencentcloud_clb_instance.foo.id listener_id = tencentcloud_clb_listener.foo.listener_id + # cross network target targets { - instance_id = tencentcloud_instance.default.id + eni_ip = local.cvm_private_ip port = 23 weight = 50 } } ` -const testAccClbServerAttachment_http = instanceCommonTestCase + ` +const testAccClbServerAttachment_http = instanceCommonTestCase + presetCVM + ` resource "tencentcloud_clb_instance" "foo" { network_type = "OPEN" clb_name = "tf-clb-attach-http-test" diff --git a/tencentcloud/resource_tc_clb_instance_test.go b/tencentcloud/resource_tc_clb_instance_test.go index 92d59131ea..e5d2db45e2 100644 --- a/tencentcloud/resource_tc_clb_instance_test.go +++ b/tencentcloud/resource_tc_clb_instance_test.go @@ -22,7 +22,7 @@ const OpenClbName = "tf-clb-open" const OpenClbNameUpdate = "tf-clb-update-open" func init() { - // -sweep-run=tencentcloud_clb_instance + // go test -v ./tencentcloud -sweep=ap-guangzhou -sweep-run=tencentcloud_clb_instance resource.AddTestSweepers("tencentcloud_clb_instance", &resource.Sweeper{ Name: "tencentcloud_clb_instance", F: testSweepClbInstance, diff --git a/tencentcloud/service_tencentcloud_clb.go b/tencentcloud/service_tencentcloud_clb.go index 31e4e89f66..baab60568f 100644 --- a/tencentcloud/service_tencentcloud_clb.go +++ b/tencentcloud/service_tencentcloud_clb.go @@ -522,7 +522,7 @@ func (me *ClbService) DeleteAttachmentById(ctx context.Context, clbId string, li request.LoadBalancerId = &clbId for _, inst_ := range targets { inst := inst_.(map[string]interface{}) - request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["port"], inst["weight"])) + request.Targets = append(request.Targets, clbNewTarget(inst["instance_id"], inst["eni_ip"], inst["port"], inst["weight"])) } if locationId != "" { request.LocationId = &locationId @@ -1006,29 +1006,38 @@ func waitForTaskFinish(requestId string, meta *clb.Client) (err error) { func flattenBackendList(list []*clb.Backend) (mapping []map[string]interface{}) { result := make([]map[string]interface{}, 0, len(list)) - for _, v := range list { + for i := range list { + v := list[i] target := map[string]interface{}{ - "instance_id": v.InstanceId, - "port": v.Port, - "weight": v.Weight, + "port": v.Port, + "weight": v.Weight, + } + if *v.Type == "ENI" { + target["eni_ip"] = v.InstanceId + } else { + target["instance_id"] = v.InstanceId } result = append(result, target) } return result } -func clbNewTarget(instanceId, port, weight interface{}) *clb.Target { - id := instanceId.(string) +func clbNewTarget(instanceId, eniIp, port, weight interface{}) *clb.Target { p := int64(port.(int)) - bk := clb.Target{ - InstanceId: &id, - Port: &p, + target := clb.Target{ + Port: &p, + } + if id, ok := instanceId.(string); ok && id != "" { + target.InstanceId = &id + } + if ip, ok := eniIp.(string); ok && ip != "" { + target.EniIp = &ip } if w, ok := weight.(int); ok { weight64 := int64(w) - bk.Weight = &weight64 + target.Weight = &weight64 } - return &bk + return &target } func (me *ClbService) CreateTargetGroup(ctx context.Context, targetGroupName string, vpcId string, port uint64, diff --git a/website/docs/r/clb_attachment.html.markdown b/website/docs/r/clb_attachment.html.markdown index b5f1c9bf38..aa53ff622a 100644 --- a/website/docs/r/clb_attachment.html.markdown +++ b/website/docs/r/clb_attachment.html.markdown @@ -31,16 +31,17 @@ resource "tencentcloud_clb_attachment" "foo" { The following arguments are supported: -* `clb_id` - (Required, String, ForceNew) ID of the CLB. -* `listener_id` - (Required, String, ForceNew) ID of the CLB listener. -* `targets` - (Required, Set) Information of the backends to be attached. -* `rule_id` - (Optional, String, ForceNew) ID of the CLB listener rule. Only supports listeners of `HTTPS` and `HTTP` protocol. +* `clb_id` - (Required, ForceNew) ID of the CLB. +* `listener_id` - (Required, ForceNew) ID of the CLB listener. +* `targets` - (Required) Information of the backends to be attached. +* `rule_id` - (Optional, ForceNew) ID of the CLB listener rule. Only supports listeners of `HTTPS` and `HTTP` protocol. The `targets` object supports the following: -* `instance_id` - (Required, String) Id of the backend server. -* `port` - (Required, Int) Port of the backend server. Valid value ranges: (0~65535). -* `weight` - (Optional, Int) Forwarding weight of the backend service. Valid value ranges: (0~100). defaults to `10`. +* `port` - (Required) Port of the backend server. Valid value ranges: (0~65535). +* `eni_ip` - (Optional) Eni IP address of the backend server, conflict with `instance_id` but must specify one of them. +* `instance_id` - (Optional) CVM Instance Id of the backend server, conflict with `eni_ip` but must specify one of them. +* `weight` - (Optional) Forwarding weight of the backend service. Valid value ranges: (0~100). defaults to `10`. ## Attributes Reference From 58f9f56f32457f1ad7fa95e0257cc559d59f9cf5 Mon Sep 17 00:00:00 2001 From: Kagashino Date: Tue, 5 Jul 2022 19:26:17 +0800 Subject: [PATCH 2/7] WIP: finish one eni_ip bind --- tencentcloud/resource_tc_clb_attachment.go | 1 + tencentcloud/service_tencentcloud_clb.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tencentcloud/resource_tc_clb_attachment.go b/tencentcloud/resource_tc_clb_attachment.go index f9a939cd83..288c74bf2b 100644 --- a/tencentcloud/resource_tc_clb_attachment.go +++ b/tencentcloud/resource_tc_clb_attachment.go @@ -459,6 +459,7 @@ func resourceTencentCloudClbServerAttachmentRead(d *schema.ResourceData, meta in }) } + //FIXME : apply all ips } else if len(v.PrivateIpAddresses) > 0 && *v.PrivateIpAddresses[0] != "" { target := map[string]interface{}{ "weight": int(*v.Weight), diff --git a/tencentcloud/service_tencentcloud_clb.go b/tencentcloud/service_tencentcloud_clb.go index baab60568f..a6f661835b 100644 --- a/tencentcloud/service_tencentcloud_clb.go +++ b/tencentcloud/service_tencentcloud_clb.go @@ -1012,8 +1012,8 @@ func flattenBackendList(list []*clb.Backend) (mapping []map[string]interface{}) "port": v.Port, "weight": v.Weight, } - if *v.Type == "ENI" { - target["eni_ip"] = v.InstanceId + if *v.Type == "ENI" && len(v.PrivateIpAddresses) > 0 { + target["eni_ip"] = v.PrivateIpAddresses[0] } else { target["instance_id"] = v.InstanceId } From 2e26d302b3350a458185482fd806928191996e3a Mon Sep 17 00:00:00 2001 From: Kagashino Date: Wed, 6 Jul 2022 16:16:48 +0800 Subject: [PATCH 3/7] fix: clb attach - target.Type check --- tencentcloud/resource_tc_clb_attachment.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tencentcloud/resource_tc_clb_attachment.go b/tencentcloud/resource_tc_clb_attachment.go index 288c74bf2b..11996d69e7 100644 --- a/tencentcloud/resource_tc_clb_attachment.go +++ b/tencentcloud/resource_tc_clb_attachment.go @@ -445,7 +445,7 @@ func resourceTencentCloudClbServerAttachmentRead(d *schema.ResourceData, meta in exactTargets := make([]interface{}, 0) for i := range onlineTargets { v := onlineTargets[i] - if v.InstanceId != nil { + if *v.Type == "CVM" && v.InstanceId != nil { target := map[string]interface{}{ "weight": int(*v.Weight), "port": int(*v.Port), @@ -459,7 +459,6 @@ func resourceTencentCloudClbServerAttachmentRead(d *schema.ResourceData, meta in }) } - //FIXME : apply all ips } else if len(v.PrivateIpAddresses) > 0 && *v.PrivateIpAddresses[0] != "" { target := map[string]interface{}{ "weight": int(*v.Weight), From e30036999fb43f1835a97171e51b58b335980773 Mon Sep 17 00:00:00 2001 From: Kagashino Date: Wed, 6 Jul 2022 17:02:39 +0800 Subject: [PATCH 4/7] fix: clb attach data - merge into same vpc --- tencentcloud/data_source_tc_clb_attachments_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tencentcloud/data_source_tc_clb_attachments_test.go b/tencentcloud/data_source_tc_clb_attachments_test.go index 97255c9ade..fc269c742c 100644 --- a/tencentcloud/data_source_tc_clb_attachments_test.go +++ b/tencentcloud/data_source_tc_clb_attachments_test.go @@ -32,7 +32,7 @@ const testAccTencentCloudDataSourceClbServerAttachments = instanceCommonTestCase resource "tencentcloud_clb_instance" "foo" { network_type = "OPEN" clb_name = var.instance_name - vpc_id = var.vpc_id + vpc_id = var.cvm_vpc_id } resource "tencentcloud_clb_listener" "foo" { From 46aafe33e8b3d8bccb1b648994102409731387fc Mon Sep 17 00:00:00 2001 From: Kagashino Date: Fri, 8 Jul 2022 16:55:27 +0800 Subject: [PATCH 5/7] fix: clb target group data testcase --- tencentcloud/data_source_tc_clb_target_groups_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tencentcloud/data_source_tc_clb_target_groups_test.go b/tencentcloud/data_source_tc_clb_target_groups_test.go index 6c9c5f8b92..2cff2d50df 100644 --- a/tencentcloud/data_source_tc_clb_target_groups_test.go +++ b/tencentcloud/data_source_tc_clb_target_groups_test.go @@ -12,7 +12,7 @@ const ( targetGroupResource = "tencentcloud_clb_target_group.test" ) -func TestAccTencentCloudDataSourceClbTargetGroup(t *testing.T) { +func TestAccTencentCloudClbTargetGroupDataSource(t *testing.T) { t.Parallel() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -53,10 +53,11 @@ func TestAccTencentCloudDataSourceClbTargetGroup(t *testing.T) { }) } -const tareGetGroupBase = ` +const tareGetGroupBase = defaultVpcSubnets + ` resource "tencentcloud_clb_instance" "clb_basic" { network_type = "OPEN" clb_name = "tf-clb-rule-basic" + vpc_id = local.vpc_id } resource "tencentcloud_clb_listener" "listener_basic" { @@ -78,13 +79,14 @@ resource "tencentcloud_clb_listener_rule" "rule_basic" { resource "tencentcloud_clb_target_group" "test"{ target_group_name = "test-target-keep-1" + vpc_id = local.vpc_id } resource "tencentcloud_clb_target_group_attachment" "group" { clb_id = tencentcloud_clb_instance.clb_basic.id listener_id = tencentcloud_clb_listener.listener_basic.listener_id rule_id = tencentcloud_clb_listener_rule.rule_basic.rule_id - targrt_group_id = tencentcloud_clb_target_group.test.id + target_group_id = tencentcloud_clb_target_group.test.id } ` From b528aaed86781607782a601e4ea851459b1af730 Mon Sep 17 00:00:00 2001 From: Kagashino Date: Mon, 11 Jul 2022 19:27:20 +0800 Subject: [PATCH 6/7] fix: clb listener health_check_port testcase --- tencentcloud/resource_tc_clb_listener_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tencentcloud/resource_tc_clb_listener_test.go b/tencentcloud/resource_tc_clb_listener_test.go index 461688f512..c55bd40cbe 100644 --- a/tencentcloud/resource_tc_clb_listener_test.go +++ b/tencentcloud/resource_tc_clb_listener_test.go @@ -602,6 +602,7 @@ resource "tencentcloud_clb_listener" "listener_tcp"{ session_expire_time = 60 scheduler = "WRR" health_check_type = "TCP" + health_check_port = 333 } ` From cbec4049cb41725abae4edc716387cbfa0861b3d Mon Sep 17 00:00:00 2001 From: Kagashino Date: Tue, 12 Jul 2022 19:19:37 +0800 Subject: [PATCH 7/7] fix: clb sync doc of typings --- website/docs/r/clb_attachment.html.markdown | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/website/docs/r/clb_attachment.html.markdown b/website/docs/r/clb_attachment.html.markdown index aa53ff622a..055d8b2bb0 100644 --- a/website/docs/r/clb_attachment.html.markdown +++ b/website/docs/r/clb_attachment.html.markdown @@ -31,17 +31,17 @@ resource "tencentcloud_clb_attachment" "foo" { The following arguments are supported: -* `clb_id` - (Required, ForceNew) ID of the CLB. -* `listener_id` - (Required, ForceNew) ID of the CLB listener. -* `targets` - (Required) Information of the backends to be attached. -* `rule_id` - (Optional, ForceNew) ID of the CLB listener rule. Only supports listeners of `HTTPS` and `HTTP` protocol. +* `clb_id` - (Required, String, ForceNew) ID of the CLB. +* `listener_id` - (Required, String, ForceNew) ID of the CLB listener. +* `targets` - (Required, Set) Information of the backends to be attached. +* `rule_id` - (Optional, String, ForceNew) ID of the CLB listener rule. Only supports listeners of `HTTPS` and `HTTP` protocol. The `targets` object supports the following: -* `port` - (Required) Port of the backend server. Valid value ranges: (0~65535). -* `eni_ip` - (Optional) Eni IP address of the backend server, conflict with `instance_id` but must specify one of them. -* `instance_id` - (Optional) CVM Instance Id of the backend server, conflict with `eni_ip` but must specify one of them. -* `weight` - (Optional) Forwarding weight of the backend service. Valid value ranges: (0~100). defaults to `10`. +* `port` - (Required, Int) Port of the backend server. Valid value ranges: (0~65535). +* `eni_ip` - (Optional, String) Eni IP address of the backend server, conflict with `instance_id` but must specify one of them. +* `instance_id` - (Optional, String) CVM Instance Id of the backend server, conflict with `eni_ip` but must specify one of them. +* `weight` - (Optional, Int) Forwarding weight of the backend service. Valid value ranges: (0~100). defaults to `10`. ## Attributes Reference