@@ -37,6 +37,10 @@ func TestAccTencentCloudPostgresqlReadonlyGroupResource_basic(t *testing.T) {
37
37
resource .TestCheckResourceAttr (testPostgresqlReadonlyGroupResourceKey , "max_replay_lag" , "100" ),
38
38
resource .TestCheckResourceAttr (testPostgresqlReadonlyGroupResourceKey , "max_replay_latency" , "512" ),
39
39
resource .TestCheckResourceAttr (testPostgresqlReadonlyGroupResourceKey , "min_delay_eliminate_reserve" , "1" ),
40
+ resource .TestCheckResourceAttr (testPostgresqlReadonlyGroupResourceKey , "min_delay_eliminate_reserve" , "1" ),
41
+ resource .TestCheckResourceAttrSet (testPostgresqlReadonlyGroupResourceKey , "net_info_list.#" ),
42
+ resource .TestCheckResourceAttrSet (testPostgresqlReadonlyGroupResourceKey , "net_info_list.0.ip" ),
43
+ resource .TestCheckResourceAttr (testPostgresqlReadonlyGroupResourceKey , "net_info_list.0.port" , "5432" ),
40
44
),
41
45
},
42
46
{
@@ -51,15 +55,37 @@ func TestAccTencentCloudPostgresqlReadonlyGroupResource_basic(t *testing.T) {
51
55
resource .TestCheckResourceAttr (testPostgresqlReadonlyGroupResourceKey , "name" , "tf_ro_group_test_updated" ),
52
56
resource .TestCheckResourceAttrSet (testPostgresqlReadonlyGroupResourceKey , "vpc_id" ),
53
57
resource .TestCheckResourceAttrSet (testPostgresqlReadonlyGroupResourceKey , "subnet_id" ),
58
+ resource .TestCheckResourceAttrSet (testPostgresqlReadonlyGroupResourceKey , "net_info_list.#" ),
59
+ resource .TestCheckResourceAttrSet (testPostgresqlReadonlyGroupResourceKey , "net_info_list.0.ip" ),
60
+ resource .TestCheckResourceAttr (testPostgresqlReadonlyGroupResourceKey , "net_info_list.0.port" , "5432" ),
54
61
),
55
62
},
56
63
},
57
64
})
58
65
}
59
66
60
- const testAccPostgresqlReadonlyGroupInstance string = tcacctest .CommonPresetPGSQL + tcacctest .DefaultVpcSubnets + `
67
+ const testAccPostgresqlReadonlyGroupInstance string = tcacctest .DefaultVpcSubnets + `
68
+ resource "tencentcloud_postgresql_instance" "test" {
69
+ name = "example"
70
+ availability_zone = var.default_az
71
+ charge_type = "POSTPAID_BY_HOUR"
72
+ vpc_id = local.vpc_id
73
+ subnet_id = local.subnet_id
74
+ engine_version = "10.4"
75
+ root_user = "root123"
76
+ root_password = "Root123$"
77
+ charset = "UTF8"
78
+ project_id = 0
79
+ memory = 2
80
+ storage = 10
81
+
82
+ tags = {
83
+ test = "tf"
84
+ }
85
+ }
86
+
61
87
resource "tencentcloud_postgresql_readonly_group" "group" {
62
- master_db_instance_id = local.pgsql_id
88
+ master_db_instance_id = tencentcloud_postgresql_instance.test.id
63
89
name = "tf_ro_group_test"
64
90
project_id = 0
65
91
vpc_id = local.vpc_id
@@ -72,8 +98,27 @@ resource "tencentcloud_postgresql_readonly_group" "group" {
72
98
}
73
99
`
74
100
75
- const testAccPostgresqlReadonlyGroupInstance_update string = tcacctest .CommonPresetPGSQL + tcacctest .DefaultVpcSubnets + `
76
- resource "tencentcloud_vpc" "vpc" {
101
+ const testAccPostgresqlReadonlyGroupInstance_update string = tcacctest .DefaultVpcSubnets + `
102
+ resource "tencentcloud_postgresql_instance" "test" {
103
+ name = "example"
104
+ availability_zone = var.default_az
105
+ charge_type = "POSTPAID_BY_HOUR"
106
+ vpc_id = local.vpc_id
107
+ subnet_id = local.subnet_id
108
+ engine_version = "10.4"
109
+ root_user = "root123"
110
+ root_password = "Root123$"
111
+ charset = "UTF8"
112
+ project_id = 0
113
+ memory = 2
114
+ storage = 10
115
+
116
+ tags = {
117
+ test = "tf"
118
+ }
119
+ }
120
+
121
+ resource "tencentcloud_vpc" "vpc" {
77
122
cidr_block = "172.18.111.0/24"
78
123
name = "test-pg-rogroup-network-vpc"
79
124
}
@@ -91,7 +136,7 @@ resource "tencentcloud_vpc" "vpc" {
91
136
}
92
137
93
138
resource "tencentcloud_postgresql_readonly_group" "group" {
94
- master_db_instance_id = local.pgsql_id
139
+ master_db_instance_id = tencentcloud_postgresql_instance.test.id
95
140
name = "tf_ro_group_test_updated"
96
141
project_id = 0
97
142
vpc_id = local.new_vpc_id
0 commit comments