Skip to content

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

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/3254.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_cvm_launch_template: fix some problems
```
18 changes: 6 additions & 12 deletions tencentcloud/services/cvm/resource_tc_cvm_launch_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func ResourceTencentCloudCvmLaunchTemplate() *schema.Resource {
},
"disk_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "System disk ID.",
},
"disk_size": {
Expand Down Expand Up @@ -135,7 +135,7 @@ func ResourceTencentCloudCvmLaunchTemplate() *schema.Resource {
},
"disk_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "Data disk ID.",
},
"delete_with_instance": {
Expand Down Expand Up @@ -665,9 +665,6 @@ func resourceTencentCloudCvmLaunchTemplateCreate(d *schema.ResourceData, meta in
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 @@ -687,9 +684,6 @@ func resourceTencentCloudCvmLaunchTemplateCreate(d *schema.ResourceData, meta in
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 @@ -763,8 +757,8 @@ func resourceTencentCloudCvmLaunchTemplateCreate(d *schema.ResourceData, meta in

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 @@ -773,8 +767,8 @@ func resourceTencentCloudCvmLaunchTemplateCreate(d *schema.ResourceData, meta in
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
2 changes: 0 additions & 2 deletions website/docs/r/cvm_launch_template.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ The `data_disks` object supports the following:
* `disk_size` - (Required, Int) The size of the data disk.
* `cdc_id` - (Optional, String) Cloud Dedicated Cluster(CDC) ID.
* `delete_with_instance` - (Optional, Bool) Whether the data disk is destroyed along with the instance, true or false.
* `disk_id` - (Optional, String) Data disk ID.
* `disk_type` - (Optional, String) The type of data disk.
* `encrypt` - (Optional, Bool) Whether the data disk is encrypted, TRUE or FALSE.
* `kms_key_id` - (Optional, String) The id of custom CMK.
Expand Down Expand Up @@ -148,7 +147,6 @@ The `storage_block_attr` object of `externals` supports the following:
The `system_disk` object supports the following:

* `cdc_id` - (Optional, String) Cloud Dedicated Cluster(CDC) ID.
* `disk_id` - (Optional, String) System disk ID.
* `disk_size` - (Optional, Int) The size of system disk.
* `disk_type` - (Optional, String) The type of system disk.

Expand Down
Loading