Skip to content

Commit f8f0bf1

Browse files
committed
update launch template
1 parent dc3ef10 commit f8f0bf1

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

tencentcloud/services/cvm/resource_tc_cvm_launch_template_version.go

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ func ResourceTencentCloudCvmLaunchTemplateVersion() *schema.Resource {
127127
},
128128
"disk_id": {
129129
Type: schema.TypeString,
130-
Optional: true,
131130
Computed: true,
132131
ForceNew: true,
133132
Description: "System disk ID. System disks whose type is LOCAL_BASIC or LOCAL_SSD do not have an ID and do not support this parameter. It is only used as a response parameter for APIs such as DescribeInstances, and cannot be used as a request parameter for APIs such as RunInstances.",
@@ -173,7 +172,6 @@ func ResourceTencentCloudCvmLaunchTemplateVersion() *schema.Resource {
173172
},
174173
"disk_id": {
175174
Type: schema.TypeString,
176-
Optional: true,
177175
Computed: true,
178176
ForceNew: true,
179177
Description: "System disk ID. System disks whose type is LOCAL_BASIC or LOCAL_SSD do not have an ID and do not support this parameter. It is only used as a response parameter for APIs such as DescribeInstances, and cannot be used as a request parameter for APIs such as RunInstances.",
@@ -469,7 +467,7 @@ func ResourceTencentCloudCvmLaunchTemplateVersion() *schema.Resource {
469467
ForceNew: true,
470468
Type: schema.TypeList,
471469
MaxItems: 1,
472-
Description: "Scheduled tasks.",
470+
Description: "Scheduled tasks. You can use this parameter to specify scheduled tasks for the instance. Only scheduled termination is supported.",
473471
Elem: &schema.Resource{
474472
Schema: map[string]*schema.Schema{
475473
"timer_action": {
@@ -781,9 +779,6 @@ func resourceTencentCloudCvmLaunchTemplateVersionCreate(d *schema.ResourceData,
781779
if v, ok := dMap["disk_type"]; ok {
782780
systemDisk.DiskType = helper.String(v.(string))
783781
}
784-
if v, ok := dMap["disk_id"]; ok {
785-
systemDisk.DiskId = helper.String(v.(string))
786-
}
787782
if v, ok := dMap["disk_size"]; ok {
788783
systemDisk.DiskSize = helper.IntInt64(v.(int))
789784
}
@@ -803,9 +798,6 @@ func resourceTencentCloudCvmLaunchTemplateVersionCreate(d *schema.ResourceData,
803798
if v, ok := dMap["disk_type"]; ok {
804799
dataDisk.DiskType = helper.String(v.(string))
805800
}
806-
if v, ok := dMap["disk_id"]; ok {
807-
dataDisk.DiskId = helper.String(v.(string))
808-
}
809801
if v, ok := dMap["delete_with_instance"]; ok {
810802
dataDisk.DeleteWithInstance = helper.Bool(v.(bool))
811803
}
@@ -854,17 +846,17 @@ func resourceTencentCloudCvmLaunchTemplateVersionCreate(d *schema.ResourceData,
854846

855847
if dMap, ok := helper.InterfacesHeadMap(d, "internet_accessible"); ok {
856848
internetAccessible := cvm.InternetAccessible{}
857-
if v, ok := dMap["internet_charge_type"]; ok {
858-
internetAccessible.InternetChargeType = helper.String(v.(string))
849+
if v, ok := dMap["internet_charge_type"].(string); ok && v != "" {
850+
internetAccessible.InternetChargeType = helper.String(v)
859851
}
860852
if v, ok := dMap["internet_max_bandwidth_out"]; ok {
861853
internetAccessible.InternetMaxBandwidthOut = helper.IntInt64(v.(int))
862854
}
863855
if v, ok := dMap["public_ip_assigned"]; ok {
864856
internetAccessible.PublicIpAssigned = helper.Bool(v.(bool))
865857
}
866-
if v, ok := dMap["bandwidth_package_id"]; ok {
867-
internetAccessible.BandwidthPackageId = helper.String(v.(string))
858+
if v, ok := dMap["bandwidth_package_id"].(string); ok && v != "" {
859+
internetAccessible.BandwidthPackageId = helper.String(v)
868860
}
869861
request.InternetAccessible = &internetAccessible
870862
}
@@ -879,8 +871,8 @@ func resourceTencentCloudCvmLaunchTemplateVersionCreate(d *schema.ResourceData,
879871

880872
if dMap, ok := helper.InterfacesHeadMap(d, "login_settings"); ok {
881873
loginSettings := cvm.LoginSettings{}
882-
if v, ok := dMap["password"]; ok {
883-
loginSettings.Password = helper.String(v.(string))
874+
if v, ok := dMap["password"].(string); ok && v != "" {
875+
loginSettings.Password = helper.String(v)
884876
}
885877
if v, ok := dMap["key_ids"]; ok {
886878
keyIdsSet := v.(*schema.Set).List()
@@ -889,8 +881,8 @@ func resourceTencentCloudCvmLaunchTemplateVersionCreate(d *schema.ResourceData,
889881
loginSettings.KeyIds = append(loginSettings.KeyIds, &keyIds)
890882
}
891883
}
892-
if v, ok := dMap["keep_image_login"]; ok {
893-
loginSettings.KeepImageLogin = helper.String(v.(string))
884+
if v, ok := dMap["keep_image_login"].(string); ok && v != "" {
885+
loginSettings.KeepImageLogin = helper.String(v)
894886
}
895887
request.LoginSettings = &loginSettings
896888
}

website/docs/r/cvm_launch_template_version.html.markdown

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The following arguments are supported:
3434

3535
* `launch_template_id` - (Required, String, ForceNew) Instance launch template ID. This parameter is used as a basis for creating new template versions.
3636
* `placement` - (Required, List, ForceNew) Location of the instance. You can use this parameter to specify the attributes of the instance, such as its availability zone, project, and CDH (for dedicated CVMs).
37-
* `action_timer` - (Optional, List, ForceNew) Scheduled tasks.
37+
* `action_timer` - (Optional, List, ForceNew) Scheduled tasks. You can use this parameter to specify scheduled tasks for the instance. Only scheduled termination is supported.
3838
* `cam_role_name` - (Optional, String, ForceNew) The role name of CAM.
3939
* `client_token` - (Optional, String, ForceNew) A unique string supplied by the client to ensure that the request is idempotent. Its maximum length is 64 ASCII characters. If this parameter is not specified, the idem-potency of the request cannot be guaranteed.
4040
* `data_disks` - (Optional, List, ForceNew) The configuration information of instance data disks. If this parameter is not specified, no data disk will be purchased by default.
@@ -76,7 +76,6 @@ The `data_disks` object supports the following:
7676
* `disk_size` - (Required, Int, ForceNew) Data disk size (in GB). The minimum adjustment increment is 10 GB. The value range varies by data disk type.
7777
* `cdc_id` - (Optional, String, ForceNew) ID of the dedicated cluster to which the instance belongs.
7878
* `delete_with_instance` - (Optional, Bool, ForceNew) Whether to terminate the data disk when its CVM is terminated. Default value: `true`.
79-
* `disk_id` - (Optional, String, ForceNew) System disk ID. System disks whose type is LOCAL_BASIC or LOCAL_SSD do not have an ID and do not support this parameter. It is only used as a response parameter for APIs such as DescribeInstances, and cannot be used as a request parameter for APIs such as RunInstances.
8079
* `disk_type` - (Optional, String, ForceNew) The type of data disk.
8180
* `encrypt` - (Optional, Bool, ForceNew) Specifies whether the data disk is encrypted.
8281
* `kms_key_id` - (Optional, String, ForceNew) ID of the custom CMK in the format of UUID or `kms-abcd1234`.
@@ -147,7 +146,6 @@ The `storage_block_attr` object of `externals` supports the following:
147146
The `system_disk` object supports the following:
148147

149148
* `cdc_id` - (Optional, String, ForceNew) ID of the dedicated cluster to which the instance belongs.
150-
* `disk_id` - (Optional, String, ForceNew) System disk ID. System disks whose type is LOCAL_BASIC or LOCAL_SSD do not have an ID and do not support this parameter. It is only used as a response parameter for APIs such as DescribeInstances, and cannot be used as a request parameter for APIs such as RunInstances.
151149
* `disk_size` - (Optional, Int, ForceNew) System disk size; unit: GB; default value: 50 GB.
152150
* `disk_type` - (Optional, String, ForceNew) The type of system disk. Default value: the type of hard disk currently in stock.
153151

0 commit comments

Comments
 (0)