Skip to content

Commit ec1cba8

Browse files
authored
fix(CVM): [122656438] update launch template (#3254)
* update cvm template * update cvm template
1 parent 51d14e2 commit ec1cba8

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

.changelog/3254.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_cvm_launch_template: fix some problems
3+
```

tencentcloud/services/cvm/resource_tc_cvm_launch_template.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func ResourceTencentCloudCvmLaunchTemplate() *schema.Resource {
9999
},
100100
"disk_id": {
101101
Type: schema.TypeString,
102-
Optional: true,
102+
Computed: true,
103103
Description: "System disk ID.",
104104
},
105105
"disk_size": {
@@ -135,7 +135,7 @@ func ResourceTencentCloudCvmLaunchTemplate() *schema.Resource {
135135
},
136136
"disk_id": {
137137
Type: schema.TypeString,
138-
Optional: true,
138+
Computed: true,
139139
Description: "Data disk ID.",
140140
},
141141
"delete_with_instance": {
@@ -665,9 +665,6 @@ func resourceTencentCloudCvmLaunchTemplateCreate(d *schema.ResourceData, meta in
665665
if v, ok := dMap["disk_type"]; ok {
666666
systemDisk.DiskType = helper.String(v.(string))
667667
}
668-
if v, ok := dMap["disk_id"]; ok {
669-
systemDisk.DiskId = helper.String(v.(string))
670-
}
671668
if v, ok := dMap["disk_size"]; ok {
672669
systemDisk.DiskSize = helper.IntInt64(v.(int))
673670
}
@@ -687,9 +684,6 @@ func resourceTencentCloudCvmLaunchTemplateCreate(d *schema.ResourceData, meta in
687684
if v, ok := dMap["disk_type"]; ok {
688685
dataDisk.DiskType = helper.String(v.(string))
689686
}
690-
if v, ok := dMap["disk_id"]; ok {
691-
dataDisk.DiskId = helper.String(v.(string))
692-
}
693687
if v, ok := dMap["delete_with_instance"]; ok {
694688
dataDisk.DeleteWithInstance = helper.Bool(v.(bool))
695689
}
@@ -763,8 +757,8 @@ func resourceTencentCloudCvmLaunchTemplateCreate(d *schema.ResourceData, meta in
763757

764758
if dMap, ok := helper.InterfacesHeadMap(d, "login_settings"); ok {
765759
loginSettings := cvm.LoginSettings{}
766-
if v, ok := dMap["password"]; ok {
767-
loginSettings.Password = helper.String(v.(string))
760+
if v, ok := dMap["password"].(string); ok && v != "" {
761+
loginSettings.Password = helper.String(v)
768762
}
769763
if v, ok := dMap["key_ids"]; ok {
770764
keyIdsSet := v.(*schema.Set).List()
@@ -773,8 +767,8 @@ func resourceTencentCloudCvmLaunchTemplateCreate(d *schema.ResourceData, meta in
773767
loginSettings.KeyIds = append(loginSettings.KeyIds, &keyIds)
774768
}
775769
}
776-
if v, ok := dMap["keep_image_login"]; ok {
777-
loginSettings.KeepImageLogin = helper.String(v.(string))
770+
if v, ok := dMap["keep_image_login"].(string); ok && v != "" {
771+
loginSettings.KeepImageLogin = helper.String(v)
778772
}
779773
request.LoginSettings = &loginSettings
780774
}

website/docs/r/cvm_launch_template.html.markdown

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ The `data_disks` object supports the following:
7777
* `disk_size` - (Required, Int) The size of the data disk.
7878
* `cdc_id` - (Optional, String) Cloud Dedicated Cluster(CDC) ID.
7979
* `delete_with_instance` - (Optional, Bool) Whether the data disk is destroyed along with the instance, true or false.
80-
* `disk_id` - (Optional, String) Data disk ID.
8180
* `disk_type` - (Optional, String) The type of data disk.
8281
* `encrypt` - (Optional, Bool) Whether the data disk is encrypted, TRUE or FALSE.
8382
* `kms_key_id` - (Optional, String) The id of custom CMK.
@@ -148,7 +147,6 @@ The `storage_block_attr` object of `externals` supports the following:
148147
The `system_disk` object supports the following:
149148

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

0 commit comments

Comments
 (0)