@@ -289,6 +289,49 @@ func resourceTencentCloudCkafkaInstance() *schema.Resource {
289289 Computed : true ,
290290 Description : "Bandwidth of the public network." ,
291291 },
292+ //"dynamic_disk_config": {
293+ // Type: schema.TypeList,
294+ // Optional: true,
295+ // MaxItems: 1,
296+ // Computed: true,
297+ // Elem: &schema.Resource{
298+ // Schema: map[string]*schema.Schema{
299+ // "enable": {
300+ // Type: schema.TypeInt,
301+ // Optional: true,
302+ // Computed: true,
303+ // Description: "Whether to the dynamic disk expansion configuration is enabled." +
304+ // "0: disabled; 1: enabled.",
305+ // },
306+ // "disk_quota_percentage": {
307+ // Type: schema.TypeInt,
308+ // Optional: true,
309+ // Computed: true,
310+ // Description: "Disk quota threshold (in percentage) for triggering the automatic disk expansion event.",
311+ // },
312+ // "step_forward_percentage": {
313+ // Type: schema.TypeInt,
314+ // Optional: true,
315+ // Computed: true,
316+ // Description: "Percentage of dynamic disk expansion each time.",
317+ // },
318+ // "max_disk_space": {
319+ // Type: schema.TypeInt,
320+ // Optional: true,
321+ // Computed: true,
322+ // Description: "Max scale disk size, in GB.",
323+ // },
324+ // },
325+ // },
326+ // Description: "Dynamic disk expansion policy configuration.",
327+ //},
328+ "max_message_byte" : {
329+ Type : schema .TypeInt ,
330+ Optional : true ,
331+ Computed : true ,
332+ ValidateFunc : validateIntegerInRange (1024 , 12 * 1024 * 1024 ),
333+ Description : "The size of a single message in bytes at the instance level. Value range: `1024 - 12*1024*1024 bytes (i.e., 1KB-12MB)." ,
334+ },
292335 "vip" : {
293336 Type : schema .TypeString ,
294337 Computed : true ,
@@ -429,6 +472,7 @@ func resourceTencentCloudCkafkaInstanceCreate(d *schema.ResourceData, meta inter
429472 modifyRequest .InstanceId = instanceId
430473
431474 if v , ok := d .GetOk ("msg_retention_time" ); ok {
475+ needModify = true
432476 retentionTime := int64 (v .(int ))
433477 modifyRequest .MsgRetentionTime = helper .Int64 (retentionTime )
434478 }
@@ -486,10 +530,38 @@ func resourceTencentCloudCkafkaInstanceCreate(d *schema.ResourceData, meta inter
486530 modifyRequest .PublicNetwork = helper .Int64 (int64 (v .(int )))
487531 }
488532
533+ //if v, ok := d.GetOk("dynamic_disk_config"); ok {
534+ // needModify = true
535+ // dynamic := make([]*ckafka.DynamicDiskConfig, 0, 10)
536+ // for _, item := range v.([]interface{}) {
537+ // dMap := item.(map[string]interface{})
538+ // dynamicInfo := ckafka.DynamicDiskConfig{}
539+ // if enable, ok := dMap["enable"]; ok {
540+ // dynamicInfo.Enable = helper.Int64(int64(enable.(int)))
541+ // }
542+ // if stepForwardPercentage, ok := dMap["step_forward_percentage"]; ok {
543+ // dynamicInfo.StepForwardPercentage = helper.Int64(int64(stepForwardPercentage.(int)))
544+ // }
545+ // if diskQuotaPercentage, ok := dMap["disk_quota_percentage"]; ok {
546+ // dynamicInfo.DiskQuotaPercentage = helper.Int64(int64(diskQuotaPercentage.(int)))
547+ // }
548+ // if maxDiskSpace, ok := dMap["max_disk_space"]; ok {
549+ // dynamicInfo.MaxDiskSpace = helper.Int64(int64(maxDiskSpace.(int)))
550+ // }
551+ // dynamic = append(dynamic, &dynamicInfo)
552+ // }
553+ // modifyRequest.DynamicDiskConfig = dynamic[0]
554+ //}
555+
556+ if v , ok := d .GetOkExists ("max_message_byte" ); ok {
557+ needModify = true
558+ modifyRequest .MaxMessageByte = helper .Uint64 (uint64 (v .(int )))
559+ }
560+
489561 if needModify {
490- error := service .ModifyCkafkaInstanceAttributes (ctx , modifyRequest )
491- if error != nil {
492- return fmt .Errorf ("[API]Set kafka instance attributes fail, reason:%s" , error .Error ())
562+ err := service .ModifyCkafkaInstanceAttributes (ctx , modifyRequest )
563+ if err != nil {
564+ return fmt .Errorf ("[API]Set kafka instance attributes fail, reason:%s" , err .Error ())
493565 }
494566 }
495567
@@ -633,6 +705,15 @@ func resourceTencentCloudCkafkaInstanceRead(d *schema.ResourceData, meta interfa
633705 _ = d .Set ("dynamic_retention_config" , dynamicConfig )
634706 _ = d .Set ("public_network" , attr .PublicNetwork )
635707
708+ //dynamicDiskConfig := make([]map[string]interface{}, 0)
709+ //dynamicDiskConfig = append(dynamicDiskConfig, map[string]interface{}{
710+ // "enable": attr.DynamicDiskConfig.Enable,
711+ // "disk_quota_percentage": attr.DynamicDiskConfig.DiskQuotaPercentage,
712+ // "step_forward_percentage": attr.DynamicDiskConfig.StepForwardPercentage,
713+ // "max_disk_space": attr.DynamicDiskConfig.MaxDiskSpace,
714+ //})
715+ //_ = d.Set("dynamic_disk_config", dynamicDiskConfig)
716+
636717 return nil
637718 })
638719 if err != nil {
@@ -729,9 +810,39 @@ func resourceTencentCloudCkafkaInstanceUpdate(d *schema.ResourceData, meta inter
729810 }
730811 }
731812
732- error := service .ModifyCkafkaInstanceAttributes (ctx , request )
733- if error != nil {
734- return fmt .Errorf ("[API]Set kafka instance attributes fail, reason:%s" , error .Error ())
813+ //if d.HasChange("dynamic_disk_config") {
814+ // if v, ok := d.GetOk("dynamic_disk_config"); ok {
815+ // dynamic := make([]*ckafka.DynamicDiskConfig, 0, 10)
816+ // for _, item := range v.([]interface{}) {
817+ // dMap := item.(map[string]interface{})
818+ // dynamicInfo := ckafka.DynamicDiskConfig{}
819+ // if enable, ok := dMap["enable"]; ok {
820+ // dynamicInfo.Enable = helper.Int64(int64(enable.(int)))
821+ // }
822+ // if stepForwardPercentage, ok := dMap["step_forward_percentage"]; ok {
823+ // dynamicInfo.StepForwardPercentage = helper.Int64(int64(stepForwardPercentage.(int)))
824+ // }
825+ // if diskQuotaPercentage, ok := dMap["disk_quota_percentage"]; ok {
826+ // dynamicInfo.DiskQuotaPercentage = helper.Int64(int64(diskQuotaPercentage.(int)))
827+ // }
828+ // if maxDiskSpace, ok := dMap["max_disk_space"]; ok {
829+ // dynamicInfo.MaxDiskSpace = helper.Int64(int64(maxDiskSpace.(int)))
830+ // }
831+ // dynamic = append(dynamic, &dynamicInfo)
832+ // }
833+ // request.DynamicDiskConfig = dynamic[0]
834+ // }
835+ //}
836+
837+ if d .HasChange ("max_message_byte" ) {
838+ if v , ok := d .GetOkExists ("max_message_byte" ); ok {
839+ request .MaxMessageByte = helper .Uint64 (uint64 (v .(int )))
840+ }
841+ }
842+
843+ err := service .ModifyCkafkaInstanceAttributes (ctx , request )
844+ if err != nil {
845+ return fmt .Errorf ("[API]Set kafka instance attributes fail, reason:%s" , err .Error ())
735846 }
736847
737848 if d .HasChange ("band_width" ) || d .HasChange ("disk_size" ) || d .HasChange ("partition" ) {
0 commit comments