From fc274cc82ad98d3da104ca499b6582127ec3efc2 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 28 May 2021 19:37:15 +0800 Subject: [PATCH 01/27] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8B=BC=E5=86=99?= =?UTF-8?q?=E9=94=99=E8=AF=AF=20favorate=20->=20favorite,=20=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=20https://registry.terraform.io/providers/tencentclou?= =?UTF-8?q?dstack/tencentcloud/latest/docs/resources/instance=20=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_instance.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tencentcloud/resource_tc_instance.go b/tencentcloud/resource_tc_instance.go index 859f378fb5..a1afc7acbc 100644 --- a/tencentcloud/resource_tc_instance.go +++ b/tencentcloud/resource_tc_instance.go @@ -42,7 +42,7 @@ resource "tencentcloud_subnet" "app" { // Create 2 CVM instances to host awesome_app resource "tencentcloud_instance" "my_awesome_app" { instance_name = "awesome_app" - availability_zone = data.tencentcloud_availability_zones.my_favorate_zones.zones.0.name + availability_zone = data.tencentcloud_availability_zones.my_favorite_zones.zones.0.name image_id = data.tencentcloud_images.my_favorite_image.images.0.image_id instance_type = data.tencentcloud_instance_types.my_favorite_instance_types.instance_types.0.instance_type system_disk_type = "CLOUD_PREMIUM" From 1e046f56d7aea8336ad3e5db1c320a4d95caf211 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 31 May 2021 10:06:03 +0800 Subject: [PATCH 02/27] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=94=AF=E6=8C=81=20cl?= =?UTF-8?q?b=20=E5=88=9B=E5=BB=BA=E7=9B=AE=E6=A0=87=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E7=BB=84=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=9B=B8=E5=BA=94=E5=87=BD=E6=95=B0=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_target_group.go | 61 +++++++++++++++++++- tencentcloud/service_tencentcloud_clb.go | 3 +- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/tencentcloud/resource_tc_clb_target_group.go b/tencentcloud/resource_tc_clb_target_group.go index 510b8f9b6b..689b56545f 100644 --- a/tencentcloud/resource_tc_clb_target_group.go +++ b/tencentcloud/resource_tc_clb_target_group.go @@ -22,9 +22,9 @@ package tencentcloud import ( "context" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" clb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" ) func resourceTencentCloudClbTargetGroup() *schema.Resource { @@ -50,6 +50,44 @@ func resourceTencentCloudClbTargetGroup() *schema.Resource { ForceNew: true, Description: "VPC ID, default is based on the network.", }, + "port": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validatePort, + Description: "The default port of target group, add server after can use it.", + }, + "target_group_instances": { + Type: schema.TypeList, + Optional: true, + Description: "The backend server of target group bind.", + Elem: schema.Resource{ + Schema: map[string]*schema.Schema{ + "bind_ip": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validateIp, + Description: "The internal ip of target group instance.", + }, + "port": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validatePort, + Description: "The port of target group instance.", + }, + "weight": { + Type: schema.TypeInt, + Optional: true, + Description: "The weight of target group instance.", + }, + "new_port": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validatePort, + Description: "The new port of target group instance.", + }, + }, + }, + }, }, } } @@ -63,12 +101,31 @@ func resourceTencentCloudClbTargetCreate(d *schema.ResourceData, meta interface{ clbService = ClbService{client: meta.(*TencentCloudClient).apiV3Conn} vpcId = d.Get("vpc_id").(string) targetGroupName = d.Get("target_group_name").(string) + port = uint64(d.Get("port").(int)) insAttachments = make([]*clb.TargetGroupInstance, 0) targetGroupId string err error ) - targetGroupId, err = clbService.CreateTargetGroup(ctx, targetGroupName, vpcId, insAttachments) + if v, ok := d.GetOk("target_group_instance"); ok { + targetGroupInstances := v.([]interface{}) + for _, v1 := range targetGroupInstances { + value := v1.(map[string]interface{}) + bindIP := value["bind_ip"].(string) + port := helper.Uint64(uint64(value["port"].(int))) + weight := helper.Uint64(uint64(value["weight"].(int))) + newPort := helper.Uint64(uint64(value["new_port"].(int))) + tgtGrp := &clb.TargetGroupInstance{ + BindIP: &bindIP, + Port: port, + Weight: weight, + NewPort: newPort, + } + insAttachments = append(insAttachments, tgtGrp) + } + } + + targetGroupId, err = clbService.CreateTargetGroup(ctx, targetGroupName, vpcId, port, insAttachments) if err != nil { return err } diff --git a/tencentcloud/service_tencentcloud_clb.go b/tencentcloud/service_tencentcloud_clb.go index cd94744019..53d735c1dc 100644 --- a/tencentcloud/service_tencentcloud_clb.go +++ b/tencentcloud/service_tencentcloud_clb.go @@ -1025,13 +1025,14 @@ func clbNewTarget(instanceId, port, weight interface{}) *clb.Target { return &bk } -func (me *ClbService) CreateTargetGroup(ctx context.Context, targetGroupName string, vpcId string, +func (me *ClbService) CreateTargetGroup(ctx context.Context, targetGroupName string, vpcId string, port uint64, targetGroupInstances []*clb.TargetGroupInstance) (targetGroupId string, err error) { var response *clb.CreateTargetGroupResponse request := clb.NewCreateTargetGroupRequest() request.TargetGroupName = &targetGroupName request.TargetGroupInstances = targetGroupInstances + request.Port = &port if vpcId != "" { request.VpcId = &vpcId } From d761221f2621883bb7af722b3b194e5ccee1d090 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 31 May 2021 10:25:39 +0800 Subject: [PATCH 03/27] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=9A=84=E5=91=BD=E4=BB=A4=E8=A1=8C=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=94=99=E8=AF=AF,Elem=E5=AD=97=E6=AE=B5=E4=BD=BF=E7=94=A8=20s?= =?UTF-8?q?chema.Resource=E6=8C=87=E9=92=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_target_group.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tencentcloud/resource_tc_clb_target_group.go b/tencentcloud/resource_tc_clb_target_group.go index 689b56545f..20c11a39b4 100644 --- a/tencentcloud/resource_tc_clb_target_group.go +++ b/tencentcloud/resource_tc_clb_target_group.go @@ -24,7 +24,6 @@ import ( "context" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" clb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317" - "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" ) func resourceTencentCloudClbTargetGroup() *schema.Resource { @@ -60,7 +59,7 @@ func resourceTencentCloudClbTargetGroup() *schema.Resource { Type: schema.TypeList, Optional: true, Description: "The backend server of target group bind.", - Elem: schema.Resource{ + Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "bind_ip": { Type: schema.TypeString, @@ -112,14 +111,14 @@ func resourceTencentCloudClbTargetCreate(d *schema.ResourceData, meta interface{ for _, v1 := range targetGroupInstances { value := v1.(map[string]interface{}) bindIP := value["bind_ip"].(string) - port := helper.Uint64(uint64(value["port"].(int))) - weight := helper.Uint64(uint64(value["weight"].(int))) - newPort := helper.Uint64(uint64(value["new_port"].(int))) + port := uint64(value["port"].(int)) + weight := uint64(value["weight"].(int)) + newPort := uint64(value["new_port"].(int)) tgtGrp := &clb.TargetGroupInstance{ BindIP: &bindIP, - Port: port, - Weight: weight, - NewPort: newPort, + Port: &port, + Weight: &weight, + NewPort: &newPort, } insAttachments = append(insAttachments, tgtGrp) } From feab63138689ba4e0af10fe96d4a5aebbc3bc8c0 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 31 May 2021 10:33:39 +0800 Subject: [PATCH 04/27] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E7=BB=84=E5=AF=B9=E5=86=85=E7=BD=91clb=E7=9A=84=E6=94=AF?= =?UTF-8?q?=E6=8C=81(=E6=B3=A8=E9=87=8A=E6=8E=89=E5=AF=B9=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E7=BD=91=E7=BB=9C=E6=98=AF=E5=90=A6=E4=B8=BA=E5=86=85?= =?UTF-8?q?=E7=BD=91=E7=9A=84=E5=88=A4=E6=96=AD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_instance.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tencentcloud/resource_tc_clb_instance.go b/tencentcloud/resource_tc_clb_instance.go index 67e3f05882..34ce363ceb 100644 --- a/tencentcloud/resource_tc_clb_instance.go +++ b/tencentcloud/resource_tc_clb_instance.go @@ -197,11 +197,7 @@ func resourceTencentCloudClbInstanceCreate(d *schema.ResourceData, meta interfac if (targetRegionInfoRegion != "" && targetRegionInfoVpcId == "") || (targetRegionInfoRegion == "" && targetRegionInfoVpcId != "") { return fmt.Errorf("[CHECK][CLB instance][Create] check: region and vpc_id must be set at same time") } - if _, ok := d.GetOk("security_groups"); ok { - if networkType == CLB_NETWORK_TYPE_INTERNAL { - return fmt.Errorf("[CHECK][CLB instance][Create] check: INTERNAL network_type do not support this operation with sercurity_groups") - } - } + request := clb.NewCreateLoadBalancerRequest() request.LoadBalancerType = helper.String(networkType) request.LoadBalancerName = helper.String(clbName) @@ -515,9 +511,7 @@ func resourceTencentCloudClbInstanceUpdate(d *schema.ResourceData, meta interfac } if d.HasChange("security_groups") { - if d.Get("network_type") == CLB_NETWORK_TYPE_INTERNAL { - return fmt.Errorf("[CHECK][CLB instance %s][Update] check: INTERNAL network_type do not support this operation with sercurity_groups", clbId) - } + sgRequest := clb.NewSetLoadBalancerSecurityGroupsRequest() sgRequest.LoadBalancerId = helper.String(clbId) securityGroups := d.Get("security_groups").([]interface{}) From d0ba33b62613f614ace5528ef90579312bf46201 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 31 May 2021 11:05:04 +0800 Subject: [PATCH 05/27] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=92=8C=E5=85=B3=E9=97=ADCLB=E5=AE=89?= =?UTF-8?q?=E5=85=A8=E7=BB=84=E9=BB=98=E8=AE=A4=E6=94=BE=E9=80=9A=E7=9A=84?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_instance.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tencentcloud/resource_tc_clb_instance.go b/tencentcloud/resource_tc_clb_instance.go index 34ce363ceb..4c7cd6d892 100644 --- a/tencentcloud/resource_tc_clb_instance.go +++ b/tencentcloud/resource_tc_clb_instance.go @@ -159,6 +159,12 @@ func resourceTencentCloudClbInstance() *schema.Resource { Computed: true, Description: "Network operator, only applicable to open CLB. Valid values are `CMCC`(China Mobile), `CTCC`(Telecom), `CUCC`(China Unicom) and `BGP`. If this ISP is specified, network billing method can only use the bandwidth package billing (BANDWIDTH_PACKAGE).", }, + "load_balancer_pass_to_target": { + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Whether the target allow flow come from clb. If value is true, only check security group of clb, or check both clb and backend instance security group.", + }, }, } } @@ -308,6 +314,7 @@ func resourceTencentCloudClbInstanceCreate(d *schema.ResourceData, meta interfac } if targetRegionInfoRegion != "" { + isLoadBalancePassToTgt := d.Get("load_balancer_pass_to_target").(bool) targetRegionInfo := clb.TargetRegionInfo{ Region: &targetRegionInfoRegion, VpcId: &targetRegionInfoVpcId, @@ -315,6 +322,7 @@ func resourceTencentCloudClbInstanceCreate(d *schema.ResourceData, meta interfac mRequest := clb.NewModifyLoadBalancerAttributesRequest() mRequest.LoadBalancerId = helper.String(clbId) mRequest.TargetRegionInfo = &targetRegionInfo + mRequest.LoadBalancerPassToTarget = &isLoadBalancePassToTgt err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { mResponse, e := meta.(*TencentCloudClient).apiV3Conn.UseClbClient().ModifyLoadBalancerAttributes(mRequest) if e != nil { @@ -477,6 +485,10 @@ func resourceTencentCloudClbInstanceUpdate(d *schema.ResourceData, meta interfac if d.HasChange("internet_charge_type") || d.HasChange("internet_bandwidth_max_out") { request.InternetChargeInfo = &internet } + if d.HasChange("load_balancer_pass_to_target") { + isLoadBalancerPassToTgt := d.Get("load_balancer_pass_to_target").(bool) + request.LoadBalancerPassToTarget = &isLoadBalancerPassToTgt + } err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { response, e := meta.(*TencentCloudClient).apiV3Conn.UseClbClient().ModifyLoadBalancerAttributes(request) if e != nil { From 50805fc0bf26af41c5f4f106046a85c225fd61cd Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 31 May 2021 14:35:21 +0800 Subject: [PATCH 06/27] =?UTF-8?q?=E6=B7=BB=E5=8A=A0terraform=E6=94=AF?= =?UTF-8?q?=E6=8C=81external=20CLB=E5=88=9B=E5=BB=BAAZ=E5=AE=9E=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_instance.go | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tencentcloud/resource_tc_clb_instance.go b/tencentcloud/resource_tc_clb_instance.go index 4c7cd6d892..001ee4ed28 100644 --- a/tencentcloud/resource_tc_clb_instance.go +++ b/tencentcloud/resource_tc_clb_instance.go @@ -165,6 +165,21 @@ func resourceTencentCloudClbInstance() *schema.Resource { Default: true, Description: "Whether the target allow flow come from clb. If value is true, only check security group of clb, or check both clb and backend instance security group.", }, + "master_zone_id": { + Type: schema.TypeString, + Optional: true, + Description: "Setting master zone id of cross available zone disaster recovery, only applicable to open CLB.", + }, + "zone_id": { + Type: schema.TypeString, + Optional: true, + Description: "Available zone id, only applicable to open CLB.", + }, + "slave_zone_id": { + Type: schema.TypeString, + Optional: true, + Description: "Setting slave zone id of cross available zone disaster recovery, only applicable to open CLB. this zone will undertake traffic when the master is down", + }, }, } } @@ -254,6 +269,26 @@ func resourceTencentCloudClbInstanceCreate(d *schema.ResourceData, meta interfac } } + if v, ok := d.GetOk("master_zone_id"); ok { + if networkType == CLB_NETWORK_TYPE_INTERNAL { + return fmt.Errorf("[CHECK][CLB instance][Create] check: INTERNAL network_type do not support master zone id setting") + } + request.MasterZoneId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("zone_id"); ok { + if networkType == CLB_NETWORK_TYPE_INTERNAL { + return fmt.Errorf("[CHECK][CLB instance][Create] check: INTERNAL network_type do not support zone id setting") + } + request.ZoneId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("slave_zone_id"); ok { + if networkType == CLB_NETWORK_TYPE_INTERNAL { + return fmt.Errorf("[CHECK][CLB instance][Create] check: INTERNAL network_type do not support slave zone id setting") + } + request.SlaveZoneId = helper.String(v.(string)) + } clbId := "" var response *clb.CreateLoadBalancerResponse err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { @@ -406,6 +441,10 @@ func resourceTencentCloudClbInstanceRead(d *schema.ResourceData, meta interface{ _ = d.Set("internet_charge_type", instance.NetworkAttributes.InternetChargeType) } + _ = d.Set("master_zone_id", instance.MasterZone) + _ = d.Set("zone_id", instance.MasterZone) + _ = d.Set("slave_zone_id", instance.MasterZone) + tcClient := meta.(*TencentCloudClient).apiV3Conn tagService := &TagService{client: tcClient} tags, err := tagService.DescribeResourceTags(ctx, "clb", "clb", tcClient.Region, d.Id()) From db39be6e0d4a78082e088f749225908b79bcd322 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 31 May 2021 15:02:33 +0800 Subject: [PATCH 07/27] =?UTF-8?q?=E6=B7=BB=E5=8A=A0clb=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E5=B7=A5=E4=BD=9C=E7=BB=84=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E8=B0=83=E7=94=A8create=E5=90=8E=E7=9A=84update=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E4=B8=AD=E7=9A=84=20port=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_target_group.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tencentcloud/resource_tc_clb_target_group.go b/tencentcloud/resource_tc_clb_target_group.go index 20c11a39b4..c0a222dbb4 100644 --- a/tencentcloud/resource_tc_clb_target_group.go +++ b/tencentcloud/resource_tc_clb_target_group.go @@ -155,6 +155,7 @@ func resourceTencentCloudClbTargetRead(d *schema.ResourceData, meta interface{}) } _ = d.Set("target_group_name", targetGroupInfos[0].TargetGroupName) _ = d.Set("vpc_id", targetGroupInfos[0].VpcId) + _ = d.Set("port", targetGroupInfos[0].Port) return nil } From 09a6db1c125bdb09bd5492819bb81440555d9a09 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 31 May 2021 15:06:53 +0800 Subject: [PATCH 08/27] =?UTF-8?q?=E6=B7=BB=E5=8A=A0create=E4=B8=AD?= =?UTF-8?q?=E8=B0=83=E7=94=A8update=E6=93=8D=E4=BD=9C=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEload=5Fbalancer=5Fpass=5Fto=5Ftarget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_instance.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tencentcloud/resource_tc_clb_instance.go b/tencentcloud/resource_tc_clb_instance.go index 001ee4ed28..a791e00db4 100644 --- a/tencentcloud/resource_tc_clb_instance.go +++ b/tencentcloud/resource_tc_clb_instance.go @@ -441,6 +441,7 @@ func resourceTencentCloudClbInstanceRead(d *schema.ResourceData, meta interface{ _ = d.Set("internet_charge_type", instance.NetworkAttributes.InternetChargeType) } + _ = d.Set("load_balancer_pass_to_target", instance.LoadBalancerPassToTarget) _ = d.Set("master_zone_id", instance.MasterZone) _ = d.Set("zone_id", instance.MasterZone) _ = d.Set("slave_zone_id", instance.MasterZone) From c460e68a32c49c5b6c8d2ca5234884c2598af1b7 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 1 Jun 2021 14:53:55 +0800 Subject: [PATCH 09/27] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9C=A8=20resourceTen?= =?UTF-8?q?centCloudClbInstanceUpdate=20=E4=B8=AD=E5=AF=B9=20LoadBalancerP?= =?UTF-8?q?assToTarget=20=E5=8F=96=E5=80=BC=E7=9A=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=20tf=20=E6=96=87=E4=BB=B6=E8=AF=A5?= =?UTF-8?q?=E5=80=BC=E6=9C=89=E5=8F=98=E5=8C=96=E6=97=B6=EF=BC=8C=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=A7=A6=E5=8F=91=E6=9B=B4=E6=94=B9=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_instance.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tencentcloud/resource_tc_clb_instance.go b/tencentcloud/resource_tc_clb_instance.go index a791e00db4..2bb33144e8 100644 --- a/tencentcloud/resource_tc_clb_instance.go +++ b/tencentcloud/resource_tc_clb_instance.go @@ -472,6 +472,7 @@ func resourceTencentCloudClbInstanceUpdate(d *schema.ResourceData, meta interfac targetRegionInfo := clb.TargetRegionInfo{} internet := clb.InternetAccessible{} changed := false + isLoadBalancerPassToTgt := false if d.HasChange("clb_name") { changed = true @@ -513,6 +514,11 @@ func resourceTencentCloudClbInstanceUpdate(d *schema.ResourceData, meta interfac } } + if d.HasChange("load_balancer_pass_to_target") { + changed = true + isLoadBalancerPassToTgt = d.Get("load_balancer_pass_to_target").(bool) + } + if changed { request := clb.NewModifyLoadBalancerAttributesRequest() request.LoadBalancerId = helper.String(clbId) @@ -526,7 +532,6 @@ func resourceTencentCloudClbInstanceUpdate(d *schema.ResourceData, meta interfac request.InternetChargeInfo = &internet } if d.HasChange("load_balancer_pass_to_target") { - isLoadBalancerPassToTgt := d.Get("load_balancer_pass_to_target").(bool) request.LoadBalancerPassToTarget = &isLoadBalancerPassToTgt } err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { From 0ec89d43ed4417a98be1873c82107032d6f6aa00 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 2 Jun 2021 14:46:27 +0800 Subject: [PATCH 10/27] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=AF=E6=8C=81inter?= =?UTF-8?q?nal=20CLB=E7=9A=84security=20group=20=E4=B8=ADdescription?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_instance.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tencentcloud/resource_tc_clb_instance.go b/tencentcloud/resource_tc_clb_instance.go index 2bb33144e8..fda5ebb0ca 100644 --- a/tencentcloud/resource_tc_clb_instance.go +++ b/tencentcloud/resource_tc_clb_instance.go @@ -135,7 +135,7 @@ func resourceTencentCloudClbInstance() *schema.Resource { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, - Description: "Security groups of the CLB instance. Only supports `OPEN` CLBs.", + Description: "Security groups of the CLB instance. Supports both `OPEN` and `INTERNAL` CLBs.", }, "target_region_info_region": { Type: schema.TypeString, From 37314e6e5866a6b52f90b0c6b95a2d2908a001d8 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 2 Jun 2021 14:48:09 +0800 Subject: [PATCH 11/27] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B0=83=E7=94=A8=20Cr?= =?UTF-8?q?eateClusterInstances=E6=97=B6=EF=BC=8C=E4=BC=A0=E5=85=A5imageId?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=9D=A5=E6=8C=87=E5=AE=9A=E9=95=9C=E5=83=8F?= =?UTF-8?q?=EF=BC=8C=E4=BB=A5=E5=8F=8A=E5=AF=B9=E9=95=9C=E5=83=8F=E7=9A=84?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=EF=BC=8C=E6=BB=A1=E8=B6=B3=20img-xxx=20?= =?UTF-8?q?=E7=9A=84=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_container_cluster_instance.go | 10 ++++++++++ tencentcloud/resource_tc_kubernetes_cluster.go | 10 ++++++++++ tencentcloud/validators.go | 8 ++++++++ 3 files changed, 28 insertions(+) diff --git a/tencentcloud/resource_tc_container_cluster_instance.go b/tencentcloud/resource_tc_container_cluster_instance.go index 8445470a00..8d35c9d338 100644 --- a/tencentcloud/resource_tc_container_cluster_instance.go +++ b/tencentcloud/resource_tc_container_cluster_instance.go @@ -199,6 +199,12 @@ func resourceTencentCloudContainerClusterInstance() *schema.Resource { Computed: true, Description: "Describe the lan ip of the node.", }, + "os": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateImageID, + Description: "The valid image id, format of img-xxx.", + }, }, } } @@ -461,6 +467,10 @@ func resourceTencentCloudContainerClusterInstancesCreate(d *schema.ResourceData, iAdvanced.Unschedulable = helper.IntInt64(v.(int)) } + if v, ok := d.GetOk("os"); ok { + runInstancesPara.ImageId = helper.String(v.(string)) + } + runInstancesParas := runInstancesPara.ToJsonString() cvms.Work = []string{runInstancesParas} diff --git a/tencentcloud/resource_tc_kubernetes_cluster.go b/tencentcloud/resource_tc_kubernetes_cluster.go index 75a99fe104..4d9c9e6602 100644 --- a/tencentcloud/resource_tc_kubernetes_cluster.go +++ b/tencentcloud/resource_tc_kubernetes_cluster.go @@ -549,6 +549,12 @@ func TkeCvmCreateInfo() map[string]*schema.Schema { Elem: &schema.Schema{Type: schema.TypeString}, Description: "Disaster recover groups to which a CVM instance belongs. Only support maximum 1.", }, + "os": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateImageID, + Description: "The valid image id, format of img-xxx.", + }, } } @@ -1262,6 +1268,10 @@ func tkeGetCvmRunInstancesPara(dMap map[string]interface{}, meta interface{}, } } + if v, ok := dMap["os"]; ok { + request.ImageId = helper.String(v.(string)) + } + cvmJson = request.ToJsonString() cvmJson = strings.Replace(cvmJson, `"Password":"",`, "", -1) diff --git a/tencentcloud/validators.go b/tencentcloud/validators.go index 71506624e3..85b0baec97 100644 --- a/tencentcloud/validators.go +++ b/tencentcloud/validators.go @@ -65,6 +65,14 @@ func validateIp(v interface{}, k string) (ws []string, errors []error) { return } +func validateImageID(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if !strings.HasPrefix(value, "img-") { + errors = append(errors, fmt.Errorf("the format of %q is invalid: %s, it should begin with `img-`", k, value)) + } + return +} + // NOTE not exactly strict, but ok for now func validateIntegerInRange(min, max int64) schema.SchemaValidateFunc { return func(v interface{}, k string) (ws []string, errors []error) { From 8afa7737df21b38c50c94bdb92d4b856195b356b Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 2 Jun 2021 14:55:00 +0800 Subject: [PATCH 12/27] =?UTF-8?q?=E5=9B=9E=E9=80=80=E7=89=88=E6=9C=AC(?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=95=9C=E5=83=8F)=EF=BC=8C=E8=AF=A5?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8D=E5=86=8D=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_container_cluster_instance.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tencentcloud/resource_tc_container_cluster_instance.go b/tencentcloud/resource_tc_container_cluster_instance.go index 8d35c9d338..8445470a00 100644 --- a/tencentcloud/resource_tc_container_cluster_instance.go +++ b/tencentcloud/resource_tc_container_cluster_instance.go @@ -199,12 +199,6 @@ func resourceTencentCloudContainerClusterInstance() *schema.Resource { Computed: true, Description: "Describe the lan ip of the node.", }, - "os": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validateImageID, - Description: "The valid image id, format of img-xxx.", - }, }, } } @@ -467,10 +461,6 @@ func resourceTencentCloudContainerClusterInstancesCreate(d *schema.ResourceData, iAdvanced.Unschedulable = helper.IntInt64(v.(int)) } - if v, ok := d.GetOk("os"); ok { - runInstancesPara.ImageId = helper.String(v.(string)) - } - runInstancesParas := runInstancesPara.ToJsonString() cvms.Work = []string{runInstancesParas} From 8a14a18208ccfac1e29f79a55cef2c8d6b108c18 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 2 Jun 2021 15:02:15 +0800 Subject: [PATCH 13/27] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E8=A1=8C=E5=8F=82=E6=95=B0=E7=9A=84key,=20os=20->=20img=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_kubernetes_cluster.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tencentcloud/resource_tc_kubernetes_cluster.go b/tencentcloud/resource_tc_kubernetes_cluster.go index 4d9c9e6602..e86ecc7d8b 100644 --- a/tencentcloud/resource_tc_kubernetes_cluster.go +++ b/tencentcloud/resource_tc_kubernetes_cluster.go @@ -549,7 +549,7 @@ func TkeCvmCreateInfo() map[string]*schema.Schema { Elem: &schema.Schema{Type: schema.TypeString}, Description: "Disaster recover groups to which a CVM instance belongs. Only support maximum 1.", }, - "os": { + "img_id": { Type: schema.TypeString, Optional: true, ValidateFunc: validateImageID, @@ -1268,7 +1268,7 @@ func tkeGetCvmRunInstancesPara(dMap map[string]interface{}, meta interface{}, } } - if v, ok := dMap["os"]; ok { + if v, ok := dMap["img_id"]; ok { request.ImageId = helper.String(v.(string)) } From c34706f8be54678a6d45dcf525dbb0e1c9b19d78 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 2 Jun 2021 17:28:44 +0800 Subject: [PATCH 14/27] =?UTF-8?q?=E4=BF=AE=E6=94=B9tke=E8=B5=84=E6=BA=90is?= =?UTF-8?q?=5Fnon=5Fstatic=5Fip=5Fmode=E6=8F=8F=E8=BF=B0=E4=B8=8D=E5=BD=93?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF,=20static=20->=20non-static?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/data_source_tc_kubernetes_clusters.go | 2 +- tencentcloud/resource_tc_kubernetes_cluster.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tencentcloud/data_source_tc_kubernetes_clusters.go b/tencentcloud/data_source_tc_kubernetes_clusters.go index 84f5f65410..e224f34fab 100644 --- a/tencentcloud/data_source_tc_kubernetes_clusters.go +++ b/tencentcloud/data_source_tc_kubernetes_clusters.go @@ -137,7 +137,7 @@ func tkeClusterInfo() map[string]*schema.Schema { "is_non_static_ip_mode": { Type: schema.TypeBool, Computed: true, - Description: "Indicates whether static ip mode is enabled.", + Description: "Indicates whether non-static ip mode is enabled.", }, "kube_proxy_mode": { Type: schema.TypeString, diff --git a/tencentcloud/resource_tc_kubernetes_cluster.go b/tencentcloud/resource_tc_kubernetes_cluster.go index e86ecc7d8b..3c4c998e91 100644 --- a/tencentcloud/resource_tc_kubernetes_cluster.go +++ b/tencentcloud/resource_tc_kubernetes_cluster.go @@ -750,7 +750,7 @@ func resourceTencentCloudTkeCluster() *schema.Resource { ForceNew: true, Optional: true, Default: false, - Description: "Indicates whether static ip mode is enabled. Default is false.", + Description: "Indicates whether non-static ip mode is enabled. Default is false.", }, "deletion_protection": { Type: schema.TypeBool, From d9de732fed9fd9a91df354dc02ada59d0fdc626c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 4 Jun 2021 15:16:16 +0800 Subject: [PATCH 15/27] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Update=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=AF=B9Port=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_target_group.go | 19 ++++++++++++++++--- tencentcloud/service_tencentcloud_clb.go | 3 ++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/tencentcloud/resource_tc_clb_target_group.go b/tencentcloud/resource_tc_clb_target_group.go index c0a222dbb4..c4dc10333a 100644 --- a/tencentcloud/resource_tc_clb_target_group.go +++ b/tencentcloud/resource_tc_clb_target_group.go @@ -106,7 +106,7 @@ func resourceTencentCloudClbTargetCreate(d *schema.ResourceData, meta interface{ err error ) - if v, ok := d.GetOk("target_group_instance"); ok { + if v, ok := d.GetOk("target_group_instances"); ok { targetGroupInstances := v.([]interface{}) for _, v1 := range targetGroupInstances { value := v1.(map[string]interface{}) @@ -168,15 +168,28 @@ func resourceTencentCloudClbTargetUpdate(d *schema.ResourceData, meta interface{ ctx = context.WithValue(context.TODO(), logIdKey, logId) clbService = ClbService{client: meta.(*TencentCloudClient).apiV3Conn} targetGroupId = d.Id() + port uint64 + tgtGroupName string ) + isChanged := false + if d.HasChange("port") { + isChanged = true + port = uint64(d.Get("port").(int)) + } + if d.HasChange("target_group_name") { - targetGroupName := d.Get("target_group_name").(string) - err := clbService.ModifyTargetGroup(ctx, targetGroupId, targetGroupName) + isChanged = true + tgtGroupName = d.Get("target_group_name").(string) + } + + if isChanged { + err := clbService.ModifyTargetGroup(ctx, targetGroupId, tgtGroupName, port) if err != nil { return err } } + return resourceTencentCloudClbTargetRead(d, meta) } diff --git a/tencentcloud/service_tencentcloud_clb.go b/tencentcloud/service_tencentcloud_clb.go index 53d735c1dc..3aa60accf1 100644 --- a/tencentcloud/service_tencentcloud_clb.go +++ b/tencentcloud/service_tencentcloud_clb.go @@ -1055,10 +1055,11 @@ func (me *ClbService) CreateTargetGroup(ctx context.Context, targetGroupName str return } -func (me *ClbService) ModifyTargetGroup(ctx context.Context, targetGroupId string, targetGroupName string) (err error) { +func (me *ClbService) ModifyTargetGroup(ctx context.Context, targetGroupId, targetGroupName string, port uint64) (err error) { request := clb.NewModifyTargetGroupAttributeRequest() request.TargetGroupId = &targetGroupId request.TargetGroupName = &targetGroupName + request.Port = &port err = resource.Retry(writeRetryTimeout, func() *resource.RetryError { _, err := me.client.UseClbClient().ModifyTargetGroupAttribute(request) From c28a83993bebb367199c4ddb1b953635b897a717 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 4 Jun 2021 16:15:04 +0800 Subject: [PATCH 16/27] =?UTF-8?q?=E9=9C=80=E6=B1=82=20=E6=94=AF=E6=8C=81ex?= =?UTF-8?q?ternal=20CLB=E5=88=9B=E5=BB=BA=E5=A4=9AAZ=E5=AE=9E=E4=BE=8B=20D?= =?UTF-8?q?escription=E6=B7=BB=E5=8A=A0master=5Fzone=E5=8F=8A=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E7=BB=93=E6=9E=9C=E7=9B=B8=E5=BA=94=E7=9A=84=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/data_source_tc_clb_instances.go | 41 ++++++++++++++++++++ tencentcloud/service_tencentcloud_clb.go | 3 ++ 2 files changed, 44 insertions(+) diff --git a/tencentcloud/data_source_tc_clb_instances.go b/tencentcloud/data_source_tc_clb_instances.go index 5b627f0f91..435028a34d 100644 --- a/tencentcloud/data_source_tc_clb_instances.go +++ b/tencentcloud/data_source_tc_clb_instances.go @@ -56,6 +56,11 @@ func dataSourceTencentCloudClbInstances() *schema.Resource { Optional: true, Description: "Used to save results.", }, + "master_zone": { + Type: schema.TypeString, + Optional: true, + Description: "Master available zone id.", + }, "clb_list": { Type: schema.TypeList, Computed: true, @@ -154,6 +159,31 @@ func dataSourceTencentCloudClbInstances() *schema.Resource { Computed: true, Description: "Max bandwidth out, only applicable to open CLB. Valid value ranges is [1, 2048]. Unit is MB.", }, + "zone_id": { + Type: schema.TypeInt, + Computed: true, + Description: "Available zone unique id(numerical representation), This field maybe null, means cannot get a valid value", + }, + "zone": { + Type: schema.TypeString, + Computed: true, + Description: "Available zone unique id(string representation), This field maybe null, means cannot get a valid value", + }, + "zone_name": { + Type: schema.TypeString, + Computed: true, + Description: "Available zone name, This field maybe null, means cannot get a valid value", + }, + "zone_region": { + Type: schema.TypeString, + Computed: true, + Description: "Region that this available zone belong to, This field maybe null, means cannot get a valid value", + }, + "local_zone": { + Type: schema.TypeBool, + Computed: true, + Description: "Whether this available zone is local zone, This field maybe null, means cannot get a valid value", + }, }, }, }, @@ -180,6 +210,9 @@ func dataSourceTencentCloudClbInstancesRead(d *schema.ResourceData, meta interfa if v, ok := d.GetOk("network_type"); ok { params["network_type"] = v.(string) } + if v, ok := d.GetOk("master_zone"); ok { + params["master_zone"] = v.(string) + } clbService := ClbService{ client: meta.(*TencentCloudClient).apiV3Conn, @@ -221,6 +254,14 @@ func dataSourceTencentCloudClbInstancesRead(d *schema.ResourceData, meta interfa mapping["internet_charge_type"] = *clbInstance.NetworkAttributes.InternetChargeType mapping["internet_bandwidth_max_out"] = *clbInstance.NetworkAttributes.InternetMaxBandwidthOut } + if clbInstance.MasterZone != nil { + mapping["zone_id"] = *clbInstance.MasterZone.ZoneId + mapping["zone"] = *clbInstance.MasterZone.Zone + mapping["zone_name"] = *clbInstance.MasterZone.ZoneName + mapping["zone_region"] = *clbInstance.MasterZone.ZoneRegion + mapping["local_zone"] = *clbInstance.MasterZone.LocalZone + } + if clbInstance.Tags != nil { tags := make(map[string]interface{}, len(clbInstance.Tags)) for _, t := range clbInstance.Tags { diff --git a/tencentcloud/service_tencentcloud_clb.go b/tencentcloud/service_tencentcloud_clb.go index 3aa60accf1..90f661f2dc 100644 --- a/tencentcloud/service_tencentcloud_clb.go +++ b/tencentcloud/service_tencentcloud_clb.go @@ -78,6 +78,9 @@ func (me *ClbService) DescribeLoadBalancerByFilter(ctx context.Context, params m projectId := int64(v.(int)) request.ProjectId = &projectId } + if k == "master_zone" { + request.MasterZone = helper.String(v.(string)) + } } offset := int64(0) From 690bfcc2bb9a9955dfcbba489898e68627fa8adf Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 4 Jun 2021 18:57:08 +0800 Subject: [PATCH 17/27] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E5=91=BD=EF=BC=8C=E5=8F=8A=20hcl=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_instance.go | 13 +++++ tencentcloud/resource_tc_clb_instance_test.go | 54 +++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/tencentcloud/resource_tc_clb_instance.go b/tencentcloud/resource_tc_clb_instance.go index fda5ebb0ca..f3319c547b 100644 --- a/tencentcloud/resource_tc_clb_instance.go +++ b/tencentcloud/resource_tc_clb_instance.go @@ -37,6 +37,19 @@ resource "tencentcloud_clb_instance" "open_clb" { } ``` +Create target group + +```hcl +resource "tencentcloud_clb_target_group" "test"{ + target_group_name = "hello1" + port = 18082 + target_group_instances { + bind_ip = "10.0.0.4" + port = 18080 + } +} +``` + Import CLB instance can be imported using the id, e.g. diff --git a/tencentcloud/resource_tc_clb_instance_test.go b/tencentcloud/resource_tc_clb_instance_test.go index 30df298088..ddd8f713fa 100644 --- a/tencentcloud/resource_tc_clb_instance_test.go +++ b/tencentcloud/resource_tc_clb_instance_test.go @@ -116,6 +116,38 @@ func TestAccTencentCloudClbInstance_internal(t *testing.T) { }) } +func TestAccTencentCloudClbInstanceTargetGroup(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckClbInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccClbInstanceTargetGroup, + Check: resource.ComposeTestCheckFunc( + testAccCheckClbInstanceExists("tencentcloud_clb_instance.target_group"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_name", "tgt_grp_test"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "port", "33"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.bind_ip", "10.0.0.4"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.port", "33"), + ), + }, + { + Config: testAccClbInstanceTargetGroupUpdate, + Check: resource.ComposeTestCheckFunc( + testAccCheckClbInstanceExists("tencentcloud_clb_instance.target_group"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_name", "tgt_grp_test"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "port", "33"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.bind_ip", "10.0.0.4"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.port", "44"), + ), + }, + }, + }) +} + func testAccCheckClbInstanceDestroy(s *terraform.State) error { logId := getLogId(contextNil) ctx := context.WithValue(context.TODO(), logIdKey, logId) @@ -280,3 +312,25 @@ resource "tencentcloud_clb_instance" "clb_open" { } } ` + +const testAccClbInstanceTargetGroup = ` +resource "tencentcloud_clb_instance" "target_group" { + target_group_name = "tgt_grp_test" + port = 33 + target_group_instances { + bind_ip = "10.0.0.4" + port = 18800 + } +} +` + +const testAccClbInstanceTargetGroupUpdate = ` +resource "tencentcloud_clb_instance" "target_group" { + target_group_name = "tgt_grp_test" + port = 44 + target_group_instances { + bind_ip = "10.0.0.4" + port = 18800 + } +} +` From 335ff4d10936873bf4e6a2f409e186c62d2100e8 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 4 Jun 2021 19:05:28 +0800 Subject: [PATCH 18/27] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E5=91=BD=EF=BC=8C=E5=8F=8A=20hcl=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_target_group.go | 13 +++++ .../resource_tc_clb_target_group_test.go | 54 +++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/tencentcloud/resource_tc_clb_target_group.go b/tencentcloud/resource_tc_clb_target_group.go index c4dc10333a..9f46a3ef40 100644 --- a/tencentcloud/resource_tc_clb_target_group.go +++ b/tencentcloud/resource_tc_clb_target_group.go @@ -10,6 +10,19 @@ resource "tencentcloud_clb_target_group" "test"{ } ``` +Create target group + +```hcl +resource "tencentcloud_clb_target_group" "test"{ + target_group_name = "hello1" + port = 18082 + target_group_instances { + bind_ip = "10.0.0.4" + port = 18080 + } +} +``` + Import CLB target group can be imported using the id, e.g. diff --git a/tencentcloud/resource_tc_clb_target_group_test.go b/tencentcloud/resource_tc_clb_target_group_test.go index a30d3b0d6d..d9a0ac5639 100644 --- a/tencentcloud/resource_tc_clb_target_group_test.go +++ b/tencentcloud/resource_tc_clb_target_group_test.go @@ -28,6 +28,38 @@ func TestAccTencentCloudClbTargetGroup_basic(t *testing.T) { }) } +func TestAccTencentCloudClbInstanceTargetGroup(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckClbInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccClbInstanceTargetGroup, + Check: resource.ComposeTestCheckFunc( + testAccCheckClbInstanceExists("tencentcloud_clb_instance.target_group"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_name", "tgt_grp_test"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "port", "33"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.bind_ip", "10.0.0.4"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.port", "33"), + ), + }, + { + Config: testAccClbInstanceTargetGroupUpdate, + Check: resource.ComposeTestCheckFunc( + testAccCheckClbInstanceExists("tencentcloud_clb_instance.target_group"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_name", "tgt_grp_test"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "port", "33"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.bind_ip", "10.0.0.4"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.port", "44"), + ), + }, + }, + }) +} + func testAccCheckClbTargetGroupDestroy(s *terraform.State) error { logId := getLogId(contextNil) ctx := context.WithValue(context.TODO(), logIdKey, logId) @@ -81,3 +113,25 @@ resource "tencentcloud_clb_target_group" "test"{ target_group_name = "qwe" } ` + +const testAccClbInstanceTargetGroup = ` +resource "tencentcloud_clb_instance" "target_group" { + target_group_name = "tgt_grp_test" + port = 33 + target_group_instances { + bind_ip = "10.0.0.4" + port = 18800 + } +} +` + +const testAccClbInstanceTargetGroupUpdate = ` +resource "tencentcloud_clb_instance" "target_group" { + target_group_name = "tgt_grp_test" + port = 44 + target_group_instances { + bind_ip = "10.0.0.4" + port = 18800 + } +} +` From 00338f9acad0a1022f83d2c460a2173a9ffc8e0c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 4 Jun 2021 19:41:37 +0800 Subject: [PATCH 19/27] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=A4=9A=E5=AE=9E=E4=BE=8B=EF=BC=8C=E5=BC=80=E5=90=AF=E5=92=8C?= =?UTF-8?q?=E5=85=B3=E9=97=ADCLB=E5=AE=89=E5=85=A8=E7=BB=84=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=94=BE=E9=80=9A=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_clb_instance.go | 55 ++++- tencentcloud/resource_tc_clb_instance_test.go | 196 +++++++++++++++--- 2 files changed, 215 insertions(+), 36 deletions(-) diff --git a/tencentcloud/resource_tc_clb_instance.go b/tencentcloud/resource_tc_clb_instance.go index f3319c547b..d378a63184 100644 --- a/tencentcloud/resource_tc_clb_instance.go +++ b/tencentcloud/resource_tc_clb_instance.go @@ -37,17 +37,58 @@ resource "tencentcloud_clb_instance" "open_clb" { } ``` -Create target group +Default enable ```hcl -resource "tencentcloud_clb_target_group" "test"{ - target_group_name = "hello1" - port = 18082 - target_group_instances { - bind_ip = "10.0.0.4" - port = 18080 +resource "tencentcloud_subnet" "subnet" { + availability_zone = "ap-guangzhou-1" + name = "sdk-feature-test" + vpc_id = tencentcloud_vpc.foo.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_security_group" "sglab" { + name = "sg_o0ek7r93" + description = "favourite sg" + project_id = 0 +} + +resource "tencentcloud_vpc" "foo" { + name = "for-my-open-clb" + cidr_block = "10.0.0.0/16" + + tags = { + "test" = "mytest" } } + +resource "tencentcloud_clb_instance" "open_clb" { + network_type = "OPEN" + clb_name = "my-open-clb" + project_id = 0 + vpc_id = tencentcloud_vpc.foo.id + load_balancer_pass_to_target = true + + security_groups = [tencentcloud_security_group.sglab.id] + target_region_info_region = "ap-guangzhou" + target_region_info_vpc_id = tencentcloud_vpc.foo.id + + tags = { + test = "open" + } +} +``` + +CREATE multiple instance + +```hcl +resource "tencentcloud_clb_instance" "open_clb1" { + network_type = "OPEN" + clb_name = "hello" + master_zone_id = "ap-guangzhou-3" +} +~ ``` Import diff --git a/tencentcloud/resource_tc_clb_instance_test.go b/tencentcloud/resource_tc_clb_instance_test.go index ddd8f713fa..eb68d7c861 100644 --- a/tencentcloud/resource_tc_clb_instance_test.go +++ b/tencentcloud/resource_tc_clb_instance_test.go @@ -116,7 +116,7 @@ func TestAccTencentCloudClbInstance_internal(t *testing.T) { }) } -func TestAccTencentCloudClbInstanceTargetGroup(t *testing.T) { +func TestAccTencentCloudClbInstance_default_enable(t *testing.T) { t.Parallel() resource.Test(t, resource.TestCase{ @@ -125,23 +125,67 @@ func TestAccTencentCloudClbInstanceTargetGroup(t *testing.T) { CheckDestroy: testAccCheckClbInstanceDestroy, Steps: []resource.TestStep{ { - Config: testAccClbInstanceTargetGroup, + Config: testAccClbInstance_default_enable, Check: resource.ComposeTestCheckFunc( - testAccCheckClbInstanceExists("tencentcloud_clb_instance.target_group"), - resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_name", "tgt_grp_test"), - resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "port", "33"), - resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.bind_ip", "10.0.0.4"), - resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.port", "33"), + testAccCheckClbInstanceExists("tencentcloud_clb_instance.default_enable"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "network_type", "OPEN"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "clb_name", "my_open_clb"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "project_id", "0"), + resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.default_enable", "vpc_id"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "load_balancer_pass_to_target", "true"), + resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.default_enable", "security_groups.0"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "target_region_info_region", "ap-guangzhou"), + resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.default_enable", "target_region_info_vpc_id"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "tags.test", "open"), ), }, { - Config: testAccClbInstanceTargetGroupUpdate, + Config: testAccClbInstance_default_enable_open, Check: resource.ComposeTestCheckFunc( - testAccCheckClbInstanceExists("tencentcloud_clb_instance.target_group"), - resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_name", "tgt_grp_test"), - resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "port", "33"), - resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.bind_ip", "10.0.0.4"), - resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.port", "44"), + testAccCheckClbInstanceExists("tencentcloud_clb_instance.default_enable"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "network_type", "OPEN"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "clb_name", "my_open_clb"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "project_id", "0"), + resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.default_enable", "vpc_id"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "load_balancer_pass_to_target", "true"), + resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.default_enable", "security_groups.0"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "target_region_info_region", "ap-guangzhou"), + resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.default_enable", "target_region_info_vpc_id"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "tags.test", "hello"), + ), + }, + }, + }) +} + +func TestAccTencentCloudClbInstance_multiple_instance(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckClbInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccClbInstance__multi_instance, + Check: resource.ComposeTestCheckFunc( + testAccCheckClbInstanceExists("tencentcloud_clb_instance.multiple_instance"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "network_type", "OPEN"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "clb_name", "my_open_clb"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "master_zone_id", "10001"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "slave_zone_id", "10002"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "tags.test", "mytest"), + ), + }, + { + Config: testAccClbInstance__multi_instance_update, + Check: resource.ComposeTestCheckFunc( + testAccCheckClbInstanceExists("tencentcloud_clb_instance.multiple_instance"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "network_type", "OPEN"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "clb_name", "my_open_clb"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "master_zone_id", "10001"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "slave_zone_id", "10002"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "tags.test", "open"), ), }, }, @@ -313,24 +357,118 @@ resource "tencentcloud_clb_instance" "clb_open" { } ` -const testAccClbInstanceTargetGroup = ` -resource "tencentcloud_clb_instance" "target_group" { - target_group_name = "tgt_grp_test" - port = 33 - target_group_instances { - bind_ip = "10.0.0.4" - port = 18800 - } +const testAccClbInstance_default_enable = ` +variable "availability_zone" { + default = "ap-guangzhou-1" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "sdk-feature-test" + vpc_id = tencentcloud_vpc.foo.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_security_group" "sglab" { + name = "sg_o0ek7r93" + description = "favourite sg" + project_id = 0 +} + +resource "tencentcloud_vpc" "foo" { + name = "for-my-open-clb" + cidr_block = "10.0.0.0/16" + + tags = { + "test" = "mytest" + } +} + +resource "tencentcloud_clb_instance" "default_enable" { + network_type = "OPEN" + clb_name = "my-open-clb" + project_id = 0 + vpc_id = tencentcloud_vpc.foo.id + load_balancer_pass_to_target = true + + security_groups = [tencentcloud_security_group.sglab.id] + target_region_info_region = "ap-guangzhou" + target_region_info_vpc_id = tencentcloud_vpc.foo.id + + tags = { + test = "open" + } +} +` + +const testAccClbInstance_default_enable_open = ` +variable "availability_zone" { + default = "ap-guangzhou-1" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "sdk-feature-test" + vpc_id = tencentcloud_vpc.foo.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_security_group" "sglab" { + name = "sg_o0ek7r93" + description = "favourite sg" + project_id = 0 +} + +resource "tencentcloud_vpc" "foo" { + name = "for-my-open-clb" + cidr_block = "10.0.0.0/16" + + tags = { + "test" = "mytest" + } +} + +resource "tencentcloud_clb_instance" "default_enable" { + network_type = "OPEN" + clb_name = "my-open-clb" + project_id = 0 + vpc_id = tencentcloud_vpc.foo.id + load_balancer_pass_to_target = true + + security_groups = [tencentcloud_security_group.sglab.id] + target_region_info_region = "ap-guangzhou" + target_region_info_vpc_id = tencentcloud_vpc.foo.id + + tags = { + test = "hello" + } } ` -const testAccClbInstanceTargetGroupUpdate = ` -resource "tencentcloud_clb_instance" "target_group" { - target_group_name = "tgt_grp_test" - port = 44 - target_group_instances { - bind_ip = "10.0.0.4" - port = 18800 - } +const testAccClbInstance__multi_instance = ` +resource "tencentcloud_clb_instance" "multiple_instance" { + network_type = "OPEN" + clb_name = "my-open-clb" + master_zone_id = "10001" + slave_zone_id = "10002" + + tags = { + test = "open" + } +} +` + +const testAccClbInstance__multi_instance_update = ` +resource "tencentcloud_clb_instance" "multiple_instance" { + network_type = "OPEN" + clb_name = "my-open-clb" + master_zone_id = "10001" + slave_zone_id = "10002" + + tags = { + test = "open" + } } ` From 1eedd4ad7289c0643a14d8a7abfcc136793c3ab1 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 4 Jun 2021 20:03:59 +0800 Subject: [PATCH 20/27] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tencentcloud/resource_tc_kubernetes_cluster.go | 1 + tencentcloud/resource_tc_kubernetes_cluster_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/tencentcloud/resource_tc_kubernetes_cluster.go b/tencentcloud/resource_tc_kubernetes_cluster.go index 3c4c998e91..57253a293d 100644 --- a/tencentcloud/resource_tc_kubernetes_cluster.go +++ b/tencentcloud/resource_tc_kubernetes_cluster.go @@ -54,6 +54,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { internet_max_bandwidth_out = 100 public_ip_assigned = true subnet_id = data.tencentcloud_vpc_subnets.vpc_first.instance_list.0.subnet_id + img_id = "img-rkiynh11" data_disk { disk_type = "CLOUD_PREMIUM" diff --git a/tencentcloud/resource_tc_kubernetes_cluster_test.go b/tencentcloud/resource_tc_kubernetes_cluster_test.go index aabb556f46..1e2049da1b 100644 --- a/tencentcloud/resource_tc_kubernetes_cluster_test.go +++ b/tencentcloud/resource_tc_kubernetes_cluster_test.go @@ -173,6 +173,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { internet_max_bandwidth_out = 100 public_ip_assigned = true subnet_id = data.tencentcloud_vpc_subnets.vpc.instance_list.0.subnet_id + img_id = "img-rkiynh11" data_disk { disk_type = "CLOUD_PREMIUM" From bcadc5695e2d682431438569090237c397bc309b Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 7 Jun 2021 17:04:55 +0800 Subject: [PATCH 21/27] =?UTF-8?q?=E6=B7=BB=E5=8A=A0AS=E7=9A=84=E5=8F=82?= =?UTF-8?q?=E6=95=B0=20MultiZoneSubnetPolicy=20=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=A4=9A=E5=8F=AF=E7=94=A8=E5=8C=BA(=E5=AD=90=E7=BD=91)?= =?UTF-8?q?=E6=89=93=E6=95=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data_source_tc_as_scaling_groups.go | 40 +++++++++++-------- tencentcloud/extension_as.go | 5 +++ tencentcloud/resource_tc_as_scaling_group.go | 17 ++++++++ 3 files changed, 45 insertions(+), 17 deletions(-) diff --git a/tencentcloud/data_source_tc_as_scaling_groups.go b/tencentcloud/data_source_tc_as_scaling_groups.go index ca36bf88ea..073450a064 100644 --- a/tencentcloud/data_source_tc_as_scaling_groups.go +++ b/tencentcloud/data_source_tc_as_scaling_groups.go @@ -196,6 +196,11 @@ func dataSourceTencentCloudAsScalingGroups() *schema.Resource { Computed: true, Description: "Tags of the scaling group.", }, + "multi_zone_subnet_policy": { + Type: schema.TypeString, + Computed: true, + Description: "Multi zone or subnet strategy, Valid values: PRIORITY and EQUALITY.", + }, }, }, }, @@ -241,23 +246,24 @@ func dataSourceTencentCloudAsScalingGroupRead(d *schema.ResourceData, meta inter } mapping := map[string]interface{}{ - "scaling_group_id": scalingGroup.AutoScalingGroupId, - "scaling_group_name": scalingGroup.AutoScalingGroupName, - "configuration_id": scalingGroup.LaunchConfigurationId, - "status": scalingGroup.AutoScalingGroupStatus, - "instance_count": scalingGroup.InstanceCount, - "max_size": scalingGroup.MaxSize, - "min_size": scalingGroup.MinSize, - "vpc_id": scalingGroup.VpcId, - "subnet_ids": helper.StringsInterfaces(scalingGroup.SubnetIdSet), - "zones": helper.StringsInterfaces(scalingGroup.ZoneSet), - "default_cooldown": scalingGroup.DefaultCooldown, - "desired_capacity": scalingGroup.DesiredCapacity, - "load_balancer_ids": helper.StringsInterfaces(scalingGroup.LoadBalancerIdSet), - "termination_policies": helper.StringsInterfaces(scalingGroup.TerminationPolicySet), - "retry_policy": scalingGroup.RetryPolicy, - "create_time": scalingGroup.CreatedTime, - "tags": tags, + "scaling_group_id": scalingGroup.AutoScalingGroupId, + "scaling_group_name": scalingGroup.AutoScalingGroupName, + "configuration_id": scalingGroup.LaunchConfigurationId, + "status": scalingGroup.AutoScalingGroupStatus, + "instance_count": scalingGroup.InstanceCount, + "max_size": scalingGroup.MaxSize, + "min_size": scalingGroup.MinSize, + "vpc_id": scalingGroup.VpcId, + "subnet_ids": helper.StringsInterfaces(scalingGroup.SubnetIdSet), + "zones": helper.StringsInterfaces(scalingGroup.ZoneSet), + "default_cooldown": scalingGroup.DefaultCooldown, + "desired_capacity": scalingGroup.DesiredCapacity, + "load_balancer_ids": helper.StringsInterfaces(scalingGroup.LoadBalancerIdSet), + "termination_policies": helper.StringsInterfaces(scalingGroup.TerminationPolicySet), + "retry_policy": scalingGroup.RetryPolicy, + "create_time": scalingGroup.CreatedTime, + "tags": tags, + "multi_zone_subnet_policy": scalingGroup.MultiZoneSubnetPolicy, } if scalingGroup.ForwardLoadBalancerSet != nil && len(scalingGroup.ForwardLoadBalancerSet) > 0 { forwardLoadBalancers := make([]map[string]interface{}, 0, len(scalingGroup.ForwardLoadBalancerSet)) diff --git a/tencentcloud/extension_as.go b/tencentcloud/extension_as.go index fbd7e9202d..befe897056 100644 --- a/tencentcloud/extension_as.go +++ b/tencentcloud/extension_as.go @@ -147,3 +147,8 @@ const ( SCALING_GROUP_IN_ACTIVITY_STATUS = "IN_ACTIVITY" SCALING_GROUP_NOT_IN_ACTIVITY_STATUS = "NOT_IN_ACTIVITY" ) + +const ( + MultiZoneSubnetPolicyPriority = "PRIORITY" + MultiZoneSubnetPolicyEquality = "EQUALITY" +) diff --git a/tencentcloud/resource_tc_as_scaling_group.go b/tencentcloud/resource_tc_as_scaling_group.go index 54fd0616a2..7fe92412db 100644 --- a/tencentcloud/resource_tc_as_scaling_group.go +++ b/tencentcloud/resource_tc_as_scaling_group.go @@ -216,6 +216,13 @@ func resourceTencentCloudAsScalingGroup() *schema.Resource { Computed: true, Description: "The time when the AS group was created.", }, + "multi_zone_subnet_policy": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateAllowedStringValue([]string{MultiZoneSubnetPolicyPriority, + MultiZoneSubnetPolicyEquality}), + Description: "Multi zone or subnet strategy, Valid values: PRIORITY and EQUALITY.", + }, }, } } @@ -303,6 +310,10 @@ func resourceTencentCloudAsScalingGroupCreate(d *schema.ResourceData, meta inter } } + if v, ok := d.GetOk("multi_zone_subnet_policy"); ok { + request.MultiZoneSubnetPolicy = helper.String(v.(string)) + } + var id string if err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { ratelimit.Check(request.GetAction()) @@ -408,6 +419,7 @@ func resourceTencentCloudAsScalingGroupRead(d *schema.ResourceData, meta interfa _ = d.Set("termination_policies", helper.StringsInterfaces(scalingGroup.TerminationPolicySet)) _ = d.Set("retry_policy", scalingGroup.RetryPolicy) _ = d.Set("create_time", scalingGroup.CreatedTime) + _ = d.Set("multi_zone_subnet_policy", scalingGroup.MultiZoneSubnetPolicy) if scalingGroup.ForwardLoadBalancerSet != nil && len(scalingGroup.ForwardLoadBalancerSet) > 0 { forwardLoadBalancers := make([]map[string]interface{}, 0, len(scalingGroup.ForwardLoadBalancerSet)) @@ -521,6 +533,11 @@ func resourceTencentCloudAsScalingGroupUpdate(d *schema.ResourceData, meta inter } } + if d.HasChange("multi_zone_subnet_policy") { + updateAttrs = append(updateAttrs, "multi_zone_subnet_policy") + request.MultiZoneSubnetPolicy = helper.String(d.Get("multi_zone_subnet_policy").(string)) + } + if err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { ratelimit.Check(request.GetAction()) From 405baacc92abd8eb997d45281b8a23f145ba8007 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 9 Jun 2021 10:35:55 +0800 Subject: [PATCH 22/27] gendoc --- tencentcloud/data_source_tc_clb_instances.go | 10 ++-- tencentcloud/resource_tc_clb_instance.go | 2 +- .../docs/d/as_scaling_groups.html.markdown | 1 + website/docs/d/clb_instances.html.markdown | 6 ++ .../docs/d/kubernetes_clusters.html.markdown | 2 +- website/docs/r/as_scaling_group.html.markdown | 1 + website/docs/r/clb_instance.html.markdown | 60 ++++++++++++++++++- website/docs/r/clb_target_group.html.markdown | 22 +++++++ website/docs/r/instance.html.markdown | 2 +- .../docs/r/kubernetes_cluster.html.markdown | 5 +- .../r/kubernetes_scale_worker.html.markdown | 1 + 11 files changed, 102 insertions(+), 10 deletions(-) diff --git a/tencentcloud/data_source_tc_clb_instances.go b/tencentcloud/data_source_tc_clb_instances.go index 435028a34d..207b90f2ff 100644 --- a/tencentcloud/data_source_tc_clb_instances.go +++ b/tencentcloud/data_source_tc_clb_instances.go @@ -162,27 +162,27 @@ func dataSourceTencentCloudClbInstances() *schema.Resource { "zone_id": { Type: schema.TypeInt, Computed: true, - Description: "Available zone unique id(numerical representation), This field maybe null, means cannot get a valid value", + Description: "Available zone unique id(numerical representation), This field maybe null, means cannot get a valid value.", }, "zone": { Type: schema.TypeString, Computed: true, - Description: "Available zone unique id(string representation), This field maybe null, means cannot get a valid value", + Description: "Available zone unique id(string representation), This field maybe null, means cannot get a valid value.", }, "zone_name": { Type: schema.TypeString, Computed: true, - Description: "Available zone name, This field maybe null, means cannot get a valid value", + Description: "Available zone name, This field maybe null, means cannot get a valid value.", }, "zone_region": { Type: schema.TypeString, Computed: true, - Description: "Region that this available zone belong to, This field maybe null, means cannot get a valid value", + Description: "Region that this available zone belong to, This field maybe null, means cannot get a valid value.", }, "local_zone": { Type: schema.TypeBool, Computed: true, - Description: "Whether this available zone is local zone, This field maybe null, means cannot get a valid value", + Description: "Whether this available zone is local zone, This field maybe null, means cannot get a valid value.", }, }, }, diff --git a/tencentcloud/resource_tc_clb_instance.go b/tencentcloud/resource_tc_clb_instance.go index d378a63184..c89b8c511c 100644 --- a/tencentcloud/resource_tc_clb_instance.go +++ b/tencentcloud/resource_tc_clb_instance.go @@ -232,7 +232,7 @@ func resourceTencentCloudClbInstance() *schema.Resource { "slave_zone_id": { Type: schema.TypeString, Optional: true, - Description: "Setting slave zone id of cross available zone disaster recovery, only applicable to open CLB. this zone will undertake traffic when the master is down", + Description: "Setting slave zone id of cross available zone disaster recovery, only applicable to open CLB. this zone will undertake traffic when the master is down.", }, }, } diff --git a/website/docs/d/as_scaling_groups.html.markdown b/website/docs/d/as_scaling_groups.html.markdown index 9cf6713bad..2d90f243e6 100644 --- a/website/docs/d/as_scaling_groups.html.markdown +++ b/website/docs/d/as_scaling_groups.html.markdown @@ -51,6 +51,7 @@ In addition to all arguments above, the following attributes are exported: * `load_balancer_ids` - A list of traditional clb ids which the CVM instances attached to. * `max_size` - The maximum number of CVM instances. * `min_size` - The minimum number of CVM instances. + * `multi_zone_subnet_policy` - Multi zone or subnet strategy, Valid values: PRIORITY and EQUALITY. * `project_id` - ID of the project to which the scaling group belongs. Default value is 0. * `retry_policy` - A retry policy can be used when a creation fails. * `scaling_group_id` - Auto scaling group ID. diff --git a/website/docs/d/clb_instances.html.markdown b/website/docs/d/clb_instances.html.markdown index 20480263b7..9a2123cb37 100644 --- a/website/docs/d/clb_instances.html.markdown +++ b/website/docs/d/clb_instances.html.markdown @@ -29,6 +29,7 @@ The following arguments are supported: * `clb_id` - (Optional) ID of the CLB to be queried. * `clb_name` - (Optional) Name of the CLB to be queried. +* `master_zone` - (Optional) Master available zone id. * `network_type` - (Optional) Type of CLB instance, and available values include `OPEN` and `INTERNAL`. * `project_id` - (Optional) Project ID of the CLB. * `result_output_file` - (Optional) Used to save results. @@ -45,6 +46,7 @@ In addition to all arguments above, the following attributes are exported: * `create_time` - Create time of the CLB. * `internet_bandwidth_max_out` - Max bandwidth out, only applicable to open CLB. Valid value ranges is [1, 2048]. Unit is MB. * `internet_charge_type` - Internet charge type, only applicable to open CLB. Valid values are `TRAFFIC_POSTPAID_BY_HOUR`, `BANDWIDTH_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`. + * `local_zone` - Whether this available zone is local zone, This field maybe null, means cannot get a valid value. * `network_type` - Types of CLB. * `project_id` - ID of the project. * `security_groups` - ID set of the security groups. @@ -56,5 +58,9 @@ In addition to all arguments above, the following attributes are exported: * `target_region_info_vpc_id` - VpcId information of backend service are attached the CLB. * `vip_isp` - Network operator, only applicable to open CLB. Valid values are `CMCC`(China Mobile), `CTCC`(Telecom), `CUCC`(China Unicom) and `BGP`. If this ISP is specified, network billing method can only use the bandwidth package billing (BANDWIDTH_PACKAGE). * `vpc_id` - ID of the VPC. + * `zone_id` - Available zone unique id(numerical representation), This field maybe null, means cannot get a valid value. + * `zone_name` - Available zone name, This field maybe null, means cannot get a valid value. + * `zone_region` - Region that this available zone belong to, This field maybe null, means cannot get a valid value. + * `zone` - Available zone unique id(string representation), This field maybe null, means cannot get a valid value. diff --git a/website/docs/d/kubernetes_clusters.html.markdown b/website/docs/d/kubernetes_clusters.html.markdown index 062d90c6dc..85ff8f6878 100644 --- a/website/docs/d/kubernetes_clusters.html.markdown +++ b/website/docs/d/kubernetes_clusters.html.markdown @@ -60,7 +60,7 @@ In addition to all arguments above, the following attributes are exported: * `domain` - Domain name for access. * `eni_subnet_ids` - Subnet IDs for cluster with VPC-CNI network mode. * `ignore_cluster_cidr_conflict` - Indicates whether to ignore the cluster cidr conflict error. - * `is_non_static_ip_mode` - Indicates whether static ip mode is enabled. + * `is_non_static_ip_mode` - Indicates whether non-static ip mode is enabled. * `kube_config` - kubernetes config. * `kube_proxy_mode` - Cluster kube-proxy mode. * `network_type` - Cluster network type. diff --git a/website/docs/r/as_scaling_group.html.markdown b/website/docs/r/as_scaling_group.html.markdown index 22cbd47ee5..8cccf3da58 100644 --- a/website/docs/r/as_scaling_group.html.markdown +++ b/website/docs/r/as_scaling_group.html.markdown @@ -53,6 +53,7 @@ The following arguments are supported: * `desired_capacity` - (Optional) Desired volume of CVM instances, which is between `max_size` and `min_size`. * `forward_balancer_ids` - (Optional) List of application load balancers, which can't be specified with `load_balancer_ids` together. * `load_balancer_ids` - (Optional) ID list of traditional load balancers. +* `multi_zone_subnet_policy` - (Optional) Multi zone or subnet strategy, Valid values: PRIORITY and EQUALITY. * `project_id` - (Optional) Specifies to which project the scaling group belongs. * `retry_policy` - (Optional) Available values for retry policies. Valid values: IMMEDIATE_RETRY and INCREMENTAL_INTERVALS. * `subnet_ids` - (Optional) ID list of subnet, and for VPC it is required. diff --git a/website/docs/r/clb_instance.html.markdown b/website/docs/r/clb_instance.html.markdown index ab9bc9fbee..81d40c09ee 100644 --- a/website/docs/r/clb_instance.html.markdown +++ b/website/docs/r/clb_instance.html.markdown @@ -47,6 +47,60 @@ resource "tencentcloud_clb_instance" "open_clb" { } ``` +Default enable + +```hcl +resource "tencentcloud_subnet" "subnet" { + availability_zone = "ap-guangzhou-1" + name = "sdk-feature-test" + vpc_id = tencentcloud_vpc.foo.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_security_group" "sglab" { + name = "sg_o0ek7r93" + description = "favourite sg" + project_id = 0 +} + +resource "tencentcloud_vpc" "foo" { + name = "for-my-open-clb" + cidr_block = "10.0.0.0/16" + + tags = { + "test" = "mytest" + } +} + +resource "tencentcloud_clb_instance" "open_clb" { + network_type = "OPEN" + clb_name = "my-open-clb" + project_id = 0 + vpc_id = tencentcloud_vpc.foo.id + load_balancer_pass_to_target = true + + security_groups = [tencentcloud_security_group.sglab.id] + target_region_info_region = "ap-guangzhou" + target_region_info_vpc_id = tencentcloud_vpc.foo.id + + tags = { + test = "open" + } +} +``` + +CREATE multiple instance + +```hcl +resource "tencentcloud_clb_instance" "open_clb1" { + network_type = "OPEN" + clb_name = "hello" + master_zone_id = "ap-guangzhou-3" +} +~ +``` + ## Argument Reference The following arguments are supported: @@ -56,13 +110,17 @@ The following arguments are supported: * `address_ip_version` - (Optional) IP version, only applicable to open CLB. Valid values are `ipv4`, `ipv6` and `IPv6FullChain`. * `internet_bandwidth_max_out` - (Optional) Max bandwidth out, only applicable to open CLB. Valid value ranges is [1, 2048]. Unit is MB. * `internet_charge_type` - (Optional) Internet charge type, only applicable to open CLB. Valid values are `TRAFFIC_POSTPAID_BY_HOUR`, `BANDWIDTH_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`. +* `load_balancer_pass_to_target` - (Optional) Whether the target allow flow come from clb. If value is true, only check security group of clb, or check both clb and backend instance security group. +* `master_zone_id` - (Optional) Setting master zone id of cross available zone disaster recovery, only applicable to open CLB. * `project_id` - (Optional, ForceNew) ID of the project within the CLB instance, `0` - Default Project. -* `security_groups` - (Optional) Security groups of the CLB instance. Only supports `OPEN` CLBs. +* `security_groups` - (Optional) Security groups of the CLB instance. Supports both `OPEN` and `INTERNAL` CLBs. +* `slave_zone_id` - (Optional) Setting slave zone id of cross available zone disaster recovery, only applicable to open CLB. this zone will undertake traffic when the master is down. * `subnet_id` - (Optional, ForceNew) Subnet ID of the CLB. Effective only for CLB within the VPC. Only supports `INTERNAL` CLBs. Default is `ipv4`. * `tags` - (Optional) The available tags within this CLB. * `target_region_info_region` - (Optional) Region information of backend services are attached the CLB instance. Only supports `OPEN` CLBs. * `target_region_info_vpc_id` - (Optional) Vpc information of backend services are attached the CLB instance. Only supports `OPEN` CLBs. * `vpc_id` - (Optional, ForceNew) VPC ID of the CLB. +* `zone_id` - (Optional) Available zone id, only applicable to open CLB. ## Attributes Reference diff --git a/website/docs/r/clb_target_group.html.markdown b/website/docs/r/clb_target_group.html.markdown index 5c9c406024..13c416b1c4 100644 --- a/website/docs/r/clb_target_group.html.markdown +++ b/website/docs/r/clb_target_group.html.markdown @@ -20,13 +20,35 @@ resource "tencentcloud_clb_target_group" "test" { } ``` +Create target group + +```hcl +resource "tencentcloud_clb_target_group" "test" { + target_group_name = "hello1" + port = 18082 + target_group_instances { + bind_ip = "10.0.0.4" + port = 18080 + } +} +``` + ## Argument Reference The following arguments are supported: +* `port` - (Optional) The default port of target group, add server after can use it. +* `target_group_instances` - (Optional) The backend server of target group bind. * `target_group_name` - (Optional) Target group name. * `vpc_id` - (Optional, ForceNew) VPC ID, default is based on the network. +The `target_group_instances` object supports the following: + +* `bind_ip` - (Required) The internal ip of target group instance. +* `port` - (Required) The port of target group instance. +* `new_port` - (Optional) The new port of target group instance. +* `weight` - (Optional) The weight of target group instance. + ## Attributes Reference In addition to all arguments above, the following attributes are exported: diff --git a/website/docs/r/instance.html.markdown b/website/docs/r/instance.html.markdown index 3b5ffb8c7d..0b2d4582ae 100644 --- a/website/docs/r/instance.html.markdown +++ b/website/docs/r/instance.html.markdown @@ -52,7 +52,7 @@ resource "tencentcloud_subnet" "app" { // Create 2 CVM instances to host awesome_app resource "tencentcloud_instance" "my_awesome_app" { instance_name = "awesome_app" - availability_zone = data.tencentcloud_availability_zones.my_favorate_zones.zones.0.name + availability_zone = data.tencentcloud_availability_zones.my_favorite_zones.zones.0.name image_id = data.tencentcloud_images.my_favorite_image.images.0.image_id instance_type = data.tencentcloud_instance_types.my_favorite_instance_types.instance_types.0.instance_type system_disk_type = "CLOUD_PREMIUM" diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index 61810e72a9..c0a19cd1b7 100644 --- a/website/docs/r/kubernetes_cluster.html.markdown +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -64,6 +64,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { internet_max_bandwidth_out = 100 public_ip_assigned = true subnet_id = data.tencentcloud_vpc_subnets.vpc_first.instance_list.0.subnet_id + img_id = "img-rkiynh11" data_disk { disk_type = "CLOUD_PREMIUM" @@ -304,7 +305,7 @@ The following arguments are supported: * `extra_args` - (Optional, ForceNew) Custom parameter information related to the node. * `globe_desired_pod_num` - (Optional, ForceNew) Indicate to set desired pod number in node. valid when enable_customized_pod_cidr=true, and it takes effect for all nodes. * `ignore_cluster_cidr_conflict` - (Optional, ForceNew) Indicates whether to ignore the cluster cidr conflict error. Default is false. -* `is_non_static_ip_mode` - (Optional, ForceNew) Indicates whether static ip mode is enabled. Default is false. +* `is_non_static_ip_mode` - (Optional, ForceNew) Indicates whether non-static ip mode is enabled. Default is false. * `kube_proxy_mode` - (Optional) Cluster kube-proxy mode, the available values include: 'kube-proxy-bpf'. Default is not set.When set to kube-proxy-bpf, cluster version greater than 1.14 and with Tencent Linux 2.4 is required. * `labels` - (Optional, ForceNew) Labels of tke cluster nodes. * `managed_cluster_internet_security_policies` - (Optional) Security policies for managed cluster internet, like:'192.168.1.0/24' or '113.116.51.27', '0.0.0.0/0' means all. This field can only set when field `cluster_deploy_type` is 'MANAGED_CLUSTER' and `cluster_internet` is true. `managed_cluster_internet_security_policies` can not delete or empty once be set. @@ -355,6 +356,7 @@ The `master_config` object supports the following: * `enhanced_monitor_service` - (Optional, ForceNew) To specify whether to enable cloud monitor service. Default is TRUE. * `enhanced_security_service` - (Optional, ForceNew) To specify whether to enable cloud security service. Default is TRUE. * `hostname` - (Optional, ForceNew) The host name of the attached instance. Dot (.) and dash (-) cannot be used as the first and last characters of HostName and cannot be used consecutively. Windows example: The length of the name character is [2, 15], letters (capitalization is not restricted), numbers and dashes (-) are allowed, dots (.) are not supported, and not all numbers are allowed. Examples of other types (Linux, etc.): The character length is [2, 60], and multiple dots are allowed. There is a segment between the dots. Each segment allows letters (with no limitation on capitalization), numbers and dashes (-). +* `img_id` - (Optional) The valid image id, format of img-xxx. * `instance_charge_type_prepaid_period` - (Optional, ForceNew) The tenancy (time unit is month) of the prepaid instance. NOTE: it only works when instance_charge_type is set to `PREPAID`. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `24`, `36`. * `instance_charge_type_prepaid_renew_flag` - (Optional, ForceNew) Auto renewal flag. Valid values: `NOTIFY_AND_AUTO_RENEW`: notify upon expiration and renew automatically, `NOTIFY_AND_MANUAL_RENEW`: notify upon expiration but do not renew automatically, `DISABLE_NOTIFY_AND_MANUAL_RENEW`: neither notify upon expiration nor renew automatically. Default value: `NOTIFY_AND_MANUAL_RENEW`. If this parameter is specified as `NOTIFY_AND_AUTO_RENEW`, the instance will be automatically renewed on a monthly basis if the account balance is sufficient. NOTE: it only works when instance_charge_type is set to `PREPAID`. * `instance_charge_type` - (Optional, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR`, `PREPAID` instance will not terminated after cluster deleted, and may not allow to delete before expired. @@ -394,6 +396,7 @@ The `worker_config` object supports the following: * `enhanced_monitor_service` - (Optional, ForceNew) To specify whether to enable cloud monitor service. Default is TRUE. * `enhanced_security_service` - (Optional, ForceNew) To specify whether to enable cloud security service. Default is TRUE. * `hostname` - (Optional, ForceNew) The host name of the attached instance. Dot (.) and dash (-) cannot be used as the first and last characters of HostName and cannot be used consecutively. Windows example: The length of the name character is [2, 15], letters (capitalization is not restricted), numbers and dashes (-) are allowed, dots (.) are not supported, and not all numbers are allowed. Examples of other types (Linux, etc.): The character length is [2, 60], and multiple dots are allowed. There is a segment between the dots. Each segment allows letters (with no limitation on capitalization), numbers and dashes (-). +* `img_id` - (Optional) The valid image id, format of img-xxx. * `instance_charge_type_prepaid_period` - (Optional, ForceNew) The tenancy (time unit is month) of the prepaid instance. NOTE: it only works when instance_charge_type is set to `PREPAID`. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `24`, `36`. * `instance_charge_type_prepaid_renew_flag` - (Optional, ForceNew) Auto renewal flag. Valid values: `NOTIFY_AND_AUTO_RENEW`: notify upon expiration and renew automatically, `NOTIFY_AND_MANUAL_RENEW`: notify upon expiration but do not renew automatically, `DISABLE_NOTIFY_AND_MANUAL_RENEW`: neither notify upon expiration nor renew automatically. Default value: `NOTIFY_AND_MANUAL_RENEW`. If this parameter is specified as `NOTIFY_AND_AUTO_RENEW`, the instance will be automatically renewed on a monthly basis if the account balance is sufficient. NOTE: it only works when instance_charge_type is set to `PREPAID`. * `instance_charge_type` - (Optional, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR`, `PREPAID` instance will not terminated after cluster deleted, and may not allow to delete before expired. diff --git a/website/docs/r/kubernetes_scale_worker.html.markdown b/website/docs/r/kubernetes_scale_worker.html.markdown index 22d6725dd9..ab4341b199 100644 --- a/website/docs/r/kubernetes_scale_worker.html.markdown +++ b/website/docs/r/kubernetes_scale_worker.html.markdown @@ -151,6 +151,7 @@ The `worker_config` object supports the following: * `enhanced_monitor_service` - (Optional, ForceNew) To specify whether to enable cloud monitor service. Default is TRUE. * `enhanced_security_service` - (Optional, ForceNew) To specify whether to enable cloud security service. Default is TRUE. * `hostname` - (Optional, ForceNew) The host name of the attached instance. Dot (.) and dash (-) cannot be used as the first and last characters of HostName and cannot be used consecutively. Windows example: The length of the name character is [2, 15], letters (capitalization is not restricted), numbers and dashes (-) are allowed, dots (.) are not supported, and not all numbers are allowed. Examples of other types (Linux, etc.): The character length is [2, 60], and multiple dots are allowed. There is a segment between the dots. Each segment allows letters (with no limitation on capitalization), numbers and dashes (-). +* `img_id` - (Optional) The valid image id, format of img-xxx. * `instance_charge_type_prepaid_period` - (Optional, ForceNew) The tenancy (time unit is month) of the prepaid instance. NOTE: it only works when instance_charge_type is set to `PREPAID`. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `24`, `36`. * `instance_charge_type_prepaid_renew_flag` - (Optional, ForceNew) Auto renewal flag. Valid values: `NOTIFY_AND_AUTO_RENEW`: notify upon expiration and renew automatically, `NOTIFY_AND_MANUAL_RENEW`: notify upon expiration but do not renew automatically, `DISABLE_NOTIFY_AND_MANUAL_RENEW`: neither notify upon expiration nor renew automatically. Default value: `NOTIFY_AND_MANUAL_RENEW`. If this parameter is specified as `NOTIFY_AND_AUTO_RENEW`, the instance will be automatically renewed on a monthly basis if the account balance is sufficient. NOTE: it only works when instance_charge_type is set to `PREPAID`. * `instance_charge_type` - (Optional, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR`, `PREPAID` instance will not terminated after cluster deleted, and may not allow to delete before expired. From 4197fbf207cdea347144ba8e1092b18c187225cd Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 9 Jun 2021 11:38:05 +0800 Subject: [PATCH 23/27] change changelog.md --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95ebb9dcb4..1c67c52f13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,20 @@ ## 1.56.9 (Unreleased) +## 1.56.10 (Jun 09, 2021) + +BUG FIXES: + +* Resource `tencentcloud_instance` fix words spell, in tencendcloud/resource_tc_instance.go L45, data.tencentcloud_availability_zones.my_favorate_zones.zones.0.name change to data.tencentcloud_availability_zones.my_favorite_zones.zones.0.name". +* Resource `tencentcloud_kubernetes_clusters` fix the description of is_non_static_ip_mode + +ENHANCEMENTS: + +* Resource `tencentcloud_clb_target_group` add create target group. +* Resource `tencentcloud_clb_instance` add internal CLB supports security group. +* Resource `tencentcloud_clb_instance` add supports open and close CLB security group, default is open. +* Resource `tencentcloud_clb_instance` add external CLB create multi AZ instance. +* Resource `tencentcloud_container_cluster_instance` add supports params of img_id to assign image. +* Resource `tencentcloud_as_scaling_group` add MultiZoneSubnetPolicy. + ## 1.56.8 (May 26, 2021) ENHANCEMENTS: From aacbd133ae238c1707d029c2c4c4090a37f9cd04 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 28 May 2021 19:37:15 +0800 Subject: [PATCH 24/27] # This is a combination of 2 commits. # This is the 1st commit message: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改拼写错误 favorate -> favorite, 解决 https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/resources/instance 中的错误 添加支持 clb 创建目标工作组的逻辑,添加相应函数的参数 修复新添加的命令行参数错误,Elem字段使用 schema.Resource指针 添加安全组对内网clb的支持(注释掉对当前网络是否为内网的判断) 添加支持开启和关闭CLB安全组默认放通的配置 添加terraform支持external CLB创建AZ实例 添加clb创建目标工作组中,调用create后的update操作中的 port 字段 添加create中调用update操作时,设置load_balancer_pass_to_target 修改在 resourceTencentCloudClbInstanceUpdate 中对 LoadBalancerPassToTarget 取值的处理,修复 tf 文件该值有变化时,没有触发更改的问题 修改支持internal CLB的security group 中description注释部分 添加调用 CreateClusterInstances时,传入imageId参数来指定镜像,以及对镜像的验证,满足 img-xxx 的格式 # This is the commit message #2: 回退版本(添加镜像),该文件不再维护 --- tencentcloud/resource_tc_clb_instance.go | 69 ++++++++++++++++--- tencentcloud/resource_tc_clb_target_group.go | 61 +++++++++++++++- tencentcloud/resource_tc_instance.go | 2 +- .../resource_tc_kubernetes_cluster.go | 12 ++++ tencentcloud/service_tencentcloud_clb.go | 3 +- tencentcloud/validators.go | 8 +++ 6 files changed, 142 insertions(+), 13 deletions(-) diff --git a/tencentcloud/resource_tc_clb_instance.go b/tencentcloud/resource_tc_clb_instance.go index 67e3f05882..fda5ebb0ca 100644 --- a/tencentcloud/resource_tc_clb_instance.go +++ b/tencentcloud/resource_tc_clb_instance.go @@ -135,7 +135,7 @@ func resourceTencentCloudClbInstance() *schema.Resource { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, - Description: "Security groups of the CLB instance. Only supports `OPEN` CLBs.", + Description: "Security groups of the CLB instance. Supports both `OPEN` and `INTERNAL` CLBs.", }, "target_region_info_region": { Type: schema.TypeString, @@ -159,6 +159,27 @@ func resourceTencentCloudClbInstance() *schema.Resource { Computed: true, Description: "Network operator, only applicable to open CLB. Valid values are `CMCC`(China Mobile), `CTCC`(Telecom), `CUCC`(China Unicom) and `BGP`. If this ISP is specified, network billing method can only use the bandwidth package billing (BANDWIDTH_PACKAGE).", }, + "load_balancer_pass_to_target": { + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Whether the target allow flow come from clb. If value is true, only check security group of clb, or check both clb and backend instance security group.", + }, + "master_zone_id": { + Type: schema.TypeString, + Optional: true, + Description: "Setting master zone id of cross available zone disaster recovery, only applicable to open CLB.", + }, + "zone_id": { + Type: schema.TypeString, + Optional: true, + Description: "Available zone id, only applicable to open CLB.", + }, + "slave_zone_id": { + Type: schema.TypeString, + Optional: true, + Description: "Setting slave zone id of cross available zone disaster recovery, only applicable to open CLB. this zone will undertake traffic when the master is down", + }, }, } } @@ -197,11 +218,7 @@ func resourceTencentCloudClbInstanceCreate(d *schema.ResourceData, meta interfac if (targetRegionInfoRegion != "" && targetRegionInfoVpcId == "") || (targetRegionInfoRegion == "" && targetRegionInfoVpcId != "") { return fmt.Errorf("[CHECK][CLB instance][Create] check: region and vpc_id must be set at same time") } - if _, ok := d.GetOk("security_groups"); ok { - if networkType == CLB_NETWORK_TYPE_INTERNAL { - return fmt.Errorf("[CHECK][CLB instance][Create] check: INTERNAL network_type do not support this operation with sercurity_groups") - } - } + request := clb.NewCreateLoadBalancerRequest() request.LoadBalancerType = helper.String(networkType) request.LoadBalancerName = helper.String(clbName) @@ -252,6 +269,26 @@ func resourceTencentCloudClbInstanceCreate(d *schema.ResourceData, meta interfac } } + if v, ok := d.GetOk("master_zone_id"); ok { + if networkType == CLB_NETWORK_TYPE_INTERNAL { + return fmt.Errorf("[CHECK][CLB instance][Create] check: INTERNAL network_type do not support master zone id setting") + } + request.MasterZoneId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("zone_id"); ok { + if networkType == CLB_NETWORK_TYPE_INTERNAL { + return fmt.Errorf("[CHECK][CLB instance][Create] check: INTERNAL network_type do not support zone id setting") + } + request.ZoneId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("slave_zone_id"); ok { + if networkType == CLB_NETWORK_TYPE_INTERNAL { + return fmt.Errorf("[CHECK][CLB instance][Create] check: INTERNAL network_type do not support slave zone id setting") + } + request.SlaveZoneId = helper.String(v.(string)) + } clbId := "" var response *clb.CreateLoadBalancerResponse err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { @@ -312,6 +349,7 @@ func resourceTencentCloudClbInstanceCreate(d *schema.ResourceData, meta interfac } if targetRegionInfoRegion != "" { + isLoadBalancePassToTgt := d.Get("load_balancer_pass_to_target").(bool) targetRegionInfo := clb.TargetRegionInfo{ Region: &targetRegionInfoRegion, VpcId: &targetRegionInfoVpcId, @@ -319,6 +357,7 @@ func resourceTencentCloudClbInstanceCreate(d *schema.ResourceData, meta interfac mRequest := clb.NewModifyLoadBalancerAttributesRequest() mRequest.LoadBalancerId = helper.String(clbId) mRequest.TargetRegionInfo = &targetRegionInfo + mRequest.LoadBalancerPassToTarget = &isLoadBalancePassToTgt err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { mResponse, e := meta.(*TencentCloudClient).apiV3Conn.UseClbClient().ModifyLoadBalancerAttributes(mRequest) if e != nil { @@ -402,6 +441,11 @@ func resourceTencentCloudClbInstanceRead(d *schema.ResourceData, meta interface{ _ = d.Set("internet_charge_type", instance.NetworkAttributes.InternetChargeType) } + _ = d.Set("load_balancer_pass_to_target", instance.LoadBalancerPassToTarget) + _ = d.Set("master_zone_id", instance.MasterZone) + _ = d.Set("zone_id", instance.MasterZone) + _ = d.Set("slave_zone_id", instance.MasterZone) + tcClient := meta.(*TencentCloudClient).apiV3Conn tagService := &TagService{client: tcClient} tags, err := tagService.DescribeResourceTags(ctx, "clb", "clb", tcClient.Region, d.Id()) @@ -428,6 +472,7 @@ func resourceTencentCloudClbInstanceUpdate(d *schema.ResourceData, meta interfac targetRegionInfo := clb.TargetRegionInfo{} internet := clb.InternetAccessible{} changed := false + isLoadBalancerPassToTgt := false if d.HasChange("clb_name") { changed = true @@ -469,6 +514,11 @@ func resourceTencentCloudClbInstanceUpdate(d *schema.ResourceData, meta interfac } } + if d.HasChange("load_balancer_pass_to_target") { + changed = true + isLoadBalancerPassToTgt = d.Get("load_balancer_pass_to_target").(bool) + } + if changed { request := clb.NewModifyLoadBalancerAttributesRequest() request.LoadBalancerId = helper.String(clbId) @@ -481,6 +531,9 @@ func resourceTencentCloudClbInstanceUpdate(d *schema.ResourceData, meta interfac if d.HasChange("internet_charge_type") || d.HasChange("internet_bandwidth_max_out") { request.InternetChargeInfo = &internet } + if d.HasChange("load_balancer_pass_to_target") { + request.LoadBalancerPassToTarget = &isLoadBalancerPassToTgt + } err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { response, e := meta.(*TencentCloudClient).apiV3Conn.UseClbClient().ModifyLoadBalancerAttributes(request) if e != nil { @@ -515,9 +568,7 @@ func resourceTencentCloudClbInstanceUpdate(d *schema.ResourceData, meta interfac } if d.HasChange("security_groups") { - if d.Get("network_type") == CLB_NETWORK_TYPE_INTERNAL { - return fmt.Errorf("[CHECK][CLB instance %s][Update] check: INTERNAL network_type do not support this operation with sercurity_groups", clbId) - } + sgRequest := clb.NewSetLoadBalancerSecurityGroupsRequest() sgRequest.LoadBalancerId = helper.String(clbId) securityGroups := d.Get("security_groups").([]interface{}) diff --git a/tencentcloud/resource_tc_clb_target_group.go b/tencentcloud/resource_tc_clb_target_group.go index 510b8f9b6b..c0a222dbb4 100644 --- a/tencentcloud/resource_tc_clb_target_group.go +++ b/tencentcloud/resource_tc_clb_target_group.go @@ -22,7 +22,6 @@ package tencentcloud import ( "context" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" clb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317" ) @@ -50,6 +49,44 @@ func resourceTencentCloudClbTargetGroup() *schema.Resource { ForceNew: true, Description: "VPC ID, default is based on the network.", }, + "port": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validatePort, + Description: "The default port of target group, add server after can use it.", + }, + "target_group_instances": { + Type: schema.TypeList, + Optional: true, + Description: "The backend server of target group bind.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "bind_ip": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validateIp, + Description: "The internal ip of target group instance.", + }, + "port": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validatePort, + Description: "The port of target group instance.", + }, + "weight": { + Type: schema.TypeInt, + Optional: true, + Description: "The weight of target group instance.", + }, + "new_port": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validatePort, + Description: "The new port of target group instance.", + }, + }, + }, + }, }, } } @@ -63,12 +100,31 @@ func resourceTencentCloudClbTargetCreate(d *schema.ResourceData, meta interface{ clbService = ClbService{client: meta.(*TencentCloudClient).apiV3Conn} vpcId = d.Get("vpc_id").(string) targetGroupName = d.Get("target_group_name").(string) + port = uint64(d.Get("port").(int)) insAttachments = make([]*clb.TargetGroupInstance, 0) targetGroupId string err error ) - targetGroupId, err = clbService.CreateTargetGroup(ctx, targetGroupName, vpcId, insAttachments) + if v, ok := d.GetOk("target_group_instance"); ok { + targetGroupInstances := v.([]interface{}) + for _, v1 := range targetGroupInstances { + value := v1.(map[string]interface{}) + bindIP := value["bind_ip"].(string) + port := uint64(value["port"].(int)) + weight := uint64(value["weight"].(int)) + newPort := uint64(value["new_port"].(int)) + tgtGrp := &clb.TargetGroupInstance{ + BindIP: &bindIP, + Port: &port, + Weight: &weight, + NewPort: &newPort, + } + insAttachments = append(insAttachments, tgtGrp) + } + } + + targetGroupId, err = clbService.CreateTargetGroup(ctx, targetGroupName, vpcId, port, insAttachments) if err != nil { return err } @@ -99,6 +155,7 @@ func resourceTencentCloudClbTargetRead(d *schema.ResourceData, meta interface{}) } _ = d.Set("target_group_name", targetGroupInfos[0].TargetGroupName) _ = d.Set("vpc_id", targetGroupInfos[0].VpcId) + _ = d.Set("port", targetGroupInfos[0].Port) return nil } diff --git a/tencentcloud/resource_tc_instance.go b/tencentcloud/resource_tc_instance.go index 859f378fb5..a1afc7acbc 100644 --- a/tencentcloud/resource_tc_instance.go +++ b/tencentcloud/resource_tc_instance.go @@ -42,7 +42,7 @@ resource "tencentcloud_subnet" "app" { // Create 2 CVM instances to host awesome_app resource "tencentcloud_instance" "my_awesome_app" { instance_name = "awesome_app" - availability_zone = data.tencentcloud_availability_zones.my_favorate_zones.zones.0.name + availability_zone = data.tencentcloud_availability_zones.my_favorite_zones.zones.0.name image_id = data.tencentcloud_images.my_favorite_image.images.0.image_id instance_type = data.tencentcloud_instance_types.my_favorite_instance_types.instance_types.0.instance_type system_disk_type = "CLOUD_PREMIUM" diff --git a/tencentcloud/resource_tc_kubernetes_cluster.go b/tencentcloud/resource_tc_kubernetes_cluster.go index 09ea6efb12..d896acac7c 100644 --- a/tencentcloud/resource_tc_kubernetes_cluster.go +++ b/tencentcloud/resource_tc_kubernetes_cluster.go @@ -549,6 +549,7 @@ func TkeCvmCreateInfo() map[string]*schema.Schema { Elem: &schema.Schema{Type: schema.TypeString}, Description: "Disaster recover groups to which a CVM instance belongs. Only support maximum 1.", }, +<<<<<<< HEAD // InstanceAdvancedSettingsOverrides "desired_pod_num": { Type: schema.TypeInt, @@ -594,6 +595,13 @@ func TkeExistCvmCreateInfo() map[string]*schema.Schema { ForceNew: true, Elem: &schema.Schema{Type: schema.TypeInt}, Description: "Custom mode cluster, you can specify the number of pods for each node. corresponding to the existed_instances_para.instance_ids parameter.", +======= + "os": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateImageID, + Description: "The valid image id, format of img-xxx.", +>>>>>>> 37314e6e... 添加调用 CreateClusterInstances时,传入imageId参数来指定镜像,以及对镜像的验证,满足 img-xxx 的格式 }, } } @@ -1337,6 +1345,10 @@ func tkeGetCvmRunInstancesPara(dMap map[string]interface{}, meta interface{}, } } + if v, ok := dMap["os"]; ok { + request.ImageId = helper.String(v.(string)) + } + cvmJson = request.ToJsonString() cvmJson = strings.Replace(cvmJson, `"Password":"",`, "", -1) diff --git a/tencentcloud/service_tencentcloud_clb.go b/tencentcloud/service_tencentcloud_clb.go index cd94744019..53d735c1dc 100644 --- a/tencentcloud/service_tencentcloud_clb.go +++ b/tencentcloud/service_tencentcloud_clb.go @@ -1025,13 +1025,14 @@ func clbNewTarget(instanceId, port, weight interface{}) *clb.Target { return &bk } -func (me *ClbService) CreateTargetGroup(ctx context.Context, targetGroupName string, vpcId string, +func (me *ClbService) CreateTargetGroup(ctx context.Context, targetGroupName string, vpcId string, port uint64, targetGroupInstances []*clb.TargetGroupInstance) (targetGroupId string, err error) { var response *clb.CreateTargetGroupResponse request := clb.NewCreateTargetGroupRequest() request.TargetGroupName = &targetGroupName request.TargetGroupInstances = targetGroupInstances + request.Port = &port if vpcId != "" { request.VpcId = &vpcId } diff --git a/tencentcloud/validators.go b/tencentcloud/validators.go index 71506624e3..85b0baec97 100644 --- a/tencentcloud/validators.go +++ b/tencentcloud/validators.go @@ -65,6 +65,14 @@ func validateIp(v interface{}, k string) (ws []string, errors []error) { return } +func validateImageID(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if !strings.HasPrefix(value, "img-") { + errors = append(errors, fmt.Errorf("the format of %q is invalid: %s, it should begin with `img-`", k, value)) + } + return +} + // NOTE not exactly strict, but ok for now func validateIntegerInRange(min, max int64) schema.SchemaValidateFunc { return func(v interface{}, k string) (ws []string, errors []error) { From c9ae2436205ea7d31e7cda3f15b237fcc35b5c87 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 9 Jun 2021 14:14:48 +0800 Subject: [PATCH 25/27] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8B=BC=E5=86=99?= =?UTF-8?q?=E9=94=99=E8=AF=AF=20favorate=20->=20favorite,=20=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=20https://registry.terraform.io/providers/tencentclou?= =?UTF-8?q?dstack/tencentcloud/latest/docs/resources/instance=20=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加支持 clb 创建目标工作组的逻辑,添加相应函数的参数 修复新添加的命令行参数错误,Elem字段使用 schema.Resource指针 添加安全组对内网clb的支持(注释掉对当前网络是否为内网的判断) 添加支持开启和关闭CLB安全组默认放通的配置 添加terraform支持external CLB创建AZ实例 添加clb创建目标工作组中,调用create后的update操作中的 port 字段 添加create中调用update操作时,设置load_balancer_pass_to_target 修改在 resourceTencentCloudClbInstanceUpdate 中对 LoadBalancerPassToTarget 取值的处理,修复 tf 文件该值有变化时,没有触发更改的问题 修改支持internal CLB的security group 中description注释部分 添加调用 CreateClusterInstances时,传入imageId参数来指定镜像,以及对镜像的验证,满足 img-xxx 的格式 回退版本(添加镜像),该文件不再维护 修改命令行参数的key, os -> img_id 修改tke资源is_non_static_ip_mode描述不当的错误, static -> non-static 添加Update操作对Port的支持 需求 支持external CLB创建多AZ实例 Description添加master_zone及查询结果相应的字段 添加测试用命,及 hcl 测试说明文档注释 添加测试用命,及 hcl 测试说明文档注释 添加创建多实例,开启和关闭CLB安全组默认放通测试用例 完善测试文件 添加AS的参数 MultiZoneSubnetPolicy ,支持多可用区(子网)打散 gendoc change changelog.md --- CHANGELOG.md | 16 ++ .../data_source_tc_as_scaling_groups.go | 40 ++-- tencentcloud/data_source_tc_clb_instances.go | 41 ++++ .../data_source_tc_kubernetes_clusters.go | 2 +- tencentcloud/extension_as.go | 5 + tencentcloud/resource_tc_as_scaling_group.go | 17 ++ tencentcloud/resource_tc_clb_instance.go | 56 ++++- tencentcloud/resource_tc_clb_instance_test.go | 192 ++++++++++++++++++ tencentcloud/resource_tc_clb_target_group.go | 32 ++- .../resource_tc_clb_target_group_test.go | 54 +++++ .../resource_tc_kubernetes_cluster.go | 54 +++-- .../resource_tc_kubernetes_cluster_test.go | 1 + tencentcloud/service_tencentcloud_clb.go | 6 +- .../docs/d/as_scaling_groups.html.markdown | 1 + website/docs/d/clb_instances.html.markdown | 6 + .../docs/d/kubernetes_clusters.html.markdown | 2 +- website/docs/r/as_scaling_group.html.markdown | 1 + website/docs/r/clb_instance.html.markdown | 60 +++++- website/docs/r/clb_target_group.html.markdown | 22 ++ website/docs/r/instance.html.markdown | 2 +- .../docs/r/kubernetes_cluster.html.markdown | 5 +- .../r/kubernetes_scale_worker.html.markdown | 1 + 22 files changed, 561 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95ebb9dcb4..1c67c52f13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,20 @@ ## 1.56.9 (Unreleased) +## 1.56.10 (Jun 09, 2021) + +BUG FIXES: + +* Resource `tencentcloud_instance` fix words spell, in tencendcloud/resource_tc_instance.go L45, data.tencentcloud_availability_zones.my_favorate_zones.zones.0.name change to data.tencentcloud_availability_zones.my_favorite_zones.zones.0.name". +* Resource `tencentcloud_kubernetes_clusters` fix the description of is_non_static_ip_mode + +ENHANCEMENTS: + +* Resource `tencentcloud_clb_target_group` add create target group. +* Resource `tencentcloud_clb_instance` add internal CLB supports security group. +* Resource `tencentcloud_clb_instance` add supports open and close CLB security group, default is open. +* Resource `tencentcloud_clb_instance` add external CLB create multi AZ instance. +* Resource `tencentcloud_container_cluster_instance` add supports params of img_id to assign image. +* Resource `tencentcloud_as_scaling_group` add MultiZoneSubnetPolicy. + ## 1.56.8 (May 26, 2021) ENHANCEMENTS: diff --git a/tencentcloud/data_source_tc_as_scaling_groups.go b/tencentcloud/data_source_tc_as_scaling_groups.go index ca36bf88ea..073450a064 100644 --- a/tencentcloud/data_source_tc_as_scaling_groups.go +++ b/tencentcloud/data_source_tc_as_scaling_groups.go @@ -196,6 +196,11 @@ func dataSourceTencentCloudAsScalingGroups() *schema.Resource { Computed: true, Description: "Tags of the scaling group.", }, + "multi_zone_subnet_policy": { + Type: schema.TypeString, + Computed: true, + Description: "Multi zone or subnet strategy, Valid values: PRIORITY and EQUALITY.", + }, }, }, }, @@ -241,23 +246,24 @@ func dataSourceTencentCloudAsScalingGroupRead(d *schema.ResourceData, meta inter } mapping := map[string]interface{}{ - "scaling_group_id": scalingGroup.AutoScalingGroupId, - "scaling_group_name": scalingGroup.AutoScalingGroupName, - "configuration_id": scalingGroup.LaunchConfigurationId, - "status": scalingGroup.AutoScalingGroupStatus, - "instance_count": scalingGroup.InstanceCount, - "max_size": scalingGroup.MaxSize, - "min_size": scalingGroup.MinSize, - "vpc_id": scalingGroup.VpcId, - "subnet_ids": helper.StringsInterfaces(scalingGroup.SubnetIdSet), - "zones": helper.StringsInterfaces(scalingGroup.ZoneSet), - "default_cooldown": scalingGroup.DefaultCooldown, - "desired_capacity": scalingGroup.DesiredCapacity, - "load_balancer_ids": helper.StringsInterfaces(scalingGroup.LoadBalancerIdSet), - "termination_policies": helper.StringsInterfaces(scalingGroup.TerminationPolicySet), - "retry_policy": scalingGroup.RetryPolicy, - "create_time": scalingGroup.CreatedTime, - "tags": tags, + "scaling_group_id": scalingGroup.AutoScalingGroupId, + "scaling_group_name": scalingGroup.AutoScalingGroupName, + "configuration_id": scalingGroup.LaunchConfigurationId, + "status": scalingGroup.AutoScalingGroupStatus, + "instance_count": scalingGroup.InstanceCount, + "max_size": scalingGroup.MaxSize, + "min_size": scalingGroup.MinSize, + "vpc_id": scalingGroup.VpcId, + "subnet_ids": helper.StringsInterfaces(scalingGroup.SubnetIdSet), + "zones": helper.StringsInterfaces(scalingGroup.ZoneSet), + "default_cooldown": scalingGroup.DefaultCooldown, + "desired_capacity": scalingGroup.DesiredCapacity, + "load_balancer_ids": helper.StringsInterfaces(scalingGroup.LoadBalancerIdSet), + "termination_policies": helper.StringsInterfaces(scalingGroup.TerminationPolicySet), + "retry_policy": scalingGroup.RetryPolicy, + "create_time": scalingGroup.CreatedTime, + "tags": tags, + "multi_zone_subnet_policy": scalingGroup.MultiZoneSubnetPolicy, } if scalingGroup.ForwardLoadBalancerSet != nil && len(scalingGroup.ForwardLoadBalancerSet) > 0 { forwardLoadBalancers := make([]map[string]interface{}, 0, len(scalingGroup.ForwardLoadBalancerSet)) diff --git a/tencentcloud/data_source_tc_clb_instances.go b/tencentcloud/data_source_tc_clb_instances.go index 5b627f0f91..207b90f2ff 100644 --- a/tencentcloud/data_source_tc_clb_instances.go +++ b/tencentcloud/data_source_tc_clb_instances.go @@ -56,6 +56,11 @@ func dataSourceTencentCloudClbInstances() *schema.Resource { Optional: true, Description: "Used to save results.", }, + "master_zone": { + Type: schema.TypeString, + Optional: true, + Description: "Master available zone id.", + }, "clb_list": { Type: schema.TypeList, Computed: true, @@ -154,6 +159,31 @@ func dataSourceTencentCloudClbInstances() *schema.Resource { Computed: true, Description: "Max bandwidth out, only applicable to open CLB. Valid value ranges is [1, 2048]. Unit is MB.", }, + "zone_id": { + Type: schema.TypeInt, + Computed: true, + Description: "Available zone unique id(numerical representation), This field maybe null, means cannot get a valid value.", + }, + "zone": { + Type: schema.TypeString, + Computed: true, + Description: "Available zone unique id(string representation), This field maybe null, means cannot get a valid value.", + }, + "zone_name": { + Type: schema.TypeString, + Computed: true, + Description: "Available zone name, This field maybe null, means cannot get a valid value.", + }, + "zone_region": { + Type: schema.TypeString, + Computed: true, + Description: "Region that this available zone belong to, This field maybe null, means cannot get a valid value.", + }, + "local_zone": { + Type: schema.TypeBool, + Computed: true, + Description: "Whether this available zone is local zone, This field maybe null, means cannot get a valid value.", + }, }, }, }, @@ -180,6 +210,9 @@ func dataSourceTencentCloudClbInstancesRead(d *schema.ResourceData, meta interfa if v, ok := d.GetOk("network_type"); ok { params["network_type"] = v.(string) } + if v, ok := d.GetOk("master_zone"); ok { + params["master_zone"] = v.(string) + } clbService := ClbService{ client: meta.(*TencentCloudClient).apiV3Conn, @@ -221,6 +254,14 @@ func dataSourceTencentCloudClbInstancesRead(d *schema.ResourceData, meta interfa mapping["internet_charge_type"] = *clbInstance.NetworkAttributes.InternetChargeType mapping["internet_bandwidth_max_out"] = *clbInstance.NetworkAttributes.InternetMaxBandwidthOut } + if clbInstance.MasterZone != nil { + mapping["zone_id"] = *clbInstance.MasterZone.ZoneId + mapping["zone"] = *clbInstance.MasterZone.Zone + mapping["zone_name"] = *clbInstance.MasterZone.ZoneName + mapping["zone_region"] = *clbInstance.MasterZone.ZoneRegion + mapping["local_zone"] = *clbInstance.MasterZone.LocalZone + } + if clbInstance.Tags != nil { tags := make(map[string]interface{}, len(clbInstance.Tags)) for _, t := range clbInstance.Tags { diff --git a/tencentcloud/data_source_tc_kubernetes_clusters.go b/tencentcloud/data_source_tc_kubernetes_clusters.go index 84f5f65410..e224f34fab 100644 --- a/tencentcloud/data_source_tc_kubernetes_clusters.go +++ b/tencentcloud/data_source_tc_kubernetes_clusters.go @@ -137,7 +137,7 @@ func tkeClusterInfo() map[string]*schema.Schema { "is_non_static_ip_mode": { Type: schema.TypeBool, Computed: true, - Description: "Indicates whether static ip mode is enabled.", + Description: "Indicates whether non-static ip mode is enabled.", }, "kube_proxy_mode": { Type: schema.TypeString, diff --git a/tencentcloud/extension_as.go b/tencentcloud/extension_as.go index fbd7e9202d..befe897056 100644 --- a/tencentcloud/extension_as.go +++ b/tencentcloud/extension_as.go @@ -147,3 +147,8 @@ const ( SCALING_GROUP_IN_ACTIVITY_STATUS = "IN_ACTIVITY" SCALING_GROUP_NOT_IN_ACTIVITY_STATUS = "NOT_IN_ACTIVITY" ) + +const ( + MultiZoneSubnetPolicyPriority = "PRIORITY" + MultiZoneSubnetPolicyEquality = "EQUALITY" +) diff --git a/tencentcloud/resource_tc_as_scaling_group.go b/tencentcloud/resource_tc_as_scaling_group.go index 54fd0616a2..7fe92412db 100644 --- a/tencentcloud/resource_tc_as_scaling_group.go +++ b/tencentcloud/resource_tc_as_scaling_group.go @@ -216,6 +216,13 @@ func resourceTencentCloudAsScalingGroup() *schema.Resource { Computed: true, Description: "The time when the AS group was created.", }, + "multi_zone_subnet_policy": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateAllowedStringValue([]string{MultiZoneSubnetPolicyPriority, + MultiZoneSubnetPolicyEquality}), + Description: "Multi zone or subnet strategy, Valid values: PRIORITY and EQUALITY.", + }, }, } } @@ -303,6 +310,10 @@ func resourceTencentCloudAsScalingGroupCreate(d *schema.ResourceData, meta inter } } + if v, ok := d.GetOk("multi_zone_subnet_policy"); ok { + request.MultiZoneSubnetPolicy = helper.String(v.(string)) + } + var id string if err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { ratelimit.Check(request.GetAction()) @@ -408,6 +419,7 @@ func resourceTencentCloudAsScalingGroupRead(d *schema.ResourceData, meta interfa _ = d.Set("termination_policies", helper.StringsInterfaces(scalingGroup.TerminationPolicySet)) _ = d.Set("retry_policy", scalingGroup.RetryPolicy) _ = d.Set("create_time", scalingGroup.CreatedTime) + _ = d.Set("multi_zone_subnet_policy", scalingGroup.MultiZoneSubnetPolicy) if scalingGroup.ForwardLoadBalancerSet != nil && len(scalingGroup.ForwardLoadBalancerSet) > 0 { forwardLoadBalancers := make([]map[string]interface{}, 0, len(scalingGroup.ForwardLoadBalancerSet)) @@ -521,6 +533,11 @@ func resourceTencentCloudAsScalingGroupUpdate(d *schema.ResourceData, meta inter } } + if d.HasChange("multi_zone_subnet_policy") { + updateAttrs = append(updateAttrs, "multi_zone_subnet_policy") + request.MultiZoneSubnetPolicy = helper.String(d.Get("multi_zone_subnet_policy").(string)) + } + if err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { ratelimit.Check(request.GetAction()) diff --git a/tencentcloud/resource_tc_clb_instance.go b/tencentcloud/resource_tc_clb_instance.go index fda5ebb0ca..c89b8c511c 100644 --- a/tencentcloud/resource_tc_clb_instance.go +++ b/tencentcloud/resource_tc_clb_instance.go @@ -37,6 +37,60 @@ resource "tencentcloud_clb_instance" "open_clb" { } ``` +Default enable + +```hcl +resource "tencentcloud_subnet" "subnet" { + availability_zone = "ap-guangzhou-1" + name = "sdk-feature-test" + vpc_id = tencentcloud_vpc.foo.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_security_group" "sglab" { + name = "sg_o0ek7r93" + description = "favourite sg" + project_id = 0 +} + +resource "tencentcloud_vpc" "foo" { + name = "for-my-open-clb" + cidr_block = "10.0.0.0/16" + + tags = { + "test" = "mytest" + } +} + +resource "tencentcloud_clb_instance" "open_clb" { + network_type = "OPEN" + clb_name = "my-open-clb" + project_id = 0 + vpc_id = tencentcloud_vpc.foo.id + load_balancer_pass_to_target = true + + security_groups = [tencentcloud_security_group.sglab.id] + target_region_info_region = "ap-guangzhou" + target_region_info_vpc_id = tencentcloud_vpc.foo.id + + tags = { + test = "open" + } +} +``` + +CREATE multiple instance + +```hcl +resource "tencentcloud_clb_instance" "open_clb1" { + network_type = "OPEN" + clb_name = "hello" + master_zone_id = "ap-guangzhou-3" +} +~ +``` + Import CLB instance can be imported using the id, e.g. @@ -178,7 +232,7 @@ func resourceTencentCloudClbInstance() *schema.Resource { "slave_zone_id": { Type: schema.TypeString, Optional: true, - Description: "Setting slave zone id of cross available zone disaster recovery, only applicable to open CLB. this zone will undertake traffic when the master is down", + Description: "Setting slave zone id of cross available zone disaster recovery, only applicable to open CLB. this zone will undertake traffic when the master is down.", }, }, } diff --git a/tencentcloud/resource_tc_clb_instance_test.go b/tencentcloud/resource_tc_clb_instance_test.go index 30df298088..eb68d7c861 100644 --- a/tencentcloud/resource_tc_clb_instance_test.go +++ b/tencentcloud/resource_tc_clb_instance_test.go @@ -116,6 +116,82 @@ func TestAccTencentCloudClbInstance_internal(t *testing.T) { }) } +func TestAccTencentCloudClbInstance_default_enable(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckClbInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccClbInstance_default_enable, + Check: resource.ComposeTestCheckFunc( + testAccCheckClbInstanceExists("tencentcloud_clb_instance.default_enable"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "network_type", "OPEN"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "clb_name", "my_open_clb"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "project_id", "0"), + resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.default_enable", "vpc_id"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "load_balancer_pass_to_target", "true"), + resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.default_enable", "security_groups.0"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "target_region_info_region", "ap-guangzhou"), + resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.default_enable", "target_region_info_vpc_id"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "tags.test", "open"), + ), + }, + { + Config: testAccClbInstance_default_enable_open, + Check: resource.ComposeTestCheckFunc( + testAccCheckClbInstanceExists("tencentcloud_clb_instance.default_enable"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "network_type", "OPEN"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "clb_name", "my_open_clb"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "project_id", "0"), + resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.default_enable", "vpc_id"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "load_balancer_pass_to_target", "true"), + resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.default_enable", "security_groups.0"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "target_region_info_region", "ap-guangzhou"), + resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.default_enable", "target_region_info_vpc_id"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.default_enable", "tags.test", "hello"), + ), + }, + }, + }) +} + +func TestAccTencentCloudClbInstance_multiple_instance(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckClbInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccClbInstance__multi_instance, + Check: resource.ComposeTestCheckFunc( + testAccCheckClbInstanceExists("tencentcloud_clb_instance.multiple_instance"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "network_type", "OPEN"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "clb_name", "my_open_clb"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "master_zone_id", "10001"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "slave_zone_id", "10002"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "tags.test", "mytest"), + ), + }, + { + Config: testAccClbInstance__multi_instance_update, + Check: resource.ComposeTestCheckFunc( + testAccCheckClbInstanceExists("tencentcloud_clb_instance.multiple_instance"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "network_type", "OPEN"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "clb_name", "my_open_clb"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "master_zone_id", "10001"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "slave_zone_id", "10002"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.multiple_instance", "tags.test", "open"), + ), + }, + }, + }) +} + func testAccCheckClbInstanceDestroy(s *terraform.State) error { logId := getLogId(contextNil) ctx := context.WithValue(context.TODO(), logIdKey, logId) @@ -280,3 +356,119 @@ resource "tencentcloud_clb_instance" "clb_open" { } } ` + +const testAccClbInstance_default_enable = ` +variable "availability_zone" { + default = "ap-guangzhou-1" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "sdk-feature-test" + vpc_id = tencentcloud_vpc.foo.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_security_group" "sglab" { + name = "sg_o0ek7r93" + description = "favourite sg" + project_id = 0 +} + +resource "tencentcloud_vpc" "foo" { + name = "for-my-open-clb" + cidr_block = "10.0.0.0/16" + + tags = { + "test" = "mytest" + } +} + +resource "tencentcloud_clb_instance" "default_enable" { + network_type = "OPEN" + clb_name = "my-open-clb" + project_id = 0 + vpc_id = tencentcloud_vpc.foo.id + load_balancer_pass_to_target = true + + security_groups = [tencentcloud_security_group.sglab.id] + target_region_info_region = "ap-guangzhou" + target_region_info_vpc_id = tencentcloud_vpc.foo.id + + tags = { + test = "open" + } +} +` + +const testAccClbInstance_default_enable_open = ` +variable "availability_zone" { + default = "ap-guangzhou-1" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "sdk-feature-test" + vpc_id = tencentcloud_vpc.foo.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_security_group" "sglab" { + name = "sg_o0ek7r93" + description = "favourite sg" + project_id = 0 +} + +resource "tencentcloud_vpc" "foo" { + name = "for-my-open-clb" + cidr_block = "10.0.0.0/16" + + tags = { + "test" = "mytest" + } +} + +resource "tencentcloud_clb_instance" "default_enable" { + network_type = "OPEN" + clb_name = "my-open-clb" + project_id = 0 + vpc_id = tencentcloud_vpc.foo.id + load_balancer_pass_to_target = true + + security_groups = [tencentcloud_security_group.sglab.id] + target_region_info_region = "ap-guangzhou" + target_region_info_vpc_id = tencentcloud_vpc.foo.id + + tags = { + test = "hello" + } +} +` + +const testAccClbInstance__multi_instance = ` +resource "tencentcloud_clb_instance" "multiple_instance" { + network_type = "OPEN" + clb_name = "my-open-clb" + master_zone_id = "10001" + slave_zone_id = "10002" + + tags = { + test = "open" + } +} +` + +const testAccClbInstance__multi_instance_update = ` +resource "tencentcloud_clb_instance" "multiple_instance" { + network_type = "OPEN" + clb_name = "my-open-clb" + master_zone_id = "10001" + slave_zone_id = "10002" + + tags = { + test = "open" + } +} +` diff --git a/tencentcloud/resource_tc_clb_target_group.go b/tencentcloud/resource_tc_clb_target_group.go index c0a222dbb4..9f46a3ef40 100644 --- a/tencentcloud/resource_tc_clb_target_group.go +++ b/tencentcloud/resource_tc_clb_target_group.go @@ -10,6 +10,19 @@ resource "tencentcloud_clb_target_group" "test"{ } ``` +Create target group + +```hcl +resource "tencentcloud_clb_target_group" "test"{ + target_group_name = "hello1" + port = 18082 + target_group_instances { + bind_ip = "10.0.0.4" + port = 18080 + } +} +``` + Import CLB target group can be imported using the id, e.g. @@ -106,7 +119,7 @@ func resourceTencentCloudClbTargetCreate(d *schema.ResourceData, meta interface{ err error ) - if v, ok := d.GetOk("target_group_instance"); ok { + if v, ok := d.GetOk("target_group_instances"); ok { targetGroupInstances := v.([]interface{}) for _, v1 := range targetGroupInstances { value := v1.(map[string]interface{}) @@ -168,15 +181,28 @@ func resourceTencentCloudClbTargetUpdate(d *schema.ResourceData, meta interface{ ctx = context.WithValue(context.TODO(), logIdKey, logId) clbService = ClbService{client: meta.(*TencentCloudClient).apiV3Conn} targetGroupId = d.Id() + port uint64 + tgtGroupName string ) + isChanged := false + if d.HasChange("port") { + isChanged = true + port = uint64(d.Get("port").(int)) + } + if d.HasChange("target_group_name") { - targetGroupName := d.Get("target_group_name").(string) - err := clbService.ModifyTargetGroup(ctx, targetGroupId, targetGroupName) + isChanged = true + tgtGroupName = d.Get("target_group_name").(string) + } + + if isChanged { + err := clbService.ModifyTargetGroup(ctx, targetGroupId, tgtGroupName, port) if err != nil { return err } } + return resourceTencentCloudClbTargetRead(d, meta) } diff --git a/tencentcloud/resource_tc_clb_target_group_test.go b/tencentcloud/resource_tc_clb_target_group_test.go index a30d3b0d6d..d9a0ac5639 100644 --- a/tencentcloud/resource_tc_clb_target_group_test.go +++ b/tencentcloud/resource_tc_clb_target_group_test.go @@ -28,6 +28,38 @@ func TestAccTencentCloudClbTargetGroup_basic(t *testing.T) { }) } +func TestAccTencentCloudClbInstanceTargetGroup(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckClbInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccClbInstanceTargetGroup, + Check: resource.ComposeTestCheckFunc( + testAccCheckClbInstanceExists("tencentcloud_clb_instance.target_group"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_name", "tgt_grp_test"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "port", "33"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.bind_ip", "10.0.0.4"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.port", "33"), + ), + }, + { + Config: testAccClbInstanceTargetGroupUpdate, + Check: resource.ComposeTestCheckFunc( + testAccCheckClbInstanceExists("tencentcloud_clb_instance.target_group"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_name", "tgt_grp_test"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "port", "33"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.bind_ip", "10.0.0.4"), + resource.TestCheckResourceAttr("tencentcloud_clb_instance.target_group", "target_group_instances.port", "44"), + ), + }, + }, + }) +} + func testAccCheckClbTargetGroupDestroy(s *terraform.State) error { logId := getLogId(contextNil) ctx := context.WithValue(context.TODO(), logIdKey, logId) @@ -81,3 +113,25 @@ resource "tencentcloud_clb_target_group" "test"{ target_group_name = "qwe" } ` + +const testAccClbInstanceTargetGroup = ` +resource "tencentcloud_clb_instance" "target_group" { + target_group_name = "tgt_grp_test" + port = 33 + target_group_instances { + bind_ip = "10.0.0.4" + port = 18800 + } +} +` + +const testAccClbInstanceTargetGroupUpdate = ` +resource "tencentcloud_clb_instance" "target_group" { + target_group_name = "tgt_grp_test" + port = 44 + target_group_instances { + bind_ip = "10.0.0.4" + port = 18800 + } +} +` diff --git a/tencentcloud/resource_tc_kubernetes_cluster.go b/tencentcloud/resource_tc_kubernetes_cluster.go index d896acac7c..e5a80aae90 100644 --- a/tencentcloud/resource_tc_kubernetes_cluster.go +++ b/tencentcloud/resource_tc_kubernetes_cluster.go @@ -54,6 +54,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { internet_max_bandwidth_out = 100 public_ip_assigned = true subnet_id = data.tencentcloud_vpc_subnets.vpc_first.instance_list.0.subnet_id + img_id = "img-rkiynh11" data_disk { disk_type = "CLOUD_PREMIUM" @@ -549,13 +550,18 @@ func TkeCvmCreateInfo() map[string]*schema.Schema { Elem: &schema.Schema{Type: schema.TypeString}, Description: "Disaster recover groups to which a CVM instance belongs. Only support maximum 1.", }, -<<<<<<< HEAD + "img_id": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateImageID, + Description: "The valid image id, format of img-xxx.", + }, // InstanceAdvancedSettingsOverrides "desired_pod_num": { - Type: schema.TypeInt, - ForceNew: true, - Optional: true, - Default: -1, + Type: schema.TypeInt, + ForceNew: true, + Optional: true, + Default: -1, Description: "Indicate to set desired pod number in node. valid when enable_customized_pod_cidr=true, " + "and it override `[globe_]desired_pod_num` for current node. Either all the fields `desired_pod_num` or none.", }, @@ -565,11 +571,11 @@ func TkeCvmCreateInfo() map[string]*schema.Schema { func TkeExistCvmCreateInfo() map[string]*schema.Schema { return map[string]*schema.Schema{ "node_role": { - Type: schema.TypeString, - ForceNew: true, - Optional: true, + Type: schema.TypeString, + ForceNew: true, + Optional: true, ValidateFunc: validateAllowedStringValue([]string{TKE_ROLE_WORKER, TKE_ROLE_MASTER_ETCD}), - Description: "Role of existed node. value:MASTER_ETCD or WORKER.", + Description: "Role of existed node. value:MASTER_ETCD or WORKER.", }, "instances_para": { Type: schema.TypeList, @@ -595,18 +601,10 @@ func TkeExistCvmCreateInfo() map[string]*schema.Schema { ForceNew: true, Elem: &schema.Schema{Type: schema.TypeInt}, Description: "Custom mode cluster, you can specify the number of pods for each node. corresponding to the existed_instances_para.instance_ids parameter.", -======= - "os": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validateImageID, - Description: "The valid image id, format of img-xxx.", ->>>>>>> 37314e6e... 添加调用 CreateClusterInstances时,传入imageId参数来指定镜像,以及对镜像的验证,满足 img-xxx 的格式 }, } } - func TkeNodePoolGlobalConfig() map[string]*schema.Schema { return map[string]*schema.Schema{ "is_scale_in_enabled": { @@ -795,24 +793,24 @@ func resourceTencentCloudTkeCluster() *schema.Resource { Description: "Cluster network type, GR or VPC-CNI. Default is GR.", }, "enable_customized_pod_cidr": { - Type: schema.TypeBool, - ForceNew: true, - Optional: true, - Default: false, - Description: "Whether to enable the custom mode of node podCIDR size. Default is false.", + Type: schema.TypeBool, + ForceNew: true, + Optional: true, + Default: false, + Description: "Whether to enable the custom mode of node podCIDR size. Default is false.", }, "base_pod_num": { - Type: schema.TypeInt, - ForceNew: true, - Optional: true, - Description: "The number of basic pods. valid when enable_customized_pod_cidr=true.", + Type: schema.TypeInt, + ForceNew: true, + Optional: true, + Description: "The number of basic pods. valid when enable_customized_pod_cidr=true.", }, "is_non_static_ip_mode": { Type: schema.TypeBool, ForceNew: true, Optional: true, Default: false, - Description: "Indicates whether static ip mode is enabled. Default is false.", + Description: "Indicates whether non-static ip mode is enabled. Default is false.", }, "deletion_protection": { Type: schema.TypeBool, @@ -1345,7 +1343,7 @@ func tkeGetCvmRunInstancesPara(dMap map[string]interface{}, meta interface{}, } } - if v, ok := dMap["os"]; ok { + if v, ok := dMap["img_id"]; ok { request.ImageId = helper.String(v.(string)) } diff --git a/tencentcloud/resource_tc_kubernetes_cluster_test.go b/tencentcloud/resource_tc_kubernetes_cluster_test.go index aabb556f46..1e2049da1b 100644 --- a/tencentcloud/resource_tc_kubernetes_cluster_test.go +++ b/tencentcloud/resource_tc_kubernetes_cluster_test.go @@ -173,6 +173,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { internet_max_bandwidth_out = 100 public_ip_assigned = true subnet_id = data.tencentcloud_vpc_subnets.vpc.instance_list.0.subnet_id + img_id = "img-rkiynh11" data_disk { disk_type = "CLOUD_PREMIUM" diff --git a/tencentcloud/service_tencentcloud_clb.go b/tencentcloud/service_tencentcloud_clb.go index 53d735c1dc..90f661f2dc 100644 --- a/tencentcloud/service_tencentcloud_clb.go +++ b/tencentcloud/service_tencentcloud_clb.go @@ -78,6 +78,9 @@ func (me *ClbService) DescribeLoadBalancerByFilter(ctx context.Context, params m projectId := int64(v.(int)) request.ProjectId = &projectId } + if k == "master_zone" { + request.MasterZone = helper.String(v.(string)) + } } offset := int64(0) @@ -1055,10 +1058,11 @@ func (me *ClbService) CreateTargetGroup(ctx context.Context, targetGroupName str return } -func (me *ClbService) ModifyTargetGroup(ctx context.Context, targetGroupId string, targetGroupName string) (err error) { +func (me *ClbService) ModifyTargetGroup(ctx context.Context, targetGroupId, targetGroupName string, port uint64) (err error) { request := clb.NewModifyTargetGroupAttributeRequest() request.TargetGroupId = &targetGroupId request.TargetGroupName = &targetGroupName + request.Port = &port err = resource.Retry(writeRetryTimeout, func() *resource.RetryError { _, err := me.client.UseClbClient().ModifyTargetGroupAttribute(request) diff --git a/website/docs/d/as_scaling_groups.html.markdown b/website/docs/d/as_scaling_groups.html.markdown index 9cf6713bad..2d90f243e6 100644 --- a/website/docs/d/as_scaling_groups.html.markdown +++ b/website/docs/d/as_scaling_groups.html.markdown @@ -51,6 +51,7 @@ In addition to all arguments above, the following attributes are exported: * `load_balancer_ids` - A list of traditional clb ids which the CVM instances attached to. * `max_size` - The maximum number of CVM instances. * `min_size` - The minimum number of CVM instances. + * `multi_zone_subnet_policy` - Multi zone or subnet strategy, Valid values: PRIORITY and EQUALITY. * `project_id` - ID of the project to which the scaling group belongs. Default value is 0. * `retry_policy` - A retry policy can be used when a creation fails. * `scaling_group_id` - Auto scaling group ID. diff --git a/website/docs/d/clb_instances.html.markdown b/website/docs/d/clb_instances.html.markdown index 20480263b7..9a2123cb37 100644 --- a/website/docs/d/clb_instances.html.markdown +++ b/website/docs/d/clb_instances.html.markdown @@ -29,6 +29,7 @@ The following arguments are supported: * `clb_id` - (Optional) ID of the CLB to be queried. * `clb_name` - (Optional) Name of the CLB to be queried. +* `master_zone` - (Optional) Master available zone id. * `network_type` - (Optional) Type of CLB instance, and available values include `OPEN` and `INTERNAL`. * `project_id` - (Optional) Project ID of the CLB. * `result_output_file` - (Optional) Used to save results. @@ -45,6 +46,7 @@ In addition to all arguments above, the following attributes are exported: * `create_time` - Create time of the CLB. * `internet_bandwidth_max_out` - Max bandwidth out, only applicable to open CLB. Valid value ranges is [1, 2048]. Unit is MB. * `internet_charge_type` - Internet charge type, only applicable to open CLB. Valid values are `TRAFFIC_POSTPAID_BY_HOUR`, `BANDWIDTH_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`. + * `local_zone` - Whether this available zone is local zone, This field maybe null, means cannot get a valid value. * `network_type` - Types of CLB. * `project_id` - ID of the project. * `security_groups` - ID set of the security groups. @@ -56,5 +58,9 @@ In addition to all arguments above, the following attributes are exported: * `target_region_info_vpc_id` - VpcId information of backend service are attached the CLB. * `vip_isp` - Network operator, only applicable to open CLB. Valid values are `CMCC`(China Mobile), `CTCC`(Telecom), `CUCC`(China Unicom) and `BGP`. If this ISP is specified, network billing method can only use the bandwidth package billing (BANDWIDTH_PACKAGE). * `vpc_id` - ID of the VPC. + * `zone_id` - Available zone unique id(numerical representation), This field maybe null, means cannot get a valid value. + * `zone_name` - Available zone name, This field maybe null, means cannot get a valid value. + * `zone_region` - Region that this available zone belong to, This field maybe null, means cannot get a valid value. + * `zone` - Available zone unique id(string representation), This field maybe null, means cannot get a valid value. diff --git a/website/docs/d/kubernetes_clusters.html.markdown b/website/docs/d/kubernetes_clusters.html.markdown index 062d90c6dc..85ff8f6878 100644 --- a/website/docs/d/kubernetes_clusters.html.markdown +++ b/website/docs/d/kubernetes_clusters.html.markdown @@ -60,7 +60,7 @@ In addition to all arguments above, the following attributes are exported: * `domain` - Domain name for access. * `eni_subnet_ids` - Subnet IDs for cluster with VPC-CNI network mode. * `ignore_cluster_cidr_conflict` - Indicates whether to ignore the cluster cidr conflict error. - * `is_non_static_ip_mode` - Indicates whether static ip mode is enabled. + * `is_non_static_ip_mode` - Indicates whether non-static ip mode is enabled. * `kube_config` - kubernetes config. * `kube_proxy_mode` - Cluster kube-proxy mode. * `network_type` - Cluster network type. diff --git a/website/docs/r/as_scaling_group.html.markdown b/website/docs/r/as_scaling_group.html.markdown index 22cbd47ee5..8cccf3da58 100644 --- a/website/docs/r/as_scaling_group.html.markdown +++ b/website/docs/r/as_scaling_group.html.markdown @@ -53,6 +53,7 @@ The following arguments are supported: * `desired_capacity` - (Optional) Desired volume of CVM instances, which is between `max_size` and `min_size`. * `forward_balancer_ids` - (Optional) List of application load balancers, which can't be specified with `load_balancer_ids` together. * `load_balancer_ids` - (Optional) ID list of traditional load balancers. +* `multi_zone_subnet_policy` - (Optional) Multi zone or subnet strategy, Valid values: PRIORITY and EQUALITY. * `project_id` - (Optional) Specifies to which project the scaling group belongs. * `retry_policy` - (Optional) Available values for retry policies. Valid values: IMMEDIATE_RETRY and INCREMENTAL_INTERVALS. * `subnet_ids` - (Optional) ID list of subnet, and for VPC it is required. diff --git a/website/docs/r/clb_instance.html.markdown b/website/docs/r/clb_instance.html.markdown index ab9bc9fbee..81d40c09ee 100644 --- a/website/docs/r/clb_instance.html.markdown +++ b/website/docs/r/clb_instance.html.markdown @@ -47,6 +47,60 @@ resource "tencentcloud_clb_instance" "open_clb" { } ``` +Default enable + +```hcl +resource "tencentcloud_subnet" "subnet" { + availability_zone = "ap-guangzhou-1" + name = "sdk-feature-test" + vpc_id = tencentcloud_vpc.foo.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_security_group" "sglab" { + name = "sg_o0ek7r93" + description = "favourite sg" + project_id = 0 +} + +resource "tencentcloud_vpc" "foo" { + name = "for-my-open-clb" + cidr_block = "10.0.0.0/16" + + tags = { + "test" = "mytest" + } +} + +resource "tencentcloud_clb_instance" "open_clb" { + network_type = "OPEN" + clb_name = "my-open-clb" + project_id = 0 + vpc_id = tencentcloud_vpc.foo.id + load_balancer_pass_to_target = true + + security_groups = [tencentcloud_security_group.sglab.id] + target_region_info_region = "ap-guangzhou" + target_region_info_vpc_id = tencentcloud_vpc.foo.id + + tags = { + test = "open" + } +} +``` + +CREATE multiple instance + +```hcl +resource "tencentcloud_clb_instance" "open_clb1" { + network_type = "OPEN" + clb_name = "hello" + master_zone_id = "ap-guangzhou-3" +} +~ +``` + ## Argument Reference The following arguments are supported: @@ -56,13 +110,17 @@ The following arguments are supported: * `address_ip_version` - (Optional) IP version, only applicable to open CLB. Valid values are `ipv4`, `ipv6` and `IPv6FullChain`. * `internet_bandwidth_max_out` - (Optional) Max bandwidth out, only applicable to open CLB. Valid value ranges is [1, 2048]. Unit is MB. * `internet_charge_type` - (Optional) Internet charge type, only applicable to open CLB. Valid values are `TRAFFIC_POSTPAID_BY_HOUR`, `BANDWIDTH_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`. +* `load_balancer_pass_to_target` - (Optional) Whether the target allow flow come from clb. If value is true, only check security group of clb, or check both clb and backend instance security group. +* `master_zone_id` - (Optional) Setting master zone id of cross available zone disaster recovery, only applicable to open CLB. * `project_id` - (Optional, ForceNew) ID of the project within the CLB instance, `0` - Default Project. -* `security_groups` - (Optional) Security groups of the CLB instance. Only supports `OPEN` CLBs. +* `security_groups` - (Optional) Security groups of the CLB instance. Supports both `OPEN` and `INTERNAL` CLBs. +* `slave_zone_id` - (Optional) Setting slave zone id of cross available zone disaster recovery, only applicable to open CLB. this zone will undertake traffic when the master is down. * `subnet_id` - (Optional, ForceNew) Subnet ID of the CLB. Effective only for CLB within the VPC. Only supports `INTERNAL` CLBs. Default is `ipv4`. * `tags` - (Optional) The available tags within this CLB. * `target_region_info_region` - (Optional) Region information of backend services are attached the CLB instance. Only supports `OPEN` CLBs. * `target_region_info_vpc_id` - (Optional) Vpc information of backend services are attached the CLB instance. Only supports `OPEN` CLBs. * `vpc_id` - (Optional, ForceNew) VPC ID of the CLB. +* `zone_id` - (Optional) Available zone id, only applicable to open CLB. ## Attributes Reference diff --git a/website/docs/r/clb_target_group.html.markdown b/website/docs/r/clb_target_group.html.markdown index 5c9c406024..13c416b1c4 100644 --- a/website/docs/r/clb_target_group.html.markdown +++ b/website/docs/r/clb_target_group.html.markdown @@ -20,13 +20,35 @@ resource "tencentcloud_clb_target_group" "test" { } ``` +Create target group + +```hcl +resource "tencentcloud_clb_target_group" "test" { + target_group_name = "hello1" + port = 18082 + target_group_instances { + bind_ip = "10.0.0.4" + port = 18080 + } +} +``` + ## Argument Reference The following arguments are supported: +* `port` - (Optional) The default port of target group, add server after can use it. +* `target_group_instances` - (Optional) The backend server of target group bind. * `target_group_name` - (Optional) Target group name. * `vpc_id` - (Optional, ForceNew) VPC ID, default is based on the network. +The `target_group_instances` object supports the following: + +* `bind_ip` - (Required) The internal ip of target group instance. +* `port` - (Required) The port of target group instance. +* `new_port` - (Optional) The new port of target group instance. +* `weight` - (Optional) The weight of target group instance. + ## Attributes Reference In addition to all arguments above, the following attributes are exported: diff --git a/website/docs/r/instance.html.markdown b/website/docs/r/instance.html.markdown index 3b5ffb8c7d..0b2d4582ae 100644 --- a/website/docs/r/instance.html.markdown +++ b/website/docs/r/instance.html.markdown @@ -52,7 +52,7 @@ resource "tencentcloud_subnet" "app" { // Create 2 CVM instances to host awesome_app resource "tencentcloud_instance" "my_awesome_app" { instance_name = "awesome_app" - availability_zone = data.tencentcloud_availability_zones.my_favorate_zones.zones.0.name + availability_zone = data.tencentcloud_availability_zones.my_favorite_zones.zones.0.name image_id = data.tencentcloud_images.my_favorite_image.images.0.image_id instance_type = data.tencentcloud_instance_types.my_favorite_instance_types.instance_types.0.instance_type system_disk_type = "CLOUD_PREMIUM" diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index 61810e72a9..c0a19cd1b7 100644 --- a/website/docs/r/kubernetes_cluster.html.markdown +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -64,6 +64,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { internet_max_bandwidth_out = 100 public_ip_assigned = true subnet_id = data.tencentcloud_vpc_subnets.vpc_first.instance_list.0.subnet_id + img_id = "img-rkiynh11" data_disk { disk_type = "CLOUD_PREMIUM" @@ -304,7 +305,7 @@ The following arguments are supported: * `extra_args` - (Optional, ForceNew) Custom parameter information related to the node. * `globe_desired_pod_num` - (Optional, ForceNew) Indicate to set desired pod number in node. valid when enable_customized_pod_cidr=true, and it takes effect for all nodes. * `ignore_cluster_cidr_conflict` - (Optional, ForceNew) Indicates whether to ignore the cluster cidr conflict error. Default is false. -* `is_non_static_ip_mode` - (Optional, ForceNew) Indicates whether static ip mode is enabled. Default is false. +* `is_non_static_ip_mode` - (Optional, ForceNew) Indicates whether non-static ip mode is enabled. Default is false. * `kube_proxy_mode` - (Optional) Cluster kube-proxy mode, the available values include: 'kube-proxy-bpf'. Default is not set.When set to kube-proxy-bpf, cluster version greater than 1.14 and with Tencent Linux 2.4 is required. * `labels` - (Optional, ForceNew) Labels of tke cluster nodes. * `managed_cluster_internet_security_policies` - (Optional) Security policies for managed cluster internet, like:'192.168.1.0/24' or '113.116.51.27', '0.0.0.0/0' means all. This field can only set when field `cluster_deploy_type` is 'MANAGED_CLUSTER' and `cluster_internet` is true. `managed_cluster_internet_security_policies` can not delete or empty once be set. @@ -355,6 +356,7 @@ The `master_config` object supports the following: * `enhanced_monitor_service` - (Optional, ForceNew) To specify whether to enable cloud monitor service. Default is TRUE. * `enhanced_security_service` - (Optional, ForceNew) To specify whether to enable cloud security service. Default is TRUE. * `hostname` - (Optional, ForceNew) The host name of the attached instance. Dot (.) and dash (-) cannot be used as the first and last characters of HostName and cannot be used consecutively. Windows example: The length of the name character is [2, 15], letters (capitalization is not restricted), numbers and dashes (-) are allowed, dots (.) are not supported, and not all numbers are allowed. Examples of other types (Linux, etc.): The character length is [2, 60], and multiple dots are allowed. There is a segment between the dots. Each segment allows letters (with no limitation on capitalization), numbers and dashes (-). +* `img_id` - (Optional) The valid image id, format of img-xxx. * `instance_charge_type_prepaid_period` - (Optional, ForceNew) The tenancy (time unit is month) of the prepaid instance. NOTE: it only works when instance_charge_type is set to `PREPAID`. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `24`, `36`. * `instance_charge_type_prepaid_renew_flag` - (Optional, ForceNew) Auto renewal flag. Valid values: `NOTIFY_AND_AUTO_RENEW`: notify upon expiration and renew automatically, `NOTIFY_AND_MANUAL_RENEW`: notify upon expiration but do not renew automatically, `DISABLE_NOTIFY_AND_MANUAL_RENEW`: neither notify upon expiration nor renew automatically. Default value: `NOTIFY_AND_MANUAL_RENEW`. If this parameter is specified as `NOTIFY_AND_AUTO_RENEW`, the instance will be automatically renewed on a monthly basis if the account balance is sufficient. NOTE: it only works when instance_charge_type is set to `PREPAID`. * `instance_charge_type` - (Optional, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR`, `PREPAID` instance will not terminated after cluster deleted, and may not allow to delete before expired. @@ -394,6 +396,7 @@ The `worker_config` object supports the following: * `enhanced_monitor_service` - (Optional, ForceNew) To specify whether to enable cloud monitor service. Default is TRUE. * `enhanced_security_service` - (Optional, ForceNew) To specify whether to enable cloud security service. Default is TRUE. * `hostname` - (Optional, ForceNew) The host name of the attached instance. Dot (.) and dash (-) cannot be used as the first and last characters of HostName and cannot be used consecutively. Windows example: The length of the name character is [2, 15], letters (capitalization is not restricted), numbers and dashes (-) are allowed, dots (.) are not supported, and not all numbers are allowed. Examples of other types (Linux, etc.): The character length is [2, 60], and multiple dots are allowed. There is a segment between the dots. Each segment allows letters (with no limitation on capitalization), numbers and dashes (-). +* `img_id` - (Optional) The valid image id, format of img-xxx. * `instance_charge_type_prepaid_period` - (Optional, ForceNew) The tenancy (time unit is month) of the prepaid instance. NOTE: it only works when instance_charge_type is set to `PREPAID`. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `24`, `36`. * `instance_charge_type_prepaid_renew_flag` - (Optional, ForceNew) Auto renewal flag. Valid values: `NOTIFY_AND_AUTO_RENEW`: notify upon expiration and renew automatically, `NOTIFY_AND_MANUAL_RENEW`: notify upon expiration but do not renew automatically, `DISABLE_NOTIFY_AND_MANUAL_RENEW`: neither notify upon expiration nor renew automatically. Default value: `NOTIFY_AND_MANUAL_RENEW`. If this parameter is specified as `NOTIFY_AND_AUTO_RENEW`, the instance will be automatically renewed on a monthly basis if the account balance is sufficient. NOTE: it only works when instance_charge_type is set to `PREPAID`. * `instance_charge_type` - (Optional, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR`, `PREPAID` instance will not terminated after cluster deleted, and may not allow to delete before expired. diff --git a/website/docs/r/kubernetes_scale_worker.html.markdown b/website/docs/r/kubernetes_scale_worker.html.markdown index 22d6725dd9..ab4341b199 100644 --- a/website/docs/r/kubernetes_scale_worker.html.markdown +++ b/website/docs/r/kubernetes_scale_worker.html.markdown @@ -151,6 +151,7 @@ The `worker_config` object supports the following: * `enhanced_monitor_service` - (Optional, ForceNew) To specify whether to enable cloud monitor service. Default is TRUE. * `enhanced_security_service` - (Optional, ForceNew) To specify whether to enable cloud security service. Default is TRUE. * `hostname` - (Optional, ForceNew) The host name of the attached instance. Dot (.) and dash (-) cannot be used as the first and last characters of HostName and cannot be used consecutively. Windows example: The length of the name character is [2, 15], letters (capitalization is not restricted), numbers and dashes (-) are allowed, dots (.) are not supported, and not all numbers are allowed. Examples of other types (Linux, etc.): The character length is [2, 60], and multiple dots are allowed. There is a segment between the dots. Each segment allows letters (with no limitation on capitalization), numbers and dashes (-). +* `img_id` - (Optional) The valid image id, format of img-xxx. * `instance_charge_type_prepaid_period` - (Optional, ForceNew) The tenancy (time unit is month) of the prepaid instance. NOTE: it only works when instance_charge_type is set to `PREPAID`. Valid values are `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `24`, `36`. * `instance_charge_type_prepaid_renew_flag` - (Optional, ForceNew) Auto renewal flag. Valid values: `NOTIFY_AND_AUTO_RENEW`: notify upon expiration and renew automatically, `NOTIFY_AND_MANUAL_RENEW`: notify upon expiration but do not renew automatically, `DISABLE_NOTIFY_AND_MANUAL_RENEW`: neither notify upon expiration nor renew automatically. Default value: `NOTIFY_AND_MANUAL_RENEW`. If this parameter is specified as `NOTIFY_AND_AUTO_RENEW`, the instance will be automatically renewed on a monthly basis if the account balance is sufficient. NOTE: it only works when instance_charge_type is set to `PREPAID`. * `instance_charge_type` - (Optional, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`. The default is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR`, `PREPAID` instance will not terminated after cluster deleted, and may not allow to delete before expired. From c61068d8b0bda6ceca7c9ef6b32095c1d9587622 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 9 Jun 2021 14:34:25 +0800 Subject: [PATCH 26/27] change changelog.md: tencentcloud_container_cluster_instance -> tencentcloud_kubernetes_clusters --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c67c52f13..b0532ed668 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ ENHANCEMENTS: * Resource `tencentcloud_clb_instance` add internal CLB supports security group. * Resource `tencentcloud_clb_instance` add supports open and close CLB security group, default is open. * Resource `tencentcloud_clb_instance` add external CLB create multi AZ instance. -* Resource `tencentcloud_container_cluster_instance` add supports params of img_id to assign image. +* Resource `tencentcloud_kubernetes_cluster` add supports params of img_id to assign image. * Resource `tencentcloud_as_scaling_group` add MultiZoneSubnetPolicy. ## 1.56.8 (May 26, 2021) From 8e41ec70276d2b4bd1ab9cff351ce41c7b7f45ae Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 9 Jun 2021 17:45:52 +0800 Subject: [PATCH 27/27] change CHANGELOG.md version info --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0532ed668..631bbc96a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ -## 1.56.9 (Unreleased) -## 1.56.10 (Jun 09, 2021) +## 1.56.10 (Unreleased) +## 1.56.9 (Jun 09, 2021) BUG FIXES: