@@ -133,6 +133,12 @@ func TencentMsyqlBasicInfo() map[string]*schema.Schema {
133133 Required : true ,
134134 Description : "Memory size (in MB)." ,
135135 },
136+ "cpu" : {
137+ Type : schema .TypeInt ,
138+ Computed : true ,
139+ Optional : true ,
140+ Description : "CPU cores." ,
141+ },
136142 "volume_size" : {
137143 Type : schema .TypeInt ,
138144 Required : true ,
@@ -340,6 +346,13 @@ func mysqlAllInstanceRoleSet(ctx context.Context, requestInter interface{}, d *s
340346 requestByUse .Memory = & memSize
341347 }
342348
349+ cpu := int64 (d .Get ("cpu" ).(int ))
350+ if okByMonth {
351+ requestByMonth .Cpu = & cpu
352+ } else {
353+ requestByUse .Cpu = & cpu
354+ }
355+
343356 volumeSize := int64 (d .Get ("volume_size" ).(int ))
344357 if okByMonth {
345358 requestByMonth .Volume = & volumeSize
@@ -692,6 +705,7 @@ func tencentMsyqlBasicInfoRead(ctx context.Context, d *schema.ResourceData, meta
692705 }
693706 _ = d .Set ("auto_renew_flag" , int (* mysqlInfo .AutoRenew ))
694707 _ = d .Set ("mem_size" , mysqlInfo .Memory )
708+ _ = d .Set ("cpu" , mysqlInfo .Cpu )
695709 _ = d .Set ("volume_size" , mysqlInfo .Volume )
696710 if d .Get ("vpc_id" ).(string ) != "" {
697711 errRet = d .Set ("vpc_id" , mysqlInfo .UniqVpcId )
@@ -907,12 +921,13 @@ func mysqlAllInstanceRoleUpdate(ctx context.Context, d *schema.ResourceData, met
907921 }
908922 }
909923
910- if d .HasChange ("mem_size" ) || d .HasChange ("volume_size" ) {
924+ if d .HasChange ("mem_size" ) || d .HasChange ("cpu" ) || d . HasChange ( " volume_size" ) {
911925
912926 memSize := int64 (d .Get ("mem_size" ).(int ))
927+ cpu := int64 (d .Get ("cpu" ).(int ))
913928 volumeSize := int64 (d .Get ("volume_size" ).(int ))
914929
915- asyncRequestId , err := mysqlService .UpgradeDBInstance (ctx , d .Id (), memSize , volumeSize )
930+ asyncRequestId , err := mysqlService .UpgradeDBInstance (ctx , d .Id (), memSize , cpu , volumeSize )
916931
917932 if err != nil {
918933 return err
@@ -947,6 +962,9 @@ func mysqlAllInstanceRoleUpdate(ctx context.Context, d *schema.ResourceData, met
947962 if d .HasChange ("mem_size" ) {
948963 d .SetPartial ("mem_size" )
949964 }
965+ if d .HasChange ("cpu" ) {
966+ d .SetPartial ("cpu" )
967+ }
950968 if d .HasChange ("volume_size" ) {
951969 d .SetPartial ("volume_size" )
952970 }
0 commit comments