@@ -133,6 +133,12 @@ func TencentMsyqlBasicInfo() map[string]*schema.Schema {
133
133
Required : true ,
134
134
Description : "Memory size (in MB)." ,
135
135
},
136
+ "cpu" : {
137
+ Type : schema .TypeInt ,
138
+ Computed : true ,
139
+ Optional : true ,
140
+ Description : "CPU cores." ,
141
+ },
136
142
"volume_size" : {
137
143
Type : schema .TypeInt ,
138
144
Required : true ,
@@ -340,6 +346,13 @@ func mysqlAllInstanceRoleSet(ctx context.Context, requestInter interface{}, d *s
340
346
requestByUse .Memory = & memSize
341
347
}
342
348
349
+ cpu := int64 (d .Get ("cpu" ).(int ))
350
+ if okByMonth {
351
+ requestByMonth .Cpu = & cpu
352
+ } else {
353
+ requestByUse .Cpu = & cpu
354
+ }
355
+
343
356
volumeSize := int64 (d .Get ("volume_size" ).(int ))
344
357
if okByMonth {
345
358
requestByMonth .Volume = & volumeSize
@@ -692,6 +705,7 @@ func tencentMsyqlBasicInfoRead(ctx context.Context, d *schema.ResourceData, meta
692
705
}
693
706
_ = d .Set ("auto_renew_flag" , int (* mysqlInfo .AutoRenew ))
694
707
_ = d .Set ("mem_size" , mysqlInfo .Memory )
708
+ _ = d .Set ("cpu" , mysqlInfo .Cpu )
695
709
_ = d .Set ("volume_size" , mysqlInfo .Volume )
696
710
if d .Get ("vpc_id" ).(string ) != "" {
697
711
errRet = d .Set ("vpc_id" , mysqlInfo .UniqVpcId )
@@ -907,12 +921,13 @@ func mysqlAllInstanceRoleUpdate(ctx context.Context, d *schema.ResourceData, met
907
921
}
908
922
}
909
923
910
- if d .HasChange ("mem_size" ) || d .HasChange ("volume_size" ) {
924
+ if d .HasChange ("mem_size" ) || d .HasChange ("cpu" ) || d . HasChange ( " volume_size" ) {
911
925
912
926
memSize := int64 (d .Get ("mem_size" ).(int ))
927
+ cpu := int64 (d .Get ("cpu" ).(int ))
913
928
volumeSize := int64 (d .Get ("volume_size" ).(int ))
914
929
915
- asyncRequestId , err := mysqlService .UpgradeDBInstance (ctx , d .Id (), memSize , volumeSize )
930
+ asyncRequestId , err := mysqlService .UpgradeDBInstance (ctx , d .Id (), memSize , cpu , volumeSize )
916
931
917
932
if err != nil {
918
933
return err
@@ -947,6 +962,9 @@ func mysqlAllInstanceRoleUpdate(ctx context.Context, d *schema.ResourceData, met
947
962
if d .HasChange ("mem_size" ) {
948
963
d .SetPartial ("mem_size" )
949
964
}
965
+ if d .HasChange ("cpu" ) {
966
+ d .SetPartial ("cpu" )
967
+ }
950
968
if d .HasChange ("volume_size" ) {
951
969
d .SetPartial ("volume_size" )
952
970
}
0 commit comments