@@ -108,15 +108,13 @@ func TestAccTencentCloudInstanceWithDataDisk(t *testing.T) {
108108 testAccCheckTencentCloudDataSourceID (id ),
109109 testAccCheckTencentCloudInstanceExists (id ),
110110 resource .TestCheckResourceAttr (id , "instance_status" , "RUNNING" ),
111- resource .TestCheckResourceAttr (id , "system_disk_size" , "50 " ),
111+ resource .TestCheckResourceAttr (id , "system_disk_size" , "100 " ),
112112 resource .TestCheckResourceAttr (id , "system_disk_type" , "CLOUD_PREMIUM" ),
113113 resource .TestCheckResourceAttr (id , "data_disks.0.data_disk_type" , "CLOUD_PREMIUM" ),
114114 resource .TestCheckResourceAttr (id , "data_disks.0.data_disk_size" , "100" ),
115115 resource .TestCheckResourceAttr (id , "data_disks.0.data_disk_snapshot_id" , "" ),
116116 resource .TestCheckResourceAttr (id , "data_disks.1.data_disk_type" , "CLOUD_PREMIUM" ),
117117 resource .TestCheckResourceAttr (id , "data_disks.1.data_disk_size" , "100" ),
118- //TODO: snapshot is pre-paid required
119- //resource.TestCheckResourceAttr(id, "data_disks.1.data_disk_snapshot_id", "snap-nvzu3dmh"),
120118 ),
121119 },
122120 {
@@ -132,7 +130,6 @@ func TestAccTencentCloudInstanceWithDataDisk(t *testing.T) {
132130 resource .TestCheckResourceAttr (id , "data_disks.0.data_disk_snapshot_id" , "" ),
133131 resource .TestCheckResourceAttr (id , "data_disks.1.data_disk_type" , "CLOUD_PREMIUM" ),
134132 resource .TestCheckResourceAttr (id , "data_disks.1.data_disk_size" , "150" ),
135- //resource.TestCheckResourceAttr(id, "data_disks.1.data_disk_snapshot_id", "snap-nvzu3dmh"),
136133 ),
137134 },
138135 },
@@ -263,7 +260,7 @@ func TestAccTencentCloudInstanceWithImageLogin(t *testing.T) {
263260
264261 id := "tencentcloud_instance.foo"
265262 resource .Test (t , resource.TestCase {
266- PreCheck : func () { testAccPreCheck ( t ) },
263+ PreCheck : func () { testAccPreCheckCommon ( t , ACCOUNT_TYPE_PREPAY ) },
267264 IDRefreshName : id ,
268265 Providers : testAccProviders ,
269266 CheckDestroy : testAccCheckInstanceDestroy ,
@@ -467,36 +464,6 @@ func TestAccTencentCloudInstanceWithSpotpaid(t *testing.T) {
467464 })
468465}
469466
470- /* Skip prepaid for now
471- func TestAccTencentCloudInstanceWithPrepaidChargeType(t *testing.T) {
472- t.Parallel()
473-
474- id := "tencentcloud_instance.foo"
475- resource.Test(t, resource.TestCase{
476- PreCheck: func() { testAccPreCheck(t) },
477- IDRefreshName: id,
478- Providers: testAccProviders,
479- CheckDestroy: testAccCheckInstanceDestroy,
480- Steps: []resource.TestStep{
481- {
482- Config: testAccTencentCloudInstancePrepaidRenew,
483- Check: resource.ComposeTestCheckFunc(
484- testAccCheckTencentCloudInstanceExists(id),
485- resource.TestCheckResourceAttr(id, "instance_charge_type_prepaid_renew_flag", "NOTIFY_AND_AUTO_RENEW"),
486- ),
487- }, {
488- Config: testAccTencentCloudInstancePrepaidRenewUpdate,
489- Check: resource.ComposeTestCheckFunc(
490- testAccCheckTencentCloudInstanceExists(id),
491- resource.TestCheckResourceAttr(id, "instance_charge_type_prepaid_renew_flag", "NOTIFY_AND_MANUAL_RENEW"),
492- ),
493- },
494- },
495- })
496- }
497-
498- */
499-
500467func testAccCheckTencentCloudInstanceExists (n string ) resource.TestCheckFunc {
501468 return func (s * terraform.State ) error {
502469 logId := getLogId (contextNil )
@@ -608,6 +575,7 @@ resource "tencentcloud_instance" "foo" {
608575 instance_type = data.tencentcloud_instance_types.default.instance_types.0.instance_type
609576
610577 system_disk_type = "CLOUD_PREMIUM"
578+ system_disk_size = 100
611579
612580 data_disks {
613581 data_disk_type = "CLOUD_PREMIUM"
@@ -665,7 +633,6 @@ resource "tencentcloud_instance" "foo" {
665633 availability_zone = data.tencentcloud_availability_zones.default.zones.0.name
666634 image_id = data.tencentcloud_images.default.images.0.image_id
667635 instance_type = data.tencentcloud_instance_types.default.instance_types.0.instance_type
668- internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR"
669636 allocate_public_ip = %s
670637 system_disk_type = "CLOUD_PREMIUM"
671638}
@@ -682,7 +649,6 @@ resource "tencentcloud_instance" "foo" {
682649 availability_zone = data.tencentcloud_availability_zones.default.zones.0.name
683650 image_id = data.tencentcloud_images.default.images.0.image_id
684651 instance_type = data.tencentcloud_instance_types.default.instance_types.0.instance_type
685- internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR"
686652 internet_max_bandwidth_out = %d
687653 allocate_public_ip = %s
688654 system_disk_type = "CLOUD_PREMIUM"
@@ -757,7 +723,6 @@ resource "tencentcloud_instance" "foo" {
757723 availability_zone = data.tencentcloud_availability_zones.default.zones.0.name
758724 image_id = data.tencentcloud_images.zoo.images.0.image_id
759725 instance_type = data.tencentcloud_instance_types.default.instance_types.0.instance_type
760- internet_max_bandwidth_out = 1
761726 keep_image_login = true
762727 system_disk_type = "CLOUD_PREMIUM"
763728}
@@ -872,40 +837,9 @@ resource "tencentcloud_instance" "foo" {
872837 availability_zone = data.tencentcloud_availability_zones.default.zones.0.name
873838 image_id = data.tencentcloud_images.default.images.0.image_id
874839 instance_type = data.tencentcloud_instance_types.default.instance_types.0.instance_type
875- hostname = var.instance_name
876840 system_disk_type = "CLOUD_PREMIUM"
877841 instance_charge_type = "SPOTPAID"
878842 spot_instance_type = "ONE-TIME"
879843 spot_max_price = "0.5"
880844}
881845`
882-
883- const testAccTencentCloudInstancePrepaidRenew = defaultInstanceVariable + `
884- resource "tencentcloud_instance" "foo" {
885- instance_name = var.instance_name
886- availability_zone = data.tencentcloud_availability_zones.default.zones.0.name
887- image_id = data.tencentcloud_images.default.images.0.image_id
888- instance_type = data.tencentcloud_instance_types.default.instance_types.0.instance_type
889- hostname = var.instance_name
890- system_disk_type = "CLOUD_PREMIUM"
891- instance_charge_type = "PREPAID"
892- instance_charge_type_prepaid_renew_flag = "NOTIFY_AND_AUTO_RENEW"
893- instance_charge_type_prepaid_period = 1
894- force_delete = true
895- }
896- `
897-
898- const testAccTencentCloudInstancePrepaidRenewUpdate = defaultInstanceVariable + `
899- resource "tencentcloud_instance" "foo" {
900- instance_name = var.instance_name
901- availability_zone = data.tencentcloud_availability_zones.default.zones.0.name
902- image_id = data.tencentcloud_images.default.images.0.image_id
903- instance_type = data.tencentcloud_instance_types.default.instance_types.0.instance_type
904- hostname = var.instance_name
905- system_disk_type = "CLOUD_PREMIUM"
906- instance_charge_type = "PREPAID"
907- instance_charge_type_prepaid_renew_flag = "NOTIFY_AND_MANUAL_RENEW"
908- instance_charge_type_prepaid_period = 1
909- force_delete = true
910- }
911- `
0 commit comments