@@ -201,6 +201,38 @@ func TestAccTencentCloudElasticsearchInstanceResource_kibanaPrivateAccess(t *tes
201201 })
202202}
203203
204+ func TestAccTencentCloudElasticsearchInstanceResource_publicAccess (t * testing.T ) {
205+ t .Parallel ()
206+
207+ resource .Test (t , resource.TestCase {
208+ PreCheck : func () { tcacctest .AccPreCheck (t ) },
209+ Providers : tcacctest .AccProviders ,
210+ CheckDestroy : testAccCheckElasticsearchInstanceDestroy ,
211+ Steps : []resource.TestStep {
212+ {
213+ Config : testAccElasticsearchInstancePublicAccessDefault ,
214+ Check : resource .ComposeTestCheckFunc (
215+ testAccCheckElasticsearchInstanceExists ("tencentcloud_elasticsearch_instance.es_kibana" ),
216+ resource .TestCheckResourceAttr ("tencentcloud_elasticsearch_instance.es_kibana" , "public_access" , "OPEN" ),
217+ resource .TestCheckResourceAttr ("tencentcloud_elasticsearch_instance.es_kibana" , "es_public_acl.#" , "1" ),
218+ resource .TestCheckResourceAttr ("tencentcloud_elasticsearch_instance.es_kibana" , "es_public_acl.0.white_ip_list.#" , "1" ),
219+ resource .TestCheckResourceAttr ("tencentcloud_elasticsearch_instance.es_kibana" , "es_public_acl.0.white_ip_list.0" , "127.0.0.1" ),
220+ ),
221+ },
222+ {
223+ Config : testAccElasticsearchInstanceKibanaPublicAccessUpdate ,
224+ Check : resource .ComposeTestCheckFunc (
225+ testAccCheckElasticsearchInstanceExists ("tencentcloud_elasticsearch_instance.es_kibana" ),
226+ resource .TestCheckResourceAttr ("tencentcloud_elasticsearch_instance.es_kibana" , "public_access" , "OPEN" ),
227+ resource .TestCheckResourceAttr ("tencentcloud_elasticsearch_instance.es_kibana" , "es_public_acl.#" , "1" ),
228+ resource .TestCheckResourceAttr ("tencentcloud_elasticsearch_instance.es_kibana" , "es_public_acl.0.white_ip_list.#" , "1" ),
229+ resource .TestCheckResourceAttr ("tencentcloud_elasticsearch_instance.es_kibana" , "es_public_acl.0.white_ip_list.0" , "127.0.0.2" ),
230+ ),
231+ },
232+ },
233+ })
234+ }
235+
204236func testAccCheckElasticsearchInstanceDestroy (s * terraform.State ) error {
205237 logId := tccommon .GetLogId (tccommon .ContextNil )
206238 ctx := context .WithValue (context .TODO (), tccommon .LogIdKey , logId )
@@ -436,3 +468,61 @@ resource "tencentcloud_elasticsearch_instance" "es_kibana" {
436468 }
437469 }
438470`
471+
472+ const testAccElasticsearchInstancePublicAccessDefault = tcacctest .DefaultEsVariables + `
473+ resource "tencentcloud_elasticsearch_instance" "es_kibana" {
474+ instance_name = "tf-ci-test-kibana"
475+ availability_zone = var.availability_zone
476+ version = "7.10.1"
477+ vpc_id = var.vpc_id
478+ subnet_id = var.subnet_id
479+ password = "Test1234"
480+ license_type = "basic"
481+ basic_security_type = 2
482+ public_access = "OPEN"
483+ es_acl {
484+ white_list = [
485+ "127.0.0.1"
486+ ]
487+ }
488+ es_public_acl {
489+ white_ip_list = [
490+ "127.0.0.1"
491+ ]
492+ }
493+
494+ node_info_list {
495+ node_num = 2
496+ node_type = "ES.S1.MEDIUM4"
497+ }
498+ }
499+ `
500+
501+ const testAccElasticsearchInstanceKibanaPublicAccessUpdate = tcacctest .DefaultEsVariables + `
502+ resource "tencentcloud_elasticsearch_instance" "es_kibana" {
503+ instance_name = "tf-ci-test-kibana"
504+ availability_zone = var.availability_zone
505+ version = "7.10.1"
506+ vpc_id = var.vpc_id
507+ subnet_id = var.subnet_id
508+ password = "Test1234"
509+ license_type = "basic"
510+ basic_security_type = 2
511+ public_access = "OPEN"
512+ es_acl {
513+ white_list = [
514+ "127.0.0.2"
515+ ]
516+ }
517+ es_public_acl {
518+ white_ip_list = [
519+ "127.0.0.2"
520+ ]
521+ }
522+
523+ node_info_list {
524+ node_num = 2
525+ node_type = "ES.S1.MEDIUM4"
526+ }
527+ }
528+ `
0 commit comments