Skip to content

Commit 5070257

Browse files
committed
add
1 parent 76fcb6c commit 5070257

File tree

2 files changed

+136
-143
lines changed

2 files changed

+136
-143
lines changed

tencentcloud/services/dts/resource_tc_dts_sync_config.md

Lines changed: 92 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -5,107 +5,102 @@ Example Usage
55
Sync mysql database to cynosdb through cdb access type
66

77
```hcl
8-
resource "tencentcloud_cynosdb_cluster" "foo" {
9-
available_zone = var.availability_zone
10-
vpc_id = local.vpc_id
11-
subnet_id = local.subnet_id
12-
db_type = "MYSQL"
13-
db_version = "5.7"
14-
storage_limit = 1000
15-
cluster_name = "tf-cynosdb-mysql-sync-dst"
16-
password = "*"
17-
instance_maintain_duration = 3600
18-
instance_maintain_start_time = 10800
19-
instance_maintain_weekdays = [
20-
"Fri",
21-
"Mon",
22-
"Sat",
23-
"Sun",
24-
"Thu",
25-
"Wed",
26-
"Tue",
27-
]
28-
29-
instance_cpu_core = 1
30-
instance_memory_size = 2
31-
param_items {
32-
name = "character_set_server"
33-
current_value = "utf8"
34-
}
35-
param_items {
36-
name = "time_zone"
37-
current_value = "+09:00"
38-
}
39-
param_items {
40-
name = "lower_case_table_names"
41-
current_value = "1"
42-
}
43-
44-
force_delete = true
45-
46-
rw_group_sg = [
47-
local.sg_id
48-
]
49-
ro_group_sg = [
50-
local.sg_id
51-
]
52-
prarm_template_id = var.my_param_template
8+
resource "tencentcloud_cynosdb_cluster" "example" {
9+
available_zone = "ap-guangzhou-6"
10+
vpc_id = "vpc-i5yyodl9"
11+
subnet_id = "subnet-hhi88a58"
12+
db_mode = "NORMAL"
13+
db_type = "MYSQL"
14+
db_version = "5.7"
15+
port = 3306
16+
cluster_name = "tf-example"
17+
password = "cynosDB@123"
18+
instance_maintain_duration = 7200
19+
instance_maintain_start_time = 10800
20+
instance_cpu_core = 2
21+
instance_memory_size = 4
22+
force_delete = true
23+
instance_maintain_weekdays = [
24+
"Fri",
25+
"Mon",
26+
"Sat",
27+
"Sun",
28+
"Thu",
29+
"Wed",
30+
"Tue",
31+
]
32+
33+
param_items {
34+
name = "character_set_server"
35+
current_value = "utf8mb4"
5336
}
5437
55-
resource "tencentcloud_dts_sync_job" "sync_job" {
56-
pay_mode = "PostPay"
57-
src_database_type = "mysql"
58-
src_region = "ap-guangzhou"
59-
dst_database_type = "cynosdbmysql"
60-
dst_region = "ap-guangzhou"
61-
tags {
62-
tag_key = "aaa"
63-
tag_value = "bbb"
64-
}
65-
auto_renew = 0
66-
instance_class = "micro"
38+
param_items {
39+
name = "lower_case_table_names"
40+
current_value = "0"
6741
}
6842
69-
resource "tencentcloud_dts_sync_config" "sync_config" {
70-
job_id = tencentcloud_dts_sync_job.sync_job.job_id
43+
tags = {
44+
createBy = "terraform"
45+
}
46+
}
47+
48+
resource "tencentcloud_dts_sync_job" "example" {
49+
pay_mode = "PostPay"
50+
src_database_type = "mysql"
51+
src_region = "ap-guangzhou"
52+
dst_database_type = "cynosdbmysql"
53+
dst_region = "ap-guangzhou"
54+
auto_renew = 0
55+
instance_class = "micro"
56+
tags {
57+
tag_key = "key"
58+
tag_value = "value"
59+
}
60+
}
61+
62+
resource "tencentcloud_dts_sync_config" "example" {
63+
job_id = tencentcloud_dts_sync_job.example.job_id
7164
src_access_type = "cdb"
7265
dst_access_type = "cdb"
73-
74-
job_name = "tf_test_sync_config"
75-
job_mode = "liteMode"
76-
run_mode = "Immediate"
66+
job_name = "tf_example"
67+
job_mode = "liteMode"
68+
run_mode = "Immediate"
7769
7870
objects {
79-
mode = "Partial"
80-
databases {
81-
db_name = "tf_ci_test"
82-
new_db_name = "tf_ci_test_new"
83-
db_mode = "Partial"
84-
table_mode = "All"
85-
tables {
86-
table_name = "test"
87-
new_table_name = "test_new"
88-
}
89-
}
71+
mode = "Partial"
72+
databases {
73+
db_name = "tf_ci_test"
74+
new_db_name = "tf_ci_test_new"
75+
db_mode = "Partial"
76+
table_mode = "All"
77+
tables {
78+
table_name = "test"
79+
new_table_name = "test_new"
80+
}
81+
}
9082
}
83+
9184
src_info {
92-
region = "ap-guangzhou"
93-
instance_id = "cdb-fitq5t9h"
94-
user = "your_user_name"
95-
password = "*"
96-
db_name = "tf_ci_test"
97-
vpc_id = local.vpc_id
98-
subnet_id = local.subnet_id
85+
region = "ap-guangzhou"
86+
instance_id = "cdb-fitq5t9h"
87+
user = "your_user_name"
88+
password = "*"
89+
db_name = "tf_ci_test"
90+
vpc_id = "vpc-i5yyodl9"
91+
subnet_id = "subnet-hhi88a58"
9992
}
93+
10094
dst_info {
101-
region = "ap-guangzhou"
102-
instance_id = tencentcloud_cynosdb_cluster.foo.id
103-
user = "root"
104-
password = "*"
105-
db_name = "tf_ci_test_new"
106-
vpc_id = local.vpc_id
107-
subnet_id = local.subnet_id
95+
region = "ap-guangzhou"
96+
instance_id = tencentcloud_cynosdb_cluster.example.id
97+
user = "root"
98+
password = "*"
99+
db_name = "tf_ci_test_new"
100+
vpc_id = "vpc-i5yyodl9"
101+
subnet_id = "subnet-hhi88a58"
108102
}
103+
109104
auto_retry_time_range_minutes = 0
110105
}
111106
```
@@ -146,13 +141,12 @@ data "tencentcloud_mysql_instance" "dst_mysql" {
146141
instance_name = "your_user_name_mysql_src"
147142
}
148143
149-
resource "tencentcloud_dts_sync_config" "sync_config" {
144+
resource "tencentcloud_dts_sync_config" "example" {
150145
job_id = data.tencentcloud_dts_sync_jobs.sync_jobs.list.0.job_id
151146
src_access_type = "ccn"
152147
dst_access_type = "cdb"
153-
154-
job_mode = "liteMode"
155-
run_mode = "Immediate"
148+
job_mode = "liteMode"
149+
run_mode = "Immediate"
156150
157151
objects {
158152
mode = "Partial"
@@ -167,6 +161,7 @@ resource "tencentcloud_dts_sync_config" "sync_config" {
167161
}
168162
}
169163
}
164+
170165
src_info { // shanghai to guangzhou via ccn
171166
region = var.src_az_sh
172167
user = "your_user_name"
@@ -178,21 +173,22 @@ resource "tencentcloud_dts_sync_config" "sync_config" {
178173
ccn_id = local.ccn_id
179174
database_net_env = "TencentVPC"
180175
}
176+
181177
dst_info {
182178
region = var.dst_az_gz
183179
instance_id = local.dst_mysql_id
184180
user = "your_user_name"
185181
password = "your_pass_word"
186182
}
183+
187184
auto_retry_time_range_minutes = 0
188185
}
189-
190186
````
191187
192188
Import
193189
194-
dts sync_config can be imported using the id, e.g.
190+
DTS sync config can be imported using the id, e.g.
195191
196192
```
197-
terraform import tencentcloud_dts_sync_config.sync_config sync_config_id
198-
```
193+
terraform import tencentcloud_dts_sync_config.example sync-muu9ez38
194+
```

0 commit comments

Comments
 (0)