@@ -64,7 +64,7 @@ func testSweepCvmInstance(region string) error {
6464func TestAccTencentCloudInstanceResource_Basic (t * testing.T ) {
6565 t .Parallel ()
6666
67- id := "tencentcloud_instance.foo "
67+ id := "tencentcloud_instance.cvm_basic "
6868 resource .Test (t , resource.TestCase {
6969 PreCheck : func () { testAccPreCheck (t ) },
7070 IDRefreshName : id ,
@@ -564,6 +564,31 @@ func TestAccTencentCloudInstanceResource_WithSpotpaid(t *testing.T) {
564564 })
565565}
566566
567+ func TestAccTencentCloudInstanceResource_DataDiskOrder (t * testing.T ) {
568+ t .Parallel ()
569+
570+ id := "tencentcloud_instance.foo"
571+ resource .Test (t , resource.TestCase {
572+ PreCheck : func () { testAccPreCheck (t ) },
573+ IDRefreshName : id ,
574+ Providers : testAccProviders ,
575+ CheckDestroy : testAccCheckInstanceDestroy ,
576+ Steps : []resource.TestStep {
577+ {
578+ PreConfig : func () { testAccStepPreConfigSetTempAKSK (t , ACCOUNT_TYPE_COMMON ) },
579+ Config : testAccTencentCloudInstanceWithDataDiskOrder ,
580+ Check : resource .ComposeTestCheckFunc (
581+ testAccCheckTencentCloudDataSourceID (id ),
582+ testAccCheckTencentCloudInstanceExists (id ),
583+ resource .TestCheckResourceAttr (id , "data_disks.0.data_disk_size" , "100" ),
584+ resource .TestCheckResourceAttr (id , "data_disks.1.data_disk_size" , "50" ),
585+ resource .TestCheckResourceAttr (id , "data_disks.2.data_disk_size" , "70" ),
586+ ),
587+ },
588+ },
589+ })
590+ }
591+
567592func TestAccTencentCloudNeedFixInstancePostpaidToPrepaid (t * testing.T ) {
568593
569594 id := "tencentcloud_instance.foo"
@@ -698,6 +723,19 @@ func testAccCheckInstanceDestroy(s *terraform.State) error {
698723}
699724
700725const testAccTencentCloudInstanceBasic = defaultInstanceVariable + `
726+ resource "tencentcloud_instance" "cvm_basic" {
727+ instance_name = var.instance_name
728+ availability_zone = var.availability_cvm_zone
729+ image_id = data.tencentcloud_images.default.images.0.image_id
730+ instance_type = data.tencentcloud_instance_types.default.instance_types.0.instance_type
731+ vpc_id = var.cvm_vpc_id
732+ subnet_id = var.cvm_subnet_id
733+ system_disk_type = "CLOUD_PREMIUM"
734+ project_id = 0
735+ }
736+ `
737+
738+ const testAccTencentCloudInstanceWithDataDiskOrder = defaultInstanceVariable + `
701739resource "tencentcloud_instance" "foo" {
702740 instance_name = var.instance_name
703741 availability_zone = var.availability_cvm_zone
@@ -707,6 +745,22 @@ resource "tencentcloud_instance" "foo" {
707745 subnet_id = var.cvm_subnet_id
708746 system_disk_type = "CLOUD_PREMIUM"
709747 project_id = 0
748+
749+ data_disks {
750+ data_disk_size = 100
751+ data_disk_type = "CLOUD_PREMIUM"
752+ delete_with_instance = true
753+ }
754+ data_disks {
755+ data_disk_size = 50
756+ data_disk_type = "CLOUD_PREMIUM"
757+ delete_with_instance = true
758+ }
759+ data_disks {
760+ data_disk_size = 70
761+ data_disk_type = "CLOUD_PREMIUM"
762+ delete_with_instance = true
763+ }
710764}
711765`
712766
@@ -763,7 +817,7 @@ data "tencentcloud_instance_types" "new_type" {
763817 memory_size = 2
764818 }
765819
766- resource "tencentcloud_instance" "foo " {
820+ resource "tencentcloud_instance" "cvm_basic " {
767821 instance_name = var.instance_name
768822 availability_zone = var.availability_cvm_zone
769823 image_id = data.tencentcloud_images.default.images.0.image_id
0 commit comments