@@ -18,16 +18,42 @@ func TestAccTencentCloudCvmRebootInstanceResource_basic(t *testing.T) {
18
18
Steps : []resource.TestStep {
19
19
{
20
20
Config : testAccCvmRebootInstance ,
21
- Check : resource .ComposeTestCheckFunc (resource .TestCheckResourceAttrSet ("tencentcloud_cvm_reboot_instance.reboot_instance" , "id" )),
21
+ Check : resource .ComposeTestCheckFunc (
22
+ resource .TestCheckResourceAttrSet ("tencentcloud_cvm_reboot_instance.reboot" , "id" ),
23
+ ),
22
24
},
23
25
},
24
26
})
25
27
}
26
28
27
- const testAccCvmRebootInstance = tcacctest .DefaultRebootCvmVariable + `
29
+ const testAccCvmRebootInstance = `
30
+ data "tencentcloud_images" "default" {
31
+ image_type = ["PUBLIC_IMAGE"]
32
+ image_name_regex = "Final"
33
+ }
34
+ data "tencentcloud_instance_types" "default" {
35
+ memory_size = 2
36
+ exclude_sold_out = true
37
+ filter {
38
+ name = "instance-family"
39
+ values = ["SA2","SA3","SA4","SA5","S2","S3"]
40
+ }
41
+ filter {
42
+ name = "zone"
43
+ values = ["ap-guangzhou-7"]
44
+ }
45
+ cpu_core_count = 2
46
+ }
47
+ resource "tencentcloud_instance" "test_cvm" {
48
+ image_id = data.tencentcloud_images.default.images.0.image_id
49
+ availability_zone = "ap-guangzhou-7"
50
+ instance_type = "SA2.MEDIUM2"
51
+ orderly_security_groups = ["sg-5275dorp"]
52
+ instance_charge_type = "POSTPAID_BY_HOUR"
53
+ }
28
54
29
- resource " tencentcloud_cvm_reboot_instance" "reboot_instance" {
30
- instance_id = var.cvm_id
31
- stop_type = "SOFT_FIRST "
55
+ resource tencentcloud_cvm_reboot_instance reboot {
56
+ instance_id = tencentcloud_instance.test_cvm.id
57
+ stop_type = "SOFT "
32
58
}
33
59
`
0 commit comments