@@ -204,7 +204,33 @@ func resourceTencentCloudAsScalingConfig() *schema.Resource {
204204 ValidateFunc : validateAllowedStringValue (SCALING_DISK_TYPE_ALLOW_POLICY ),
205205 Description : "Policy of cloud disk type. Valid values: `ORIGINAL` and `AUTOMATIC`. Default is `ORIGINAL`." ,
206206 },
207-
207+ "cam_role_name" : {
208+ Type : schema .TypeString ,
209+ Optional : true ,
210+ Description : "CAM role name authorized to access." ,
211+ },
212+ "instance_name_settings" : {
213+ Type : schema .TypeList ,
214+ Optional : true ,
215+ MaxItems : 1 ,
216+ Description : "Settings of CVM instance names." ,
217+ Elem : & schema.Resource {
218+ Schema : map [string ]* schema.Schema {
219+ "instance_name" : {
220+ Type : schema .TypeString ,
221+ Required : true ,
222+ Description : "CVM instance name." ,
223+ },
224+ "instance_name_style" : {
225+ Type : schema .TypeString ,
226+ Optional : true ,
227+ ValidateFunc : validateAllowedStringValue (INSTANCE_NAME_STYLE ),
228+ Default : INSTANCE_NAME_ORIGINAL ,
229+ Description : "Type of CVM instance name. Valid values: `ORIGINAL` and `UNIQUE`. Default is `ORIGINAL`." ,
230+ },
231+ },
232+ },
233+ },
208234 // Computed values
209235 "status" : {
210236 Type : schema .TypeString ,
@@ -354,6 +380,26 @@ func resourceTencentCloudAsScalingConfigCreate(d *schema.ResourceData, meta inte
354380 request .DiskTypePolicy = helper .String (v .(string ))
355381 }
356382
383+ if v , ok := d .GetOk ("cam_role_name" ); ok {
384+ request .CamRoleName = helper .String (v .(string ))
385+ }
386+
387+ if v , ok := d .GetOk ("instance_name_settings" ); ok {
388+ settings := make ([]* as.InstanceNameSettings , 0 , 10 )
389+ for _ , item := range v .([]interface {}) {
390+ dMap := item .(map [string ]interface {})
391+ settingsInfo := as.InstanceNameSettings {}
392+ if instanceName , ok := dMap ["instance_name" ]; ok {
393+ settingsInfo .InstanceName = helper .String (instanceName .(string ))
394+ }
395+ if instanceNameStyle , ok := dMap ["instance_name_style" ]; ok {
396+ settingsInfo .InstanceNameStyle = helper .String (instanceNameStyle .(string ))
397+ }
398+ settings = append (settings , & settingsInfo )
399+ }
400+ request .InstanceNameSettings = settings [0 ]
401+ }
402+
357403 response , err := meta .(* TencentCloudClient ).apiV3Conn .UseAsClient ().CreateLaunchConfiguration (request )
358404 if err != nil {
359405 log .Printf ("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n " ,
@@ -408,6 +454,17 @@ func resourceTencentCloudAsScalingConfigRead(d *schema.ResourceData, meta interf
408454 _ = d .Set ("user_data" , helper .PString (config .UserData ))
409455 _ = d .Set ("instance_tags" , flattenInstanceTagsMapping (config .InstanceTags ))
410456 _ = d .Set ("disk_type_policy" , * config .DiskTypePolicy )
457+
458+ _ = d .Set ("cam_role_name" , * config .CamRoleName )
459+ if config .InstanceNameSettings != nil {
460+ settings := make ([]map [string ]interface {}, 0 )
461+ settings = append (settings , map [string ]interface {}{
462+ "instance_name" : config .InstanceNameSettings .InstanceName ,
463+ "instance_name_style" : config .InstanceNameSettings .InstanceNameStyle ,
464+ })
465+ _ = d .Set ("instance_name_settings" , settings )
466+ }
467+
411468 if config .SystemDisk .DiskType != nil {
412469 _ = d .Set ("system_disk_type" , * config .SystemDisk .DiskType )
413470 }
@@ -557,6 +614,26 @@ func resourceTencentCloudAsScalingConfigUpdate(d *schema.ResourceData, meta inte
557614 request .DiskTypePolicy = helper .String (v .(string ))
558615 }
559616
617+ if v , ok := d .GetOk ("cam_role_name" ); ok {
618+ request .CamRoleName = helper .String (v .(string ))
619+ }
620+
621+ if v , ok := d .GetOk ("instance_name_settings" ); ok {
622+ settings := make ([]* as.InstanceNameSettings , 0 , 10 )
623+ for _ , item := range v .([]interface {}) {
624+ dMap := item .(map [string ]interface {})
625+ settingsInfo := as.InstanceNameSettings {}
626+ if instanceName , ok := dMap ["instance_name" ]; ok {
627+ settingsInfo .InstanceName = helper .String (instanceName .(string ))
628+ }
629+ if instanceNameStyle , ok := dMap ["instance_name_style" ]; ok {
630+ settingsInfo .InstanceNameStyle = helper .String (instanceNameStyle .(string ))
631+ }
632+ settings = append (settings , & settingsInfo )
633+ }
634+ request .InstanceNameSettings = settings [0 ]
635+ }
636+
560637 response , err := meta .(* TencentCloudClient ).apiV3Conn .UseAsClient ().UpgradeLaunchConfiguration (request )
561638 if err != nil {
562639 log .Printf ("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n " ,
0 commit comments