@@ -253,8 +253,7 @@ func resourceTencentCloudCkafkaTopicRead(d *schema.ResourceData, meta interface{
253253 }
254254 items := strings .Split (d .Id (), FILED_SP )
255255 if len (items ) < 2 {
256- d .SetId ("" )
257- return nil
256+ return fmt .Errorf ("id is broken,%s" , d .Id ())
258257 }
259258 instanceId := items [0 ]
260259 topicName := items [1 ]
@@ -314,9 +313,16 @@ func resourceTencentCloudCkafkaTopicUpdate(d *schema.ResourceData, meta interfac
314313 ckafkcService := CkafkaService {
315314 client : meta .(* TencentCloudClient ).apiV3Conn ,
316315 }
316+
317+ items := strings .Split (d .Id (), FILED_SP )
318+ if len (items ) < 2 {
319+ return fmt .Errorf ("id is broken,%s" , d .Id ())
320+ }
321+ instanceId := items [0 ]
322+ topicName := items [1 ]
323+
317324 request := ckafka .NewModifyTopicAttributesRequest ()
318- instanceId := d .Get ("instance_id" ).(string )
319- topicName := d .Get ("topic_name" ).(string )
325+ replicaNum := d .Get ("replica_num" ).(int )
320326 whiteListSwitch := d .Get ("enable_white_list" ).(bool )
321327 cleanUpPolicy := d .Get ("clean_up_policy" ).(string )
322328 retention := d .Get ("retention" ).(int )
@@ -332,6 +338,7 @@ func resourceTencentCloudCkafkaTopicUpdate(d *schema.ResourceData, meta interfac
332338 }
333339 request .InstanceId = & instanceId
334340 request .TopicName = & topicName
341+ request .ReplicaNum = helper .IntInt64 (replicaNum )
335342 request .EnableWhiteList = helper .BoolToInt64Ptr (whiteListSwitch )
336343 request .MinInsyncReplicas = helper .IntInt64 (d .Get ("sync_replica_min_num" ).(int ))
337344 request .UncleanLeaderElectionEnable = helper .BoolToInt64Ptr (d .Get ("unclean_leader_election_enable" ).(bool ))
@@ -393,8 +400,12 @@ func resourceTencentCLoudCkafkaTopicDelete(d *schema.ResourceData, meta interfac
393400 ckafkcService := CkafkaService {
394401 client : meta .(* TencentCloudClient ).apiV3Conn ,
395402 }
396- instanceId := d .Get ("instance_id" ).(string )
397- topicName := d .Get ("topic_name" ).(string )
403+ items := strings .Split (d .Id (), FILED_SP )
404+ if len (items ) < 2 {
405+ return fmt .Errorf ("id is broken,%s" , d .Id ())
406+ }
407+ instanceId := items [0 ]
408+ topicName := items [1 ]
398409
399410 err := ckafkcService .DeleteCkafkaTopic (ctx , instanceId , topicName )
400411 if err != nil {
0 commit comments