Skip to content

Commit 8120f37

Browse files
Rich-yixiaozhu36
authored andcommitted
Adding different versions of submodules for redis module
1 parent e79b65f commit 8120f37

File tree

85 files changed

+4848
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+4848
-13
lines changed
File renamed without changes.

examples/redis-2.8/main.tf

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
variable "region" {
2+
default = "cn-beijing"
3+
}
4+
provider "alicloud" {
5+
region = var.region
6+
}
7+
data "alicloud_vpcs" "default" {
8+
is_default = true
9+
}
10+
data "alicloud_zones" "default" {
11+
available_resource_creation = "KVStore"
12+
multi = true
13+
enable_details = true
14+
}
15+
resource "alicloud_vswitch" "this" {
16+
name = "redis_vpc"
17+
availability_zone = data.alicloud_zones.default.zones.0.multi_zone_ids.0
18+
vpc_id = data.alicloud_vpcs.default.vpcs.0.id
19+
cidr_block = cidrsubnet(data.alicloud_vpcs.default.vpcs.0.cidr_block, 4, 2)
20+
}
21+
module "redis_example" {
22+
source = "../../modules/redis-2.8-communtity-cluster"
23+
region = var.region
24+
25+
#################
26+
# Redis Instance
27+
#################
28+
29+
instance_name = "myInstance"
30+
instance_class = "redis.logic.sharding.2g.8db.0rodb.8proxy.default"
31+
period = 1
32+
availability_zone = data.alicloud_zones.default.zones.0.multi_zone_ids.0
33+
vswitch_id = alicloud_vswitch.this.id
34+
security_ips = ["1.1.1.1", "2.2.2.2", "3.3.3.3"]
35+
tags = {
36+
Env = "Private"
37+
Location = "Secret"
38+
}
39+
40+
#################
41+
# Redis backup_policy
42+
#################
43+
44+
backup_policy_backup_time = "02:00Z-03:00Z"
45+
backup_policy_backup_period = ["Monday", "Wednesday", "Friday"]
46+
47+
#################
48+
# Redis account
49+
#################
50+
51+
accounts = [
52+
{
53+
account_name = "user1"
54+
account_password = "plan111111"
55+
account_privilege = "RoleReadOnly"
56+
account_type = "Normal"
57+
},
58+
{
59+
account_name = "user2"
60+
account_password = "plan222222"
61+
},
62+
]
63+
}

examples/redis/outputs.tf renamed to examples/redis-2.8/outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ output "this_redis_instance_maintain_start_time" {
8282
value = module.redis_example.this_redis_instance_maintain_start_time
8383
}
8484
output "this_redis_instance_maintain_end_time" {
85-
ddescription = "The end time of the operation and maintenance time period of the instance."
86-
value = module.redis_example.this_redis_instance_maintain_end_time
85+
description = "The end time of the operation and maintenance time period of the instance."
86+
value = module.redis_example.this_redis_instance_maintain_end_time
8787
}
8888

8989
#################
File renamed without changes.

examples/redis-4.0/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Complete RDS example for Redis
2+
3+
## Usage
4+
5+
To run this example you need to execute:
6+
7+
```bash
8+
$ terraform init
9+
$ terraform plan
10+
$ terraform apply
11+
```
12+
13+
Note that this example will create resources which cost money. Run `terraform destroy` when you don't need these resources.
14+
15+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/redis-4.0/main.tf

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
variable "region" {
2+
default = "cn-beijing"
3+
}
4+
provider "alicloud" {
5+
region = var.region
6+
}
7+
data "alicloud_vpcs" "default" {
8+
is_default = true
9+
}
10+
data "alicloud_zones" "default" {
11+
available_resource_creation = "KVStore"
12+
multi = true
13+
enable_details = true
14+
}
15+
resource "alicloud_vswitch" "this" {
16+
name = "redis_vpc"
17+
availability_zone = data.alicloud_zones.default.zones.0.multi_zone_ids.0
18+
vpc_id = data.alicloud_vpcs.default.vpcs.0.id
19+
cidr_block = cidrsubnet(data.alicloud_vpcs.default.vpcs.0.cidr_block, 4, 10)
20+
}
21+
module "redis_example" {
22+
source = "../../modules/redis-4.0-enterprise-cluster-(hybrid_storage)"
23+
region = var.region
24+
25+
#################
26+
# Redis Instance
27+
#################
28+
29+
instance_name = "myInstance"
30+
instance_class = "redis.logic.sharding.2g.8db.0rodb.8proxy.default"
31+
period = 1
32+
availability_zone = data.alicloud_zones.default.zones.0.multi_zone_ids.0
33+
vswitch_id = alicloud_vswitch.this.id
34+
security_ips = ["1.1.1.1", "2.2.2.2", "3.3.3.3"]
35+
tags = {
36+
Env = "Private"
37+
Location = "Secret"
38+
}
39+
40+
#################
41+
# Redis backup_policy
42+
#################
43+
44+
backup_policy_backup_time = "02:00Z-03:00Z"
45+
backup_policy_backup_period = ["Monday", "Wednesday", "Friday"]
46+
47+
#################
48+
# Redis account
49+
#################
50+
51+
accounts = [
52+
{
53+
account_name = "user1"
54+
account_password = "plan111111"
55+
account_privilege = "RoleReadOnly"
56+
account_type = "Normal"
57+
},
58+
{
59+
account_name = "user2"
60+
account_password = "plan222222"
61+
},
62+
]
63+
}

examples/redis-4.0/outputs.tf

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#################
2+
# Redis Instance
3+
#################
4+
5+
output "this_redis_instance_id" {
6+
description = "This redis instance id."
7+
value = module.redis_example.this_redis_instance_id
8+
}
9+
10+
output "this_redis_instance_name" {
11+
description = "This redis instance name."
12+
value = module.redis_example.this_redis_instance_name
13+
}
14+
15+
output "this_redis_instance_class" {
16+
description = "This redis instance class."
17+
value = module.redis_example.this_redis_instance_class
18+
}
19+
output "this_redis_instance_availability_zone" {
20+
description = "The availability zone in which redis instance."
21+
value = module.redis_example.this_redis_instance_availability_zone
22+
}
23+
24+
output "this_redis_instance_charge_type" {
25+
description = "This redis instance availability charge type."
26+
value = module.redis_example.this_redis_instance_charge_type
27+
}
28+
29+
output "this_redis_instance_period" {
30+
description = "The duration that you will buy DB instance."
31+
value = module.redis_example.this_redis_instance_auto_renew_period
32+
}
33+
34+
output "this_redis_instance_auto_renew" {
35+
description = "Whether to renewal a DB instance automatically or not."
36+
value = module.redis_example.this_redis_instance_auto_renew
37+
}
38+
39+
output "this_redis_instance_auto_renew_period" {
40+
description = "Auto-renewal period of an instance, in the unit of the month."
41+
value = module.redis_example.this_redis_instance_auto_renew_period
42+
}
43+
44+
output "this_redis_instance_type" {
45+
description = "This redis instance type."
46+
value = module.redis_example.this_redis_instance_type
47+
}
48+
output "this_redis_instance_vswitch_id" {
49+
description = "The id of vswitch in which redis instance."
50+
value = module.redis_example.this_redis_instance_vswitch_id
51+
}
52+
53+
output "this_redis_instance_engine_version" {
54+
description = "This redis instance engine version ."
55+
value = module.redis_example.this_redis_instance_engine_version
56+
}
57+
58+
output "this_redis_instance_private_ip" {
59+
description = "Set the instance's private IP."
60+
value = module.redis_example.this_redis_instance_private_ip
61+
}
62+
63+
output "this_redis_instance_backup_id" {
64+
description = "If an instance created based on a backup set generated by another instance is valid, this parameter indicates the ID of the generated backup set."
65+
value = module.redis_example.this_redis_instance_backup_id
66+
}
67+
68+
output "this_redis_instance_tags" {
69+
description = "A mapping of tags to assign to the redis instance resource."
70+
value = module.redis_example.this_redis_instance_tags
71+
}
72+
output "this_redis_instance_security_ips" {
73+
description = "List of IP addresses allowed to access all redis of an instance."
74+
value = module.redis_example.this_redis_instance_security_ips
75+
}
76+
output "this_redis_instance_vpc_auth_mode" {
77+
description = "Whether to renewal a DB instance automatically or not."
78+
value = module.redis_example.this_redis_instance_vpc_auth_mode
79+
}
80+
output "this_redis_instance_maintain_start_time" {
81+
description = "The start time of the operation and maintenance time period of the instance."
82+
value = module.redis_example.this_redis_instance_maintain_start_time
83+
}
84+
output "this_redis_instance_maintain_end_time" {
85+
description = "The end time of the operation and maintenance time period of the instance."
86+
value = module.redis_example.this_redis_instance_maintain_end_time
87+
}
88+
89+
#################
90+
# Redis Account
91+
#################
92+
93+
output "this_redis_instance_account_name" {
94+
description = "This Redis instance account name."
95+
value = module.redis_example.this_redis_instance_account_name
96+
}
97+
98+
########################
99+
# Redis backup policy
100+
########################
101+
102+
output "this_redis_instance_backup_policy_backup_period" {
103+
description = "This Redis instance backup policy backup period."
104+
value = module.redis_example.this_redis_instance_backup_policy_backup_period
105+
}
106+
107+
output "this_redis_instance_backup_policy_backup_time" {
108+
description = "This Redis instance backup policy backup time."
109+
value = module.redis_example.this_redis_instance_backup_policy_backup_time
110+
}
File renamed without changes.

examples/redis-5.0/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Complete RDS example for Redis
2+
3+
## Usage
4+
5+
To run this example you need to execute:
6+
7+
```bash
8+
$ terraform init
9+
$ terraform plan
10+
$ terraform apply
11+
```
12+
13+
Note that this example will create resources which cost money. Run `terraform destroy` when you don't need these resources.
14+
15+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/redis/main.tf renamed to examples/redis-5.0/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ resource "alicloud_vswitch" "this" {
1919
cidr_block = cidrsubnet(data.alicloud_vpcs.default.vpcs.0.cidr_block, 4, 2)
2020
}
2121
module "redis_example" {
22-
source = "../../modules/redis"
22+
source = "../../modules/redis-5.0-communtity-cluster"
2323
region = var.region
2424

2525
#################

0 commit comments

Comments
 (0)