@@ -3,6 +3,7 @@ package postgresql_test
3
3
import (
4
4
"testing"
5
5
6
+ "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
6
7
tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
7
8
8
9
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -15,17 +16,12 @@ func TestAccTencentCloudPostgresqlReadonlyInstanceResource_basic(t *testing.T) {
15
16
// t.Parallel()
16
17
resource .Test (t , resource.TestCase {
17
18
PreCheck : func () {
18
- tcacctest .AccStepSetRegion (t , "ap-guangzhou" )
19
- tcacctest .AccPreCheck (t )
19
+ acctest .AccPreCheck (t )
20
20
},
21
21
Providers : tcacctest .AccProviders ,
22
22
Steps : []resource.TestStep {
23
23
{
24
- PreConfig : func () {
25
- tcacctest .AccStepSetRegion (t , "ap-guangzhou" )
26
- tcacctest .AccPreCheckCommon (t , tcacctest .ACCOUNT_TYPE_PREPAY )
27
- },
28
- Config : testAccPostgresqlReadonlyInstanceInstance_basic_without_rogroup ,
24
+ Config : testAccPostgresqlReadonlyInstanceInstance ,
29
25
Check : resource .ComposeTestCheckFunc (
30
26
resource .TestCheckResourceAttrSet (testPostgresqlReadonlyInstanceResourceKey , "id" ),
31
27
resource .TestCheckResourceAttrSet (testPostgresqlReadonlyInstanceResourceKey , "master_db_instance_id" ),
@@ -46,11 +42,7 @@ func TestAccTencentCloudPostgresqlReadonlyInstanceResource_basic(t *testing.T) {
46
42
),
47
43
},
48
44
{
49
- PreConfig : func () {
50
- tcacctest .AccStepSetRegion (t , "ap-guangzhou" )
51
- tcacctest .AccPreCheckCommon (t , tcacctest .ACCOUNT_TYPE_PREPAY )
52
- },
53
- Config : testAccPostgresqlReadonlyInstanceInstance_basic_update_rogroup ,
45
+ Config : testAccPostgresqlReadonlyInstanceInstanceUpdate ,
54
46
Check : resource .ComposeTestCheckFunc (
55
47
resource .TestCheckResourceAttrSet (testPostgresqlReadonlyInstanceResourceKey , "id" ),
56
48
resource .TestCheckResourceAttrSet (testPostgresqlReadonlyInstanceResourceKey , "master_db_instance_id" ),
@@ -74,7 +66,7 @@ func TestAccTencentCloudPostgresqlReadonlyInstanceResource_basic(t *testing.T) {
74
66
})
75
67
}
76
68
77
- const testAccPostgresqlReadonlyInstanceInstance_basic_without_rogroup string = `
69
+ const testAccPostgresqlReadonlyInstanceInstance string = `
78
70
variable "availability_zone" {
79
71
default = "ap-guangzhou-3"
80
72
}
@@ -153,7 +145,7 @@ resource "tencentcloud_postgresql_readonly_instance" "example" {
153
145
}
154
146
`
155
147
156
- const testAccPostgresqlReadonlyInstanceInstance_basic_update_rogroup string = `
148
+ const testAccPostgresqlReadonlyInstanceInstanceUpdate string = `
157
149
variable "availability_zone" {
158
150
default = "ap-guangzhou-3"
159
151
}
@@ -194,7 +186,7 @@ resource "tencentcloud_postgresql_instance" "example" {
194
186
}
195
187
}
196
188
197
- resource "tencentcloud_postgresql_readonly_group" "example_new " {
189
+ resource "tencentcloud_postgresql_readonly_group" "example " {
198
190
master_db_instance_id = tencentcloud_postgresql_instance.example.id
199
191
name = "tf_ro_group"
200
192
project_id = 0
@@ -207,6 +199,19 @@ resource "tencentcloud_postgresql_readonly_group" "example_new" {
207
199
min_delay_eliminate_reserve = 1
208
200
}
209
201
202
+ resource "tencentcloud_postgresql_readonly_group" "example_new" {
203
+ master_db_instance_id = tencentcloud_postgresql_instance.example.id
204
+ name = "tf_ro_group_new"
205
+ project_id = 0
206
+ vpc_id = tencentcloud_vpc.vpc.id
207
+ subnet_id = tencentcloud_subnet.subnet.id
208
+ replay_lag_eliminate = 1
209
+ replay_latency_eliminate = 1
210
+ max_replay_lag = 100
211
+ max_replay_latency = 512
212
+ min_delay_eliminate_reserve = 1
213
+ }
214
+
210
215
resource "tencentcloud_postgresql_readonly_instance" "example" {
211
216
read_only_group_id = tencentcloud_postgresql_readonly_group.example_new.id
212
217
master_db_instance_id = tencentcloud_postgresql_instance.example.id
0 commit comments