@@ -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 }
0 commit comments