Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tencentcloud/data_source_tc_redis_zone_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,15 @@ func dataSourceTencentRedisZoneConfig() *schema.Resource {
Type: schema.TypeList,
Elem: &schema.Schema{Type: schema.TypeInt},
Computed: true,
Deprecated: "It has been deprecated from version 1.26.0. Use `shard_memories` instead.",
Description: "The memory volume of an available instance(in MB).",
},
"shard_memories": {
Type: schema.TypeList,
Description: "The memory volume list of an available instance shard(in MB).",
Computed: true,
Elem: &schema.Schema{Type: schema.TypeInt},
},
"redis_shard_nums": {
Type: schema.TypeList,
Computed: true,
Expand Down Expand Up @@ -160,7 +167,17 @@ func dataSourceTencentRedisZoneConfigRead(d *schema.ResourceData, meta interface
memSizes = append(memSizes, temp*1024)
}

shardMemories := make([]int64, 0, len(products.ShardSize))
for _, size := range products.ShardSize {
temp, err := strconv.ParseInt(*size, 10, 64)
if err != nil {
continue
}
shardMemories = append(shardMemories, temp*1024)
}

zoneConfigures["mem_sizes"] = memSizes
zoneConfigures["shard_memories"] = shardMemories
zoneConfigures["type"] = REDIS_NAMES[*products.Type]

var redisShardNums []int64
Expand Down
2 changes: 2 additions & 0 deletions tencentcloud/data_source_tc_redis_zone_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func TestAccDataSourceRedisZoneConfig_basic(t *testing.T) {
resource.TestCheckResourceAttrSet("data.tencentcloud_redis_zone_config.test", "list.0.type"),
resource.TestCheckResourceAttrSet("data.tencentcloud_redis_zone_config.test", "list.0.version"),
resource.TestCheckResourceAttrSet("data.tencentcloud_redis_zone_config.test", "list.0.mem_sizes.#"),
resource.TestCheckResourceAttrSet("data.tencentcloud_redis_zone_config.test", "list.0.shard_memories.#"),
),
},
{
Expand All @@ -33,6 +34,7 @@ func TestAccDataSourceRedisZoneConfig_basic(t *testing.T) {
resource.TestCheckResourceAttrSet("data.tencentcloud_redis_zone_config.testWithRegion", "list.0.type_id"),
resource.TestCheckResourceAttrSet("data.tencentcloud_redis_zone_config.testWithRegion", "list.0.version"),
resource.TestCheckResourceAttrSet("data.tencentcloud_redis_zone_config.testWithRegion", "list.0.mem_sizes.#"),
resource.TestCheckResourceAttrSet("data.tencentcloud_redis_zone_config.testWithRegion", "list.0.shard_memories.#"),
resource.TestCheckResourceAttrSet("data.tencentcloud_redis_zone_config.testWithRegion", "list.0.redis_shard_nums.#"),
resource.TestCheckResourceAttrSet("data.tencentcloud_redis_zone_config.testWithRegion", "list.0.redis_replicas_nums.#"),
),
Expand Down
2 changes: 1 addition & 1 deletion tencentcloud/resource_tc_redis_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func resourceTencentCloudRedisInstance() *schema.Resource {
"mem_size": {
Type: schema.TypeInt,
Required: true,
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.",
Description: "The memory volume of an available instance(in MB), please refer to `tencentcloud_redis_zone_config.list[zone].shard_memories`. 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.",
},
"vpc_id": {
Type: schema.TypeString,
Expand Down
3 changes: 2 additions & 1 deletion website/docs/d/redis_zone_config.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ The following arguments are supported:
In addition to all arguments above, the following attributes are exported:

* `list` - A list of zone. Each element contains the following attributes:
* `mem_sizes` - The memory volume of an available instance(in MB).
* `mem_sizes` - (**Deprecated**) It has been deprecated from version 1.26.0. Use `shard_memories` instead. The memory volume of an available instance(in MB).
* `redis_replicas_nums` - The support numbers of instance copies.
* `redis_shard_nums` - The support numbers of instance shard.
* `shard_memories` - The memory volume list of an available instance shard(in MB).
* `type_id` - Instance type. Which redis type supports in this zone.
* `type` - (**Deprecated**) It has been deprecated from version 1.33.1. Please use 'type_id' instead. Instance type. Available values: `master_slave_redis`, `master_slave_ckv`, `cluster_ckv`, `cluster_redis` and `standalone_redis`.
* `version` - Version description of an available instance. Possible values: `Redis 3.2`, `Redis 4.0`.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/redis_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ resource "tencentcloud_redis_instance" "red1" {
The following arguments are supported:

* `availability_zone` - (Required, ForceNew) The available zone ID of an instance to be created, please refer to `tencentcloud_redis_zone_config.list`.
* `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.
* `mem_size` - (Required) The memory volume of an available instance(in MB), please refer to `tencentcloud_redis_zone_config.list[zone].shard_memories`. 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.
* `auto_renew_flag` - (Optional, ForceNew) Auto-renew flag. 0 - default state (manual renewal); 1 - automatic renewal; 2 - explicit no automatic renewal.
* `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.
* `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.
Expand Down