@@ -68,8 +68,8 @@ func TestAccTencentCloudCynosdbClusterResourceBasic(t *testing.T) {
68
68
Check : resource .ComposeTestCheckFunc (
69
69
testAccCheckCynosdbClusterExists ("tencentcloud_cynosdb_cluster.foo" ),
70
70
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "available_zone" , "ap-guangzhou-4" ),
71
- resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "vpc_id" , "vpc-4owdpnwr " ),
72
- resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "subnet_id" , "subnet-qpxez62e " ),
71
+ resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "vpc_id" , "vpc-m0d2dbnn " ),
72
+ resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "subnet_id" , "subnet-j10lsueq " ),
73
73
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "db_type" , "MYSQL" ),
74
74
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "db_version" , "5.7" ),
75
75
// resource.TestCheckResourceAttr("tencentcloud_cynosdb_cluster.foo", "storage_limit", "1000"),
@@ -79,7 +79,7 @@ func TestAccTencentCloudCynosdbClusterResourceBasic(t *testing.T) {
79
79
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_maintain_weekdays.#" , "7" ),
80
80
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_cpu_core" , "1" ),
81
81
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_memory_size" , "2" ),
82
- // resource.TestCheckResourceAttr("tencentcloud_cynosdb_cluster.foo", "tags.test", "test"),
82
+ resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "tags.test" , "test" ),
83
83
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "force_delete" , "true" ),
84
84
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "rw_group_sg.#" , "1" ),
85
85
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "ro_group_sg.#" , "1" ),
@@ -116,22 +116,22 @@ func TestAccTencentCloudCynosdbClusterResourceBasic(t *testing.T) {
116
116
{
117
117
Config : testAccCynosdbCluster_update ,
118
118
Check : resource .ComposeTestCheckFunc (
119
- resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "vpc_id" , "vpc-k1t8ickr " ),
120
- resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "subnet_id" , "subnet-jdi5xn22 " ),
121
- resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_maintain_duration" , "7200 " ),
122
- resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_maintain_start_time" , "21600 " ),
123
- resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_maintain_weekdays.#" , "6 " ),
119
+ resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "vpc_id" , "vpc-m0d2dbnn " ),
120
+ resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "subnet_id" , "subnet-j10lsueq " ),
121
+ resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_maintain_duration" , "3600 " ),
122
+ resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_maintain_start_time" , "10800 " ),
123
+ resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_maintain_weekdays.#" , "7 " ),
124
124
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_cpu_core" , "2" ),
125
125
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_memory_size" , "4" ),
126
126
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "rw_group_sg.#" , "1" ),
127
127
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "ro_group_sg.#" , "1" ),
128
128
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "param_items.#" , "2" ),
129
129
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "param_items.0.name" , "character_set_server" ),
130
130
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "param_items.0.old_value" , "utf8" ),
131
- resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "param_items.0.current_value" , "utf8mb4 " ),
131
+ resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "param_items.0.current_value" , "utf8 " ),
132
132
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "param_items.1.name" , "time_zone" ),
133
133
resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "param_items.1.old_value" , "+09:00" ),
134
- resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "param_items.1.current_value" , "+08 :00" ),
134
+ resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "param_items.1.current_value" , "+09 :00" ),
135
135
),
136
136
},
137
137
},
@@ -238,22 +238,26 @@ func testAccCheckCynosdbClusterExists(n string) resource.TestCheckFunc {
238
238
}
239
239
}
240
240
241
- const testAccCynosdbBasic = tcacctest . DefaultSecurityGroupData + `
241
+ const testAccCynosdbBasic = `
242
242
variable "availability_zone" {
243
243
default = "ap-guangzhou-4"
244
244
}
245
245
246
246
variable "my_vpc" {
247
- default = "vpc-4owdpnwr "
247
+ default = "vpc-m0d2dbnn "
248
248
}
249
249
250
250
variable "my_subnet" {
251
- default = "subnet-qpxez62e "
251
+ default = "subnet-j10lsueq "
252
252
}
253
253
254
254
variable "my_param_template" {
255
255
default = "15765"
256
256
}
257
+
258
+ variable "rw_group_sg" {
259
+ default = "sg-05f7wnhn"
260
+ }
257
261
`
258
262
259
263
const testAccCynosdbCluster = testAccCynosdbBasic + `
@@ -289,70 +293,68 @@ resource "tencentcloud_cynosdb_cluster" "foo" {
289
293
current_value = "+09:00"
290
294
}
291
295
292
- # tags = {
293
- # test = "test"
294
- # }
296
+ tags = {
297
+ test = "test"
298
+ }
295
299
296
300
force_delete = true
297
301
298
302
rw_group_sg = [
299
- local.sg_id
303
+ var.rw_group_sg
300
304
]
301
305
ro_group_sg = [
302
- local.sg_id
306
+ var.rw_group_sg
303
307
]
304
- prarm_template_id = var.my_param_template
308
+ # prarm_template_id = var.my_param_template
305
309
}
306
310
`
307
311
308
312
const testAccCynosdbCluster_update = testAccCynosdbBasic + `
309
313
resource "tencentcloud_cynosdb_cluster" "foo" {
310
314
available_zone = var.availability_zone
311
- vpc_id = "vpc-k1t8ickr"
312
- subnet_id = "subnet-jdi5xn22"
313
- old_ip_reserve_hours = 1
315
+ vpc_id = var.my_vpc
316
+ subnet_id = var.my_subnet
314
317
db_type = "MYSQL"
315
318
db_version = "5.7"
316
319
storage_limit = 1000
317
320
cluster_name = "tf-cynosdb-update"
318
321
password = "cynos@123"
319
- instance_maintain_duration = 7200
320
- instance_maintain_start_time = 21600
322
+ instance_maintain_duration = 3600
323
+ instance_maintain_start_time = 10800
321
324
instance_maintain_weekdays = [
322
325
"Fri",
323
326
"Mon",
324
327
"Sat",
325
328
"Sun",
326
329
"Thu",
330
+ "Wed",
327
331
"Tue",
328
332
]
329
333
330
334
instance_cpu_core = 2
331
335
instance_memory_size = 4
332
-
333
336
param_items {
334
337
name = "character_set_server"
335
- old_value = "utf8"
336
- current_value = "utf8mb4 "
338
+ old_value = "utf8"
339
+ current_value = "utf8 "
337
340
}
338
-
339
341
param_items {
340
342
name = "time_zone"
341
- old_value = "+09:00"
342
- current_value = "+08 :00"
343
+ old_value = "+09:00"
344
+ current_value = "+09 :00"
343
345
}
344
346
345
- # tags = {
346
- # test = "test-update "
347
- # }
347
+ tags = {
348
+ test = "test"
349
+ }
348
350
349
351
force_delete = true
350
352
351
353
rw_group_sg = [
352
- local.sg_id2
354
+ var.rw_group_sg
353
355
]
354
356
ro_group_sg = [
355
- local.sg_id2
357
+ var.rw_group_sg
356
358
]
357
359
}
358
360
`
0 commit comments