Skip to content

fix(CVM): [122656438] update launch template version #3250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3250.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_cvm_launch_template_version: fix some problems
```
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ func ResourceTencentCloudCvmLaunchTemplateVersion() *schema.Resource {
},
"disk_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
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.",
Expand Down Expand Up @@ -173,7 +172,6 @@ func ResourceTencentCloudCvmLaunchTemplateVersion() *schema.Resource {
},
"disk_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
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.",
Expand Down Expand Up @@ -469,7 +467,7 @@ func ResourceTencentCloudCvmLaunchTemplateVersion() *schema.Resource {
ForceNew: true,
Type: schema.TypeList,
MaxItems: 1,
Description: "Scheduled tasks.",
Description: "Scheduled tasks. You can use this parameter to specify scheduled tasks for the instance. Only scheduled termination is supported.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"timer_action": {
Expand Down Expand Up @@ -781,9 +779,6 @@ func resourceTencentCloudCvmLaunchTemplateVersionCreate(d *schema.ResourceData,
if v, ok := dMap["disk_type"]; ok {
systemDisk.DiskType = helper.String(v.(string))
}
if v, ok := dMap["disk_id"]; ok {
systemDisk.DiskId = helper.String(v.(string))
}
if v, ok := dMap["disk_size"]; ok {
systemDisk.DiskSize = helper.IntInt64(v.(int))
}
Expand All @@ -803,9 +798,6 @@ func resourceTencentCloudCvmLaunchTemplateVersionCreate(d *schema.ResourceData,
if v, ok := dMap["disk_type"]; ok {
dataDisk.DiskType = helper.String(v.(string))
}
if v, ok := dMap["disk_id"]; ok {
dataDisk.DiskId = helper.String(v.(string))
}
if v, ok := dMap["delete_with_instance"]; ok {
dataDisk.DeleteWithInstance = helper.Bool(v.(bool))
}
Expand Down Expand Up @@ -854,17 +846,17 @@ func resourceTencentCloudCvmLaunchTemplateVersionCreate(d *schema.ResourceData,

if dMap, ok := helper.InterfacesHeadMap(d, "internet_accessible"); ok {
internetAccessible := cvm.InternetAccessible{}
if v, ok := dMap["internet_charge_type"]; ok {
internetAccessible.InternetChargeType = helper.String(v.(string))
if v, ok := dMap["internet_charge_type"].(string); ok && v != "" {
internetAccessible.InternetChargeType = helper.String(v)
}
if v, ok := dMap["internet_max_bandwidth_out"]; ok {
internetAccessible.InternetMaxBandwidthOut = helper.IntInt64(v.(int))
}
if v, ok := dMap["public_ip_assigned"]; ok {
internetAccessible.PublicIpAssigned = helper.Bool(v.(bool))
}
if v, ok := dMap["bandwidth_package_id"]; ok {
internetAccessible.BandwidthPackageId = helper.String(v.(string))
if v, ok := dMap["bandwidth_package_id"].(string); ok && v != "" {
internetAccessible.BandwidthPackageId = helper.String(v)
}
request.InternetAccessible = &internetAccessible
}
Expand All @@ -879,8 +871,8 @@ func resourceTencentCloudCvmLaunchTemplateVersionCreate(d *schema.ResourceData,

if dMap, ok := helper.InterfacesHeadMap(d, "login_settings"); ok {
loginSettings := cvm.LoginSettings{}
if v, ok := dMap["password"]; ok {
loginSettings.Password = helper.String(v.(string))
if v, ok := dMap["password"].(string); ok && v != "" {
loginSettings.Password = helper.String(v)
}
if v, ok := dMap["key_ids"]; ok {
keyIdsSet := v.(*schema.Set).List()
Expand All @@ -889,8 +881,8 @@ func resourceTencentCloudCvmLaunchTemplateVersionCreate(d *schema.ResourceData,
loginSettings.KeyIds = append(loginSettings.KeyIds, &keyIds)
}
}
if v, ok := dMap["keep_image_login"]; ok {
loginSettings.KeepImageLogin = helper.String(v.(string))
if v, ok := dMap["keep_image_login"].(string); ok && v != "" {
loginSettings.KeepImageLogin = helper.String(v)
}
request.LoginSettings = &loginSettings
}
Expand Down
4 changes: 1 addition & 3 deletions website/docs/r/cvm_launch_template_version.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The following arguments are supported:

* `launch_template_id` - (Required, String, ForceNew) Instance launch template ID. This parameter is used as a basis for creating new template versions.
* `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).
* `action_timer` - (Optional, List, ForceNew) Scheduled tasks.
* `action_timer` - (Optional, List, ForceNew) Scheduled tasks. You can use this parameter to specify scheduled tasks for the instance. Only scheduled termination is supported.
* `cam_role_name` - (Optional, String, ForceNew) The role name of CAM.
* `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.
* `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.
Expand Down Expand Up @@ -76,7 +76,6 @@ The `data_disks` object supports the following:
* `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.
* `cdc_id` - (Optional, String, ForceNew) ID of the dedicated cluster to which the instance belongs.
* `delete_with_instance` - (Optional, Bool, ForceNew) Whether to terminate the data disk when its CVM is terminated. Default value: `true`.
* `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.
* `disk_type` - (Optional, String, ForceNew) The type of data disk.
* `encrypt` - (Optional, Bool, ForceNew) Specifies whether the data disk is encrypted.
* `kms_key_id` - (Optional, String, ForceNew) ID of the custom CMK in the format of UUID or `kms-abcd1234`.
Expand Down Expand Up @@ -147,7 +146,6 @@ The `storage_block_attr` object of `externals` supports the following:
The `system_disk` object supports the following:

* `cdc_id` - (Optional, String, ForceNew) ID of the dedicated cluster to which the instance belongs.
* `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.
* `disk_size` - (Optional, Int, ForceNew) System disk size; unit: GB; default value: 50 GB.
* `disk_type` - (Optional, String, ForceNew) The type of system disk. Default value: the type of hard disk currently in stock.

Expand Down
Loading