Skip to content

Commit e2363d9

Browse files
authored
Merge pull request #547 from brickzzhang/master
[bugfix for redis]
2 parents f8943a8 + 0c1e6af commit e2363d9

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
## 1.46.5 (Unreleased)
2+
3+
BUG FIXES:
4+
* Resource: `tencentcloud_redis_instance` fix incorrect number when updating `mem_size`.
5+
* Data Source: `tencentcloud_redis_instances` fix incorrect number for `mem_size`.
6+
27
## 1.46.4 (November 6, 2020)
38

49
BUG FIXES:

tencentcloud/resource_tc_redis_instance.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func resourceTencentCloudRedisInstance() *schema.Resource {
106106
return
107107
}
108108
}
109-
errors = append(errors, fmt.Errorf("this redis type %s not support now.", value))
109+
errors = append(errors, fmt.Errorf("this redis type %s not support now", value))
110110
return
111111
},
112112
Deprecated: "It has been deprecated from version 1.33.1. Please use 'type_id' instead.",
@@ -122,7 +122,7 @@ func resourceTencentCloudRedisInstance() *schema.Resource {
122122
"mem_size": {
123123
Type: schema.TypeInt,
124124
Required: true,
125-
Description: "The memory volume of an available instance(in MB), please refer to tencentcloud_redis_zone_config.list[zone].mem_sizes.",
125+
Description: "The memory volume of an available instance(in MB), please refer to tencentcloud_redis_zone_config.list[zone].mem_sizes. When Redis is standard type, it represents total memory size of the instance; when Redis is cluster type, it represents memory size of per sharding.",
126126
},
127127
"vpc_id": {
128128
Type: schema.TypeString,
@@ -451,13 +451,13 @@ func resourceTencentCloudRedisInstanceRead(d *schema.ResourceData, meta interfac
451451
}
452452

453453
_ = d.Set("availability_zone", zoneName)
454-
_ = d.Set("mem_size", int64(*info.Size))
455-
_ = d.Set("vpc_id", *info.UniqVpcId)
456-
_ = d.Set("subnet_id", *info.UniqSubnetId)
457-
_ = d.Set("project_id", *info.ProjectId)
458-
_ = d.Set("port", *info.Port)
459-
_ = d.Set("ip", *info.WanIp)
460-
_ = d.Set("create_time", *info.Createtime)
454+
_ = d.Set("mem_size", info.RedisShardSize)
455+
_ = d.Set("vpc_id", info.UniqVpcId)
456+
_ = d.Set("subnet_id", info.UniqSubnetId)
457+
_ = d.Set("project_id", info.ProjectId)
458+
_ = d.Set("port", info.Port)
459+
_ = d.Set("ip", info.WanIp)
460+
_ = d.Set("create_time", info.Createtime)
461461
if d.Get("vpc_id").(string) != "" {
462462
securityGroups, err := service.DescribeInstanceSecurityGroup(ctx, d.Id())
463463
if err != nil {
@@ -723,7 +723,7 @@ func resourceTencentCloudRedisInstanceDelete(d *schema.ResourceData, meta interf
723723
if !has || isolated {
724724
return nil
725725
}
726-
return resource.RetryableError(fmt.Errorf("Instance is not ready to be destroyed."))
726+
return resource.RetryableError(fmt.Errorf("instance is not ready to be destroyed"))
727727
}); errDestroyChecking != nil {
728728
log.Printf("[CRITAL]%s redis querying before deleting task fail, reason:%s\n", logId, errDestroyChecking.Error())
729729
return errDestroyChecking

tencentcloud/service_tencentcloud_redis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ needMoreItems:
180180
instance.Zone = name
181181
instance.CreateTime = *item.Createtime
182182
instance.Ip = *item.WanIp
183-
instance.MemSize = int64(*item.Size)
183+
instance.MemSize = *item.RedisShardSize
184184
instance.Name = *item.InstanceName
185185
instance.Port = *item.Port
186186
instance.ProjectId = *item.ProjectId

website/docs/r/redis_instance.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ resource "tencentcloud_redis_instance" "redis_instance_test_2" {
3434
The following arguments are supported:
3535

3636
* `availability_zone` - (Required, ForceNew) The available zone ID of an instance to be created, please refer to tencentcloud_redis_zone_config.list.
37-
* `mem_size` - (Required) The memory volume of an available instance(in MB), please refer to tencentcloud_redis_zone_config.list[zone].mem_sizes.
37+
* `mem_size` - (Required) The memory volume of an available instance(in MB), please refer to tencentcloud_redis_zone_config.list[zone].mem_sizes. When Redis is standard type, it represents total memory size of the instance; when Redis is cluster type, it represents memory size of per sharding.
3838
* `password` - (Required) Password for a Redis user, which should be 8 to 16 characters.
3939
* `charge_type` - (Optional, ForceNew) The charge type of instance. Valid values: `PREPAID` and `POSTPAID`. Default value is `POSTPAID`. Note: TencentCloud International only supports `POSTPAID`. Caution that update operation on this field will delete old instances and create new with new charge type.
4040
* `force_delete` - (Optional) Indicate whether to delete Redis instance directly or not. Default is false. If set true, the instance will be deleted instead of staying recycle bin. Note: only works for PREPAID instance.

0 commit comments

Comments
 (0)