@@ -18,28 +18,95 @@ func TestAccTencentCloudCvmLaunchTemplateVersionResource_basic(t *testing.T) {
18
18
Steps : []resource.TestStep {
19
19
{
20
20
Config : testAccCvmLaunchTemplateVersion ,
21
- Check : resource .ComposeTestCheckFunc (resource .TestCheckResourceAttrSet ("tencentcloud_cvm_launch_template_version.launch_template_version" , "id" )),
22
- },
23
- {
24
- ResourceName : "tencentcloud_cvm_launch_template_version.launch_template_version" ,
25
- ImportState : true ,
26
- ImportStateVerify : true ,
21
+ Check : resource .ComposeTestCheckFunc (resource .TestCheckResourceAttrSet ("tencentcloud_cvm_launch_template_version.test_launch_tpl_v2" , "id" )),
27
22
},
28
23
},
29
24
})
30
25
}
31
26
32
27
const testAccCvmLaunchTemplateVersion = `
33
- resource "tencentcloud_cvm_launch_template_version" "launch_template_version" {
34
- placement {
35
- zone = "ap-guangzhou-6"
36
- project_id = 0
37
-
38
- }
39
- launch_template_id = "lt-9e1znnsa"
40
- launch_template_version_description = "version description"
41
- disable_api_termination = false
42
- instance_type = "S5.MEDIUM4"
43
- image_id = "img-9qrfy1xt"
28
+ data "tencentcloud_images" "default" {
29
+ image_type = ["PUBLIC_IMAGE"]
30
+ image_name_regex = "Final"
31
+ }
32
+ data "tencentcloud_vpc_instances" "vpc" {
33
+ is_default = true
34
+ }
35
+ data "tencentcloud_vpc_subnets" "subnets" {
36
+ availability_zone = "ap-guangzhou-7"
37
+ vpc_id = data.tencentcloud_vpc_instances.vpc.instance_list.0.vpc_id
38
+ }
39
+
40
+ resource "tencentcloud_cvm_launch_template" "test_launch_tpl" {
41
+ launch_template_name = "test"
42
+ image_id = data.tencentcloud_images.default.images.0.image_id
43
+ placement {
44
+ zone = "ap-guangzhou-7"
45
+ }
46
+ instance_name = "v1"
47
+ }
48
+
49
+ resource "tencentcloud_cvm_launch_template_version" "test_launch_tpl_v2" {
50
+ launch_template_id = tencentcloud_cvm_launch_template.test_launch_tpl.id
51
+ placement {
52
+ zone = "ap-guangzhou-7"
53
+ project_id = 0
54
+ }
55
+ launch_template_version_description = "test"
56
+ instance_type = "S5.MEDIUM2"
57
+ image_id = data.tencentcloud_images.default.images.0.image_id
58
+ # system_disk {
59
+ # disk_type = "CLOUD_PREMIUM"
60
+ # disk_size = 20
61
+ # }
62
+ # data_disks {
63
+ # disk_type = "CLOUD_PREMIUM"
64
+ # disk_size = 200
65
+ # }
66
+ virtual_private_cloud {
67
+ vpc_id = data.tencentcloud_vpc_subnets.subnets.instance_list.0.vpc_id
68
+ subnet_id = data.tencentcloud_vpc_subnets.subnets.instance_list.0.subnet_id
69
+ }
70
+ # internet_accessible {
71
+ # internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR"
72
+ # internet_max_bandwidth_out = 20
73
+ # }
74
+ instance_count = 2
75
+ instance_name = "v2"
76
+ security_group_ids = ["sg-5275dorp","sg-cm7fbbf3"]
77
+ enhanced_service {
78
+ security_service {
79
+ enabled = true
80
+ }
81
+ monitor_service {
82
+ enabled = true
83
+ }
84
+ automation_service {
85
+ enabled = false
86
+ }
87
+ }
88
+ client_token = "123"
89
+ host_name = "test"
90
+ disaster_recover_group_ids = []
91
+ tag_specification {
92
+ resource_type = "instance"
93
+ tags {
94
+ key = "key"
95
+ value = "value2"
96
+ }
97
+ tags {
98
+ key = "key2"
99
+ value = "value1"
100
+ }
101
+ }
102
+ user_data = "aGhoCg=="
103
+ cam_role_name = ""
104
+ hpc_cluster_id = ""
105
+ instance_charge_type = "PREPAID"
106
+ instance_charge_prepaid {
107
+ period = 3
108
+ renew_flag = "DISABLE_NOTIFY_AND_MANUAL_RENEW"
109
+ }
110
+ disable_api_termination = true
44
111
}
45
112
`
0 commit comments