@@ -65,26 +65,29 @@ resource "tencentcloud_instance" "cvm_postpaid" {
6565
6666// Create a PREPAID CVM instance
6767resource "tencentcloud_instance" "cvm_prepaid" {
68- instance_name = "cvm_prepaid"
69- availability_zone = data.tencentcloud_availability_zones.my_favorite_zones.zones.0.name
70- image_id = data.tencentcloud_images.my_favorite_image.images.0.image_id
71- instance_type = data.tencentcloud_instance_types.my_favorite_instance_types.instance_types.0.instance_type
72- system_disk_type = "CLOUD_PREMIUM"
73- system_disk_size = 50
74- hostname = "user"
75- project_id = 0
76- vpc_id = tencentcloud_vpc.app.id
77- subnet_id = tencentcloud_subnet.app.id
78- instance_charge_type = "PREPAID"
79- instance_charge_type_prepaid_period = 1
68+ timeouts {
69+ create = "30m"
70+ }
71+ instance_name = "cvm_prepaid"
72+ availability_zone = data.tencentcloud_availability_zones.my_favorite_zones.zones.0.name
73+ image_id = data.tencentcloud_images.my_favorite_image.images.0.image_id
74+ instance_type = data.tencentcloud_instance_types.my_favorite_instance_types.instance_types.0.instance_type
75+ system_disk_type = "CLOUD_PREMIUM"
76+ system_disk_size = 50
77+ hostname = "user"
78+ project_id = 0
79+ vpc_id = tencentcloud_vpc.app.id
80+ subnet_id = tencentcloud_subnet.app.id
81+ instance_charge_type = "PREPAID"
82+ instance_charge_type_prepaid_period = 1
8083 instance_charge_type_prepaid_renew_flag = "NOTIFY_AND_MANUAL_RENEW"
8184 data_disks {
8285 data_disk_type = "CLOUD_PREMIUM"
8386 data_disk_size = 50
84- encrypt = false
87+ encrypt = false
8588 }
8689 force_delete = true
87- tags = {
90+ tags = {
8891 tagKey = "tagValue"
8992 }
9093}
@@ -127,7 +130,9 @@ func resourceTencentCloudInstance() *schema.Resource {
127130 Importer : & schema.ResourceImporter {
128131 State : schema .ImportStatePassthrough ,
129132 },
130-
133+ Timeouts : & schema.ResourceTimeout {
134+ Create : schema .DefaultTimeout (15 * time .Minute ),
135+ },
131136 Schema : map [string ]* schema.Schema {
132137 "image_id" : {
133138 Type : schema .TypeString ,
@@ -765,7 +770,7 @@ func resourceTencentCloudInstanceCreate(d *schema.ResourceData, meta interface{}
765770 //get system disk ID and data disk ID
766771 var systemDiskId string
767772 var dataDiskIds []string
768- err = resource .Retry (5 * readRetryTimeout , func () * resource.RetryError {
773+ err = resource .Retry (d . Timeout ( schema . TimeoutCreate ) , func () * resource.RetryError {
769774 instance , errRet := cvmService .DescribeInstanceById (ctx , instanceId )
770775 if errRet != nil {
771776 return retryError (errRet , InternalError )
0 commit comments