@@ -68,8 +68,8 @@ func TestAccTencentCloudCynosdbClusterResourceBasic(t *testing.T) {
6868 Check : resource .ComposeTestCheckFunc (
6969 testAccCheckCynosdbClusterExists ("tencentcloud_cynosdb_cluster.foo" ),
7070 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 " ),
7373 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "db_type" , "MYSQL" ),
7474 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "db_version" , "5.7" ),
7575 // resource.TestCheckResourceAttr("tencentcloud_cynosdb_cluster.foo", "storage_limit", "1000"),
@@ -79,7 +79,7 @@ func TestAccTencentCloudCynosdbClusterResourceBasic(t *testing.T) {
7979 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_maintain_weekdays.#" , "7" ),
8080 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_cpu_core" , "1" ),
8181 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" ),
8383 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "force_delete" , "true" ),
8484 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "rw_group_sg.#" , "1" ),
8585 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "ro_group_sg.#" , "1" ),
@@ -116,22 +116,22 @@ func TestAccTencentCloudCynosdbClusterResourceBasic(t *testing.T) {
116116 {
117117 Config : testAccCynosdbCluster_update ,
118118 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 " ),
124124 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_cpu_core" , "2" ),
125125 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "instance_memory_size" , "4" ),
126126 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "rw_group_sg.#" , "1" ),
127127 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "ro_group_sg.#" , "1" ),
128128 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "param_items.#" , "2" ),
129129 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "param_items.0.name" , "character_set_server" ),
130130 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 " ),
132132 resource .TestCheckResourceAttr ("tencentcloud_cynosdb_cluster.foo" , "param_items.1.name" , "time_zone" ),
133133 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" ),
135135 ),
136136 },
137137 },
@@ -238,22 +238,26 @@ func testAccCheckCynosdbClusterExists(n string) resource.TestCheckFunc {
238238 }
239239}
240240
241- const testAccCynosdbBasic = tcacctest . DefaultSecurityGroupData + `
241+ const testAccCynosdbBasic = `
242242variable "availability_zone" {
243243 default = "ap-guangzhou-4"
244244}
245245
246246variable "my_vpc" {
247- default = "vpc-4owdpnwr "
247+ default = "vpc-m0d2dbnn "
248248}
249249
250250variable "my_subnet" {
251- default = "subnet-qpxez62e "
251+ default = "subnet-j10lsueq "
252252}
253253
254254variable "my_param_template" {
255255 default = "15765"
256256}
257+
258+ variable "rw_group_sg" {
259+ default = "sg-05f7wnhn"
260+ }
257261`
258262
259263const testAccCynosdbCluster = testAccCynosdbBasic + `
@@ -289,70 +293,68 @@ resource "tencentcloud_cynosdb_cluster" "foo" {
289293 current_value = "+09:00"
290294 }
291295
292- # tags = {
293- # test = "test"
294- # }
296+ tags = {
297+ test = "test"
298+ }
295299
296300 force_delete = true
297301
298302 rw_group_sg = [
299- local.sg_id
303+ var.rw_group_sg
300304 ]
301305 ro_group_sg = [
302- local.sg_id
306+ var.rw_group_sg
303307 ]
304- prarm_template_id = var.my_param_template
308+ # prarm_template_id = var.my_param_template
305309}
306310`
307311
308312const testAccCynosdbCluster_update = testAccCynosdbBasic + `
309313resource "tencentcloud_cynosdb_cluster" "foo" {
310314 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
314317 db_type = "MYSQL"
315318 db_version = "5.7"
316319 storage_limit = 1000
317320 cluster_name = "tf-cynosdb-update"
318321 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
321324 instance_maintain_weekdays = [
322325 "Fri",
323326 "Mon",
324327 "Sat",
325328 "Sun",
326329 "Thu",
330+ "Wed",
327331 "Tue",
328332 ]
329333
330334 instance_cpu_core = 2
331335 instance_memory_size = 4
332-
333336 param_items {
334337 name = "character_set_server"
335- old_value = "utf8"
336- current_value = "utf8mb4 "
338+ old_value = "utf8"
339+ current_value = "utf8 "
337340 }
338-
339341 param_items {
340342 name = "time_zone"
341- old_value = "+09:00"
342- current_value = "+08 :00"
343+ old_value = "+09:00"
344+ current_value = "+09 :00"
343345 }
344346
345- # tags = {
346- # test = "test-update "
347- # }
347+ tags = {
348+ test = "test"
349+ }
348350
349351 force_delete = true
350352
351353 rw_group_sg = [
352- local.sg_id2
354+ var.rw_group_sg
353355 ]
354356 ro_group_sg = [
355- local.sg_id2
357+ var.rw_group_sg
356358 ]
357359}
358360`
0 commit comments