Skip to content

Commit 8fef69c

Browse files
authored
fix ckafka backend change (#1308)
1 parent 62c028a commit 8fef69c

10 files changed

+14
-6
lines changed

tencentcloud/data_source_tc_ckafka_acls_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ resource "tencentcloud_ckafka_topic" "kafka_topic_acl" {
4949
unclean_leader_election_enable = false
5050
segment = 86400000
5151
retention = 60000
52+
max_message_bytes = 8388608
5253
}
5354
5455
resource "tencentcloud_ckafka_acl" foo {

tencentcloud/data_source_tc_ckafka_topics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource "tencentcloud_ckafka_topic" "foo" {
1717
unclean_leader_election_enable = false
1818
segment = 3600000
1919
retention = 60000
20-
max_message_bytes = 0
20+
max_message_bytes = 1024
2121
}
2222
```
2323
*/

tencentcloud/data_source_tc_ckafka_topics_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ resource "tencentcloud_ckafka_topic" "kafka_topic" {
5454
unclean_leader_election_enable = false
5555
segment = 86400000
5656
retention = 60000
57+
max_message_bytes = 8388608
5758
}
5859
5960
data "tencentcloud_ckafka_topics" "kafka_topics" {

tencentcloud/extension_ckafka.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ var CKAFKA_PERMISSION_TYPE_TO_STRING = map[int64]string{
7070

7171
//sdk ckafka not found error
7272
const CkafkaInstanceNotFound = "InvalidParameterValue.InstanceNotExist"
73+
const CkafkaFailedOperation = "FailedOperation"

tencentcloud/resource_tc_ckafka_acl_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ resource "tencentcloud_ckafka_topic" "kafka_topic_acl" {
109109
unclean_leader_election_enable = false
110110
segment = 86400000
111111
retention = 60000
112+
max_message_bytes = 8388608
112113
}
113114
114115
resource "tencentcloud_ckafka_acl" foo {

tencentcloud/resource_tc_ckafka_topic.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ func resourceTencentCloudCkafkaTopic() *schema.Resource {
120120
"max_message_bytes": {
121121
Type: schema.TypeInt,
122122
Optional: true,
123-
Description: "Max message bytes.",
123+
Computed: true,
124+
Description: "Max message bytes. min: 1024 Byte(1KB), max: 8388608 Byte(8MB).",
124125
},
125126
"segment": {
126127
Type: schema.TypeInt,
@@ -201,6 +202,9 @@ func resourceTencentCloudCkafkaTopicCreate(d *schema.ResourceData, meta interfac
201202
request.SegmentMs = helper.IntInt64(v.(int))
202203
}
203204
}
205+
if v, ok := d.GetOk("max_message_bytes"); ok {
206+
request.MaxMessageBytes = helper.IntInt64(v.(int))
207+
}
204208
request.InstanceId = &instanceId
205209
request.TopicName = &topicName
206210
request.PartitionNum = helper.IntInt64(d.Get("partition_num").(int))

tencentcloud/resource_tc_ckafka_topic_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ resource "tencentcloud_ckafka_topic" "kafka_topic" {
186186
unclean_leader_election_enable = false
187187
segment = 86400000
188188
retention = 60000
189-
max_message_bytes = 0
189+
max_message_bytes = 1024
190190
}
191191
`
192192

tencentcloud/service_tencentcloud_ckafka.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ func (me *CkafkaService) DescribeInstanceById(ctx context.Context, instanceId st
461461
response, err = me.client.UseCkafkaClient().DescribeInstanceAttributes(request)
462462
if err != nil {
463463
if sdkErr, ok := err.(*errors.TencentCloudSDKError); ok {
464-
if sdkErr.Code == CkafkaInstanceNotFound {
464+
if sdkErr.Code == CkafkaInstanceNotFound || sdkErr.Code == CkafkaFailedOperation {
465465
return nil
466466
}
467467
}

website/docs/d/ckafka_topics.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resource "tencentcloud_ckafka_topic" "foo" {
2727
unclean_leader_election_enable = false
2828
segment = 3600000
2929
retention = 60000
30-
max_message_bytes = 0
30+
max_message_bytes = 1024
3131
}
3232
```
3333

website/docs/r/ckafka_topic.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The following arguments are supported:
4242
* `clean_up_policy` - (Optional, String) Clear log policy, log clear mode, default is `delete`. `delete`: logs are deleted according to the storage time. `compact`: logs are compressed according to the key. `compact, delete`: logs are compressed according to the key and will be deleted according to the storage time.
4343
* `enable_white_list` - (Optional, Bool) Whether to open the ip whitelist, `true`: open, `false`: close.
4444
* `ip_white_list` - (Optional, List: [`String`]) Ip whitelist, quota limit, required when enableWhileList=true.
45-
* `max_message_bytes` - (Optional, Int) Max message bytes.
45+
* `max_message_bytes` - (Optional, Int) Max message bytes. min: 1024 Byte(1KB), max: 8388608 Byte(8MB).
4646
* `note` - (Optional, String) The subject note. It must start with a letter, and the remaining part can contain letters, numbers and dashes (-).
4747
* `retention` - (Optional, Int) Message can be selected. Retention time, unit is ms, the current minimum value is 60000ms.
4848
* `segment` - (Optional, Int) Segment scrolling time, in ms, the current minimum is 3600000ms.

0 commit comments

Comments
 (0)