Skip to content

Commit 964fd28

Browse files
gitmknanonymous
andauthored
fix: update doc (#1944)
Co-authored-by: anonymous <anonymous@mail.org>
1 parent c98d147 commit 964fd28

File tree

2 files changed

+238
-36
lines changed

2 files changed

+238
-36
lines changed

tencentcloud/resource_tc_elasticsearch_instance.go

Lines changed: 120 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,135 @@ Provides an elasticsearch instance resource.
33
44
Example Usage
55
6+
Create a basic version of elasticsearch instance paid by the hour
7+
68
```hcl
7-
resource "tencentcloud_elasticsearch_instance" "foo" {
8-
instance_name = "tf-test"
9-
availability_zone = "ap-guangzhou-3"
10-
version = "7.5.1"
11-
vpc_id = var.vpc_id
12-
subnet_id = var.subnet_id
13-
password = "Test12345"
14-
license_type = "basic"
9+
data "tencentcloud_availability_zones_by_product" "availability_zone" {
10+
product = "es"
11+
}
12+
13+
resource "tencentcloud_vpc" "vpc" {
14+
cidr_block = "10.0.0.0/16"
15+
name = "tf_es_vpc"
16+
}
17+
18+
resource "tencentcloud_subnet" "subnet" {
19+
vpc_id = tencentcloud_vpc.vpc.id
20+
availability_zone = data.tencentcloud_availability_zones_by_product.availability_zone.zones.0.name
21+
name = "tf_es_subnet"
22+
cidr_block = "10.0.1.0/24"
23+
}
24+
25+
resource "tencentcloud_elasticsearch_instance" "example" {
26+
instance_name = "tf_example_es"
27+
availability_zone = data.tencentcloud_availability_zones_by_product.availability_zone.zones.0.name
28+
version = "7.10.1"
29+
vpc_id = tencentcloud_vpc.vpc.id
30+
subnet_id = tencentcloud_subnet.subnet.id
31+
password = "Test12345"
32+
license_type = "basic"
33+
basic_security_type = 2
1534
1635
web_node_type_info {
17-
node_num = 1
36+
node_num = 1
1837
node_type = "ES.S1.MEDIUM4"
1938
}
2039
2140
node_info_list {
2241
node_num = 2
42+
node_type = "ES.S1.MEDIUM8"
43+
encrypt = false
44+
}
45+
46+
es_acl {
47+
# black_list = [
48+
# "9.9.9.9",
49+
# "8.8.8.8",
50+
# ]
51+
white_list = [
52+
"127.0.0.1",
53+
]
54+
}
55+
56+
tags = {
57+
test = "test"
58+
}
59+
}
60+
```
61+
62+
Create a basic version of elasticsearch instance for multi-availability zone deployment
63+
64+
```hcl
65+
data "tencentcloud_availability_zones_by_product" "availability_zone" {
66+
product = "es"
67+
}
68+
69+
resource "tencentcloud_vpc" "vpc" {
70+
cidr_block = "10.0.0.0/16"
71+
name = "tf_es_vpc"
72+
}
73+
74+
resource "tencentcloud_subnet" "subnet" {
75+
vpc_id = tencentcloud_vpc.vpc.id
76+
availability_zone = data.tencentcloud_availability_zones_by_product.availability_zone.zones.0.name
77+
name = "tf_es_subnet"
78+
cidr_block = "10.0.1.0/24"
79+
}
80+
81+
resource "tencentcloud_subnet" "subnet_multi_zone" {
82+
vpc_id = tencentcloud_vpc.vpc.id
83+
availability_zone = data.tencentcloud_availability_zones_by_product.availability_zone.zones.1.name
84+
name = "tf_es_subnet"
85+
cidr_block = "10.0.2.0/24"
86+
}
87+
88+
resource "tencentcloud_elasticsearch_instance" "example_multi_zone" {
89+
instance_name = "tf_example_es"
90+
availability_zone = "-"
91+
version = "7.10.1"
92+
vpc_id = tencentcloud_vpc.vpc.id
93+
subnet_id = "-"
94+
password = "Test12345"
95+
license_type = "basic"
96+
basic_security_type = 2
97+
deploy_mode = 1
98+
99+
multi_zone_infos {
100+
availability_zone = data.tencentcloud_availability_zones_by_product.availability_zone.zones.0.name
101+
subnet_id = tencentcloud_subnet.subnet.id
102+
}
103+
104+
multi_zone_infos {
105+
availability_zone = data.tencentcloud_availability_zones_by_product.availability_zone.zones.1.name
106+
subnet_id = tencentcloud_subnet.subnet_multi_zone.id
107+
}
108+
109+
web_node_type_info {
110+
node_num = 1
23111
node_type = "ES.S1.MEDIUM4"
24-
encrypt = false
112+
}
113+
114+
node_info_list {
115+
type = "dedicatedMaster"
116+
node_num = 3
117+
node_type = "ES.S1.MEDIUM8"
118+
encrypt = false
119+
}
120+
121+
node_info_list {
122+
type = "hotData"
123+
node_num = 2
124+
node_type = "ES.S1.MEDIUM8"
125+
encrypt = false
25126
}
26127
27128
es_acl {
28-
black_list = [
29-
"9.9.9.9",
30-
"8.8.8.8",
31-
]
129+
# black_list = [
130+
# "9.9.9.9",
131+
# "8.8.8.8",
132+
# ]
32133
white_list = [
33-
"0.0.0.0",
134+
"127.0.0.1",
34135
]
35136
}
36137
@@ -88,12 +189,12 @@ func resourceTencentCloudElasticsearchInstance() *schema.Resource {
88189
Optional: true,
89190
Default: "-",
90191
ForceNew: true,
91-
Description: "Availability zone. When create multi-az es, this parameter must be omitted.",
192+
Description: "Availability zone. When create multi-az es, this parameter must be omitted or `-`.",
92193
},
93194
"version": {
94195
Type: schema.TypeString,
95196
Required: true,
96-
Description: "Version of the instance. Valid values are `5.6.4`, `6.4.3`, `6.8.2` and `7.5.1`.",
197+
Description: "Version of the instance. Valid values are `5.6.4`, `6.4.3`, `6.8.2`, `7.5.1` and `7.10.1`.",
97198
},
98199
"vpc_id": {
99200
Type: schema.TypeString,
@@ -106,13 +207,13 @@ func resourceTencentCloudElasticsearchInstance() *schema.Resource {
106207
Optional: true,
107208
Default: "-",
108209
ForceNew: true,
109-
Description: "The ID of a VPC subnetwork. When create multi-az es, this parameter must be omitted.",
210+
Description: "The ID of a VPC subnetwork. When create multi-az es, this parameter must be omitted or `-`.",
110211
},
111212
"password": {
112213
Type: schema.TypeString,
113214
Required: true,
114215
Sensitive: true,
115-
Description: "Password to an instance.",
216+
Description: "Password to an instance, the password needs to be 8 to 16 characters, including at least two items ([a-z,A-Z], [0-9] and [-!@#$%&^*+=_:;,.?] special symbols.",
116217
},
117218
"charge_type": {
118219
Type: schema.TypeString,

website/docs/r/elasticsearch_instance.html.markdown

Lines changed: 118 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,34 @@ Provides an elasticsearch instance resource.
1313

1414
## Example Usage
1515

16+
### Create a basic version of elasticsearch instance paid by the hour
17+
1618
```hcl
17-
resource "tencentcloud_elasticsearch_instance" "foo" {
18-
instance_name = "tf-test"
19-
availability_zone = "ap-guangzhou-3"
20-
version = "7.5.1"
21-
vpc_id = var.vpc_id
22-
subnet_id = var.subnet_id
23-
password = "Test12345"
24-
license_type = "basic"
19+
data "tencentcloud_availability_zones_by_product" "availability_zone" {
20+
product = "es"
21+
}
22+
23+
resource "tencentcloud_vpc" "vpc" {
24+
cidr_block = "10.0.0.0/16"
25+
name = "tf_es_vpc"
26+
}
27+
28+
resource "tencentcloud_subnet" "subnet" {
29+
vpc_id = tencentcloud_vpc.vpc.id
30+
availability_zone = data.tencentcloud_availability_zones_by_product.availability_zone.zones.0.name
31+
name = "tf_es_subnet"
32+
cidr_block = "10.0.1.0/24"
33+
}
34+
35+
resource "tencentcloud_elasticsearch_instance" "example" {
36+
instance_name = "tf_example_es"
37+
availability_zone = data.tencentcloud_availability_zones_by_product.availability_zone.zones.0.name
38+
version = "7.10.1"
39+
vpc_id = tencentcloud_vpc.vpc.id
40+
subnet_id = tencentcloud_subnet.subnet.id
41+
password = "Test12345"
42+
license_type = "basic"
43+
basic_security_type = 2
2544
2645
web_node_type_info {
2746
node_num = 1
@@ -30,17 +49,99 @@ resource "tencentcloud_elasticsearch_instance" "foo" {
3049
3150
node_info_list {
3251
node_num = 2
33-
node_type = "ES.S1.MEDIUM4"
52+
node_type = "ES.S1.MEDIUM8"
3453
encrypt = false
3554
}
3655
3756
es_acl {
38-
black_list = [
39-
"9.9.9.9",
40-
"8.8.8.8",
57+
# black_list = [
58+
# "9.9.9.9",
59+
# "8.8.8.8",
60+
# ]
61+
white_list = [
62+
"127.0.0.1",
4163
]
64+
}
65+
66+
tags = {
67+
test = "test"
68+
}
69+
}
70+
```
71+
72+
### Create a basic version of elasticsearch instance for multi-availability zone deployment
73+
74+
```hcl
75+
data "tencentcloud_availability_zones_by_product" "availability_zone" {
76+
product = "es"
77+
}
78+
79+
resource "tencentcloud_vpc" "vpc" {
80+
cidr_block = "10.0.0.0/16"
81+
name = "tf_es_vpc"
82+
}
83+
84+
resource "tencentcloud_subnet" "subnet" {
85+
vpc_id = tencentcloud_vpc.vpc.id
86+
availability_zone = data.tencentcloud_availability_zones_by_product.availability_zone.zones.0.name
87+
name = "tf_es_subnet"
88+
cidr_block = "10.0.1.0/24"
89+
}
90+
91+
resource "tencentcloud_subnet" "subnet_multi_zone" {
92+
vpc_id = tencentcloud_vpc.vpc.id
93+
availability_zone = data.tencentcloud_availability_zones_by_product.availability_zone.zones.1.name
94+
name = "tf_es_subnet"
95+
cidr_block = "10.0.2.0/24"
96+
}
97+
98+
resource "tencentcloud_elasticsearch_instance" "example_multi_zone" {
99+
instance_name = "tf_example_es"
100+
availability_zone = "-"
101+
version = "7.10.1"
102+
vpc_id = tencentcloud_vpc.vpc.id
103+
subnet_id = "-"
104+
password = "Test12345"
105+
license_type = "basic"
106+
basic_security_type = 2
107+
deploy_mode = 1
108+
109+
multi_zone_infos {
110+
availability_zone = data.tencentcloud_availability_zones_by_product.availability_zone.zones.0.name
111+
subnet_id = tencentcloud_subnet.subnet.id
112+
}
113+
114+
multi_zone_infos {
115+
availability_zone = data.tencentcloud_availability_zones_by_product.availability_zone.zones.1.name
116+
subnet_id = tencentcloud_subnet.subnet_multi_zone.id
117+
}
118+
119+
web_node_type_info {
120+
node_num = 1
121+
node_type = "ES.S1.MEDIUM4"
122+
}
123+
124+
node_info_list {
125+
type = "dedicatedMaster"
126+
node_num = 3
127+
node_type = "ES.S1.MEDIUM8"
128+
encrypt = false
129+
}
130+
131+
node_info_list {
132+
type = "hotData"
133+
node_num = 2
134+
node_type = "ES.S1.MEDIUM8"
135+
encrypt = false
136+
}
137+
138+
es_acl {
139+
# black_list = [
140+
# "9.9.9.9",
141+
# "8.8.8.8",
142+
# ]
42143
white_list = [
43-
"0.0.0.0",
144+
"127.0.0.1",
44145
]
45146
}
46147
@@ -55,10 +156,10 @@ resource "tencentcloud_elasticsearch_instance" "foo" {
55156
The following arguments are supported:
56157

57158
* `node_info_list` - (Required, List) Node information list, which is used to describe the specification information of various types of nodes in the cluster, such as node type, node quantity, node specification, disk type, and disk size.
58-
* `password` - (Required, String) Password to an instance.
59-
* `version` - (Required, String) Version of the instance. Valid values are `5.6.4`, `6.4.3`, `6.8.2` and `7.5.1`.
159+
* `password` - (Required, String) Password to an instance, the password needs to be 8 to 16 characters, including at least two items ([a-z,A-Z], [0-9] and [-!@#$%&^*+=_:;,.?] special symbols.
160+
* `version` - (Required, String) Version of the instance. Valid values are `5.6.4`, `6.4.3`, `6.8.2`, `7.5.1` and `7.10.1`.
60161
* `vpc_id` - (Required, String, ForceNew) The ID of a VPC network.
61-
* `availability_zone` - (Optional, String, ForceNew) Availability zone. When create multi-az es, this parameter must be omitted.
162+
* `availability_zone` - (Optional, String, ForceNew) Availability zone. When create multi-az es, this parameter must be omitted or `-`.
62163
* `basic_security_type` - (Optional, Int) Whether to enable X-Pack security authentication in Basic Edition 6.8 and above. Valid values are `1` and `2`. `1` is disabled, `2` is enabled, and default value is `1`. Notice: this parameter is only take effect on `basic` license.
63164
* `charge_period` - (Optional, Int, ForceNew) The tenancy of the prepaid instance, and uint is month. NOTE: it only works when charge_type is set to `PREPAID`.
64165
* `charge_type` - (Optional, String, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`.
@@ -68,7 +169,7 @@ The following arguments are supported:
68169
* `license_type` - (Optional, String) License type. Valid values are `oss`, `basic` and `platinum`. The default value is `platinum`.
69170
* `multi_zone_infos` - (Optional, List, ForceNew) Details of AZs in multi-AZ deployment mode (which is required when deploy_mode is `1`).
70171
* `renew_flag` - (Optional, String, ForceNew) When enabled, the instance will be renew automatically when it reach the end of the prepaid tenancy. Valid values are `RENEW_FLAG_AUTO` and `RENEW_FLAG_MANUAL`. NOTE: it only works when charge_type is set to `PREPAID`.
71-
* `subnet_id` - (Optional, String, ForceNew) The ID of a VPC subnetwork. When create multi-az es, this parameter must be omitted.
172+
* `subnet_id` - (Optional, String, ForceNew) The ID of a VPC subnetwork. When create multi-az es, this parameter must be omitted or `-`.
72173
* `tags` - (Optional, Map) A mapping of tags to assign to the instance. For tag limits, please refer to [Use Limits](https://intl.cloud.tencent.com/document/product/651/13354).
73174
* `web_node_type_info` - (Optional, List) Visual node configuration.
74175

0 commit comments

Comments
 (0)