Skip to content

Commit a02da14

Browse files
authored
fix(crs): [125668619] support create Memcached redis (#3438)
* add crs redis * add Memcached redis
1 parent 4ff3f07 commit a02da14

File tree

4 files changed

+176
-2
lines changed

4 files changed

+176
-2
lines changed

.changelog/3438.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_redis_instance: suuport create memcached redis
3+
```

tencentcloud/services/crs/resource_tc_redis_instance.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,19 @@ func ResourceTencentCloudRedisInstance() *schema.Resource {
5757
Type: schema.TypeInt,
5858
Optional: true,
5959
ValidateFunc: tccommon.ValidateIntegerMin(2),
60-
Description: "Instance type. Available values reference data source `tencentcloud_redis_zone_config` or [document](https://intl.cloud.tencent.com/document/product/239/32069), toggle immediately when modified.",
60+
Description: "Instance type. Available values reference data source `tencentcloud_redis_zone_config` or [document](https://intl.cloud.tencent.com/document/product/239/32069), toggle immediately when modified." +
61+
"<ul><li>2: Redis 2.8 Memory Edition (standard architecture);</li> " +
62+
"<li>3: CKV 3.2 Memory Edition (standard architecture);</li> " +
63+
"<li>4: CKV 3.2 Memory Edition (cluster architecture);</li> " +
64+
"<li>6: Redis 4.0 Memory Edition (standard architecture);</li> " +
65+
"<li>7: Redis 4.0 Memory Edition (cluster architecture);</li> " +
66+
"<li>8: Redis 5.0 Memory Edition (standard architecture);</li> " +
67+
"<li>9: Redis 5.0 Memory Edition (cluster architecture);</li> " +
68+
"<li>15: Redis 6.2 Memory Edition (standard architecture);</li> " +
69+
"<li>16: Redis 6.2 Memory Edition (cluster architecture);</li> " +
70+
"<li>17: Redis 7.0 Memory Edition (standard architecture);</li> " +
71+
"<li>18: Redis 7.0 Memory Edition (cluster architecture). </li> " +
72+
"<li>200: Memcached 1.6 Memory Edition (cluster architecture). </li>Note: The CKV version is currently used by existing users and is temporarily retained.</ul>.",
6173
},
6274
"redis_shard_num": {
6375
Type: schema.TypeInt,

tencentcloud/services/crs/resource_tc_redis_instance.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,85 @@ resource "tencentcloud_redis_instance" "example" {
223223
}
224224
```
225225

226+
Create a memcached instance
227+
```hcl
228+
data "tencentcloud_redis_zone_config" "zone" {
229+
type_id = 200
230+
region = "ap-guangzhou"
231+
}
232+
233+
variable "replica_zone_ids" {
234+
default = [100004, 100006]
235+
}
236+
237+
resource "tencentcloud_vpc" "vpc" {
238+
cidr_block = "10.0.0.0/16"
239+
name = "tf_redis_vpc"
240+
}
241+
242+
resource "tencentcloud_subnet" "subnet" {
243+
vpc_id = tencentcloud_vpc.vpc.id
244+
availability_zone = data.tencentcloud_redis_zone_config.zone.list[2].zone
245+
name = "tf_redis_subnet"
246+
cidr_block = "10.0.1.0/24"
247+
}
248+
249+
resource "tencentcloud_security_group" "security_group" {
250+
name = "tf-redis-sg"
251+
}
252+
253+
resource "tencentcloud_security_group_rule_set" "sg_rule" {
254+
security_group_id = tencentcloud_security_group.security_group.id
255+
256+
ingress {
257+
action = "ACCEPT"
258+
cidr_block = "10.0.0.0/22"
259+
protocol = "TCP"
260+
port = "80-90"
261+
description = "A:Allow Ips and 80-90"
262+
}
263+
264+
ingress {
265+
action = "ACCEPT"
266+
cidr_block = "10.0.2.1"
267+
protocol = "UDP"
268+
port = "8080"
269+
description = "B:Allow UDP 8080"
270+
}
271+
272+
egress {
273+
action = "DROP"
274+
cidr_block = "10.0.0.0/16"
275+
protocol = "ICMP"
276+
description = "A:Block ping3"
277+
}
278+
279+
egress {
280+
action = "DROP"
281+
cidr_block = "0.0.0.0/0"
282+
protocol = "ALL"
283+
description = "A:Block ping3"
284+
}
285+
}
286+
287+
resource "tencentcloud_redis_instance" "example" {
288+
availability_zone = data.tencentcloud_redis_zone_config.zone.list[2].zone
289+
type_id = data.tencentcloud_redis_zone_config.zone.list[2].type_id
290+
mem_size = 8192
291+
redis_shard_num = data.tencentcloud_redis_zone_config.zone.list[2].redis_shard_nums[0]
292+
redis_replicas_num = 2
293+
no_auth = true
294+
replica_zone_ids = var.replica_zone_ids
295+
name = "tf-example"
296+
port = 6379
297+
vpc_id = tencentcloud_vpc.vpc.id
298+
subnet_id = tencentcloud_subnet.subnet.id
299+
security_groups = [tencentcloud_security_group.security_group.id]
300+
301+
force_delete = true
302+
}
303+
```
304+
226305
Create a CDC scenario instance
227306

228307
```hcl

website/docs/r/redis_instance.html.markdown

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,86 @@ resource "tencentcloud_redis_instance" "example" {
234234
}
235235
```
236236

237+
### Create a memcached instance
238+
239+
```hcl
240+
data "tencentcloud_redis_zone_config" "zone" {
241+
type_id = 200
242+
region = "ap-guangzhou"
243+
}
244+
245+
variable "replica_zone_ids" {
246+
default = [100004, 100006]
247+
}
248+
249+
resource "tencentcloud_vpc" "vpc" {
250+
cidr_block = "10.0.0.0/16"
251+
name = "tf_redis_vpc"
252+
}
253+
254+
resource "tencentcloud_subnet" "subnet" {
255+
vpc_id = tencentcloud_vpc.vpc.id
256+
availability_zone = data.tencentcloud_redis_zone_config.zone.list[2].zone
257+
name = "tf_redis_subnet"
258+
cidr_block = "10.0.1.0/24"
259+
}
260+
261+
resource "tencentcloud_security_group" "security_group" {
262+
name = "tf-redis-sg"
263+
}
264+
265+
resource "tencentcloud_security_group_rule_set" "sg_rule" {
266+
security_group_id = tencentcloud_security_group.security_group.id
267+
268+
ingress {
269+
action = "ACCEPT"
270+
cidr_block = "10.0.0.0/22"
271+
protocol = "TCP"
272+
port = "80-90"
273+
description = "A:Allow Ips and 80-90"
274+
}
275+
276+
ingress {
277+
action = "ACCEPT"
278+
cidr_block = "10.0.2.1"
279+
protocol = "UDP"
280+
port = "8080"
281+
description = "B:Allow UDP 8080"
282+
}
283+
284+
egress {
285+
action = "DROP"
286+
cidr_block = "10.0.0.0/16"
287+
protocol = "ICMP"
288+
description = "A:Block ping3"
289+
}
290+
291+
egress {
292+
action = "DROP"
293+
cidr_block = "0.0.0.0/0"
294+
protocol = "ALL"
295+
description = "A:Block ping3"
296+
}
297+
}
298+
299+
resource "tencentcloud_redis_instance" "example" {
300+
availability_zone = data.tencentcloud_redis_zone_config.zone.list[2].zone
301+
type_id = data.tencentcloud_redis_zone_config.zone.list[2].type_id
302+
mem_size = 8192
303+
redis_shard_num = data.tencentcloud_redis_zone_config.zone.list[2].redis_shard_nums[0]
304+
redis_replicas_num = 2
305+
no_auth = true
306+
replica_zone_ids = var.replica_zone_ids
307+
name = "tf-example"
308+
port = 6379
309+
vpc_id = tencentcloud_vpc.vpc.id
310+
subnet_id = tencentcloud_subnet.subnet.id
311+
security_groups = [tencentcloud_security_group.security_group.id]
312+
313+
force_delete = true
314+
}
315+
```
316+
237317
### Create a CDC scenario instance
238318

239319
```hcl
@@ -310,7 +390,7 @@ The following arguments are supported:
310390
* `security_groups` - (Optional, Set: [`String`]) ID of security group. If both vpc_id and subnet_id are not set, this argument should not be set either.
311391
* `subnet_id` - (Optional, String) Specifies which subnet the instance should belong to. When the `operation_network` is `changeVpc` or `changeBaseToVpc`, this parameter needs to be configured.
312392
* `tags` - (Optional, Map) Instance tags.
313-
* `type_id` - (Optional, Int) Instance type. Available values reference data source `tencentcloud_redis_zone_config` or [document](https://intl.cloud.tencent.com/document/product/239/32069), toggle immediately when modified.
393+
* `type_id` - (Optional, Int) Instance type. Available values reference data source `tencentcloud_redis_zone_config` or [document](https://intl.cloud.tencent.com/document/product/239/32069), toggle immediately when modified.<ul><li>2: Redis 2.8 Memory Edition (standard architecture);</li> <li>3: CKV 3.2 Memory Edition (standard architecture);</li> <li>4: CKV 3.2 Memory Edition (cluster architecture);</li> <li>6: Redis 4.0 Memory Edition (standard architecture);</li> <li>7: Redis 4.0 Memory Edition (cluster architecture);</li> <li>8: Redis 5.0 Memory Edition (standard architecture);</li> <li>9: Redis 5.0 Memory Edition (cluster architecture);</li> <li>15: Redis 6.2 Memory Edition (standard architecture);</li> <li>16: Redis 6.2 Memory Edition (cluster architecture);</li> <li>17: Redis 7.0 Memory Edition (standard architecture);</li> <li>18: Redis 7.0 Memory Edition (cluster architecture). </li> <li>200: Memcached 1.6 Memory Edition (cluster architecture). </li>Note: The CKV version is currently used by existing users and is temporarily retained.</ul>.
314394
* `type` - (Optional, String, ForceNew, **Deprecated**) It has been deprecated from version 1.33.1. Please use 'type_id' instead. Instance type. Available values: `cluster_ckv`,`cluster_redis5.0`,`cluster_redis`,`master_slave_ckv`,`master_slave_redis4.0`,`master_slave_redis5.0`,`master_slave_redis`,`standalone_redis`, specific region support specific types, need to refer data `tencentcloud_redis_zone_config`.
315395
* `vpc_id` - (Optional, String) ID of the vpc with which the instance is to be associated. When the `operation_network` is `changeVpc` or `changeBaseToVpc`, this parameter needs to be configured.
316396
* `wait_switch` - (Optional, Int) Switching mode: `1`-maintenance time window switching, `2`-immediate switching, default value `2`.

0 commit comments

Comments
 (0)