@@ -128,7 +128,19 @@ func TestAccTencentCloudPostgresqlInstanceResource(t *testing.T) {
128128 ImportStateVerify : true ,
129129 ImportStateVerifyIgnore : []string {"root_password" , "spec_code" , "public_access_switch" , "charset" , "backup_plan" },
130130 },
131-
131+ {
132+ Config : testAccPostgresqlInstanceOpenPublic ,
133+ Check : resource .ComposeTestCheckFunc (
134+ testAccCheckPostgresqlInstanceExists (testPostgresqlInstanceResourceKey ),
135+ resource .TestCheckResourceAttrSet (testPostgresqlInstanceResourceKey , "id" ),
136+ resource .TestCheckResourceAttr (testPostgresqlInstanceResourceKey , "public_access_switch" , "true" ),
137+ resource .TestCheckResourceAttrSet (testPostgresqlInstanceResourceKey , "private_access_ip" ),
138+ resource .TestCheckResourceAttrSet (testPostgresqlInstanceResourceKey , "private_access_port" ),
139+ resource .TestCheckResourceAttrSet (testPostgresqlInstanceResourceKey , "public_access_host" ),
140+ resource .TestCheckResourceAttrSet (testPostgresqlInstanceResourceKey , "public_access_port" ),
141+ //resource.TestCheckResourceAttr(testPostgresqlInstanceResourceKey, "tags.tf", "teest"),
142+ ),
143+ },
132144 {
133145 Config : testAccPostgresqlInstanceUpdate ,
134146 Check : resource .ComposeTestCheckFunc (
@@ -142,13 +154,9 @@ func TestAccTencentCloudPostgresqlInstanceResource(t *testing.T) {
142154 resource .TestCheckResourceAttr (testPostgresqlInstanceResourceKey , "storage" , "250" ),
143155 resource .TestCheckResourceAttrSet (testPostgresqlInstanceResourceKey , "create_time" ),
144156 resource .TestCheckResourceAttr (testPostgresqlInstanceResourceKey , "project_id" , "0" ),
145- resource .TestCheckResourceAttr (testPostgresqlInstanceResourceKey , "public_access_switch" , "true " ),
157+ resource .TestCheckResourceAttr (testPostgresqlInstanceResourceKey , "public_access_switch" , "false " ),
146158 resource .TestCheckResourceAttr (testPostgresqlInstanceResourceKey , "root_password" , "t1qaA2k1wgvfa3?ZZZ" ),
147159 resource .TestCheckResourceAttrSet (testPostgresqlInstanceResourceKey , "availability_zone" ),
148- resource .TestCheckResourceAttrSet (testPostgresqlInstanceResourceKey , "private_access_ip" ),
149- resource .TestCheckResourceAttrSet (testPostgresqlInstanceResourceKey , "private_access_port" ),
150- resource .TestCheckResourceAttrSet (testPostgresqlInstanceResourceKey , "public_access_host" ),
151- resource .TestCheckResourceAttrSet (testPostgresqlInstanceResourceKey , "public_access_port" ),
152160 resource .TestCheckResourceAttr (testPostgresqlInstanceResourceKey , "backup_plan.0.min_backup_start_time" , "01:10:11" ),
153161 resource .TestCheckResourceAttr (testPostgresqlInstanceResourceKey , "backup_plan.0.max_backup_start_time" , "02:10:11" ),
154162 resource .TestCheckResourceAttr (testPostgresqlInstanceResourceKey , "backup_plan.0.backup_period.#" , "3" ),
@@ -280,7 +288,7 @@ resource "tencentcloud_postgresql_instance" "test" {
280288}
281289`
282290
283- const testAccPostgresqlInstanceUpdate string = testAccPostgresqlInstanceBasic + defaultVpcSubnets + `
291+ const testAccPostgresqlInstanceOpenPublic string = testAccPostgresqlInstanceBasic + defaultVpcSubnets + `
284292resource "tencentcloud_postgresql_instance" "test" {
285293 name = "tf_postsql_instance_update"
286294 availability_zone = data.tencentcloud_availability_zones_by_product.zone.zones[5].name
@@ -307,6 +315,33 @@ resource "tencentcloud_postgresql_instance" "test" {
307315}
308316`
309317
318+ const testAccPostgresqlInstanceUpdate string = testAccPostgresqlInstanceBasic + defaultVpcSubnets + `
319+ resource "tencentcloud_postgresql_instance" "test" {
320+ name = "tf_postsql_instance_update"
321+ availability_zone = data.tencentcloud_availability_zones_by_product.zone.zones[5].name
322+ charge_type = "POSTPAID_BY_HOUR"
323+ vpc_id = local.vpc_id
324+ subnet_id = local.subnet_id
325+ engine_version = "10.4"
326+ root_password = "t1qaA2k1wgvfa3?ZZZ"
327+ charset = "LATIN1"
328+ project_id = 0
329+ public_access_switch = false
330+ memory = 4
331+ storage = 250
332+ backup_plan {
333+ min_backup_start_time = "01:10:11"
334+ max_backup_start_time = "02:10:11"
335+ base_backup_retention_period = 5
336+ backup_period = ["monday", "thursday", "sunday"]
337+ }
338+
339+ tags = {
340+ tf = "teest"
341+ }
342+ }
343+ `
344+
310345const testAccPostgresqlMAZInstance string = `
311346resource "tencentcloud_vpc" "vpc" {
312347 cidr_block = "10.0.0.0/24"
0 commit comments