Skip to content

Commit 2deb037

Browse files
tongyimingmikatong
and
mikatong
authored
fix(ckafka): [121324902] support elastic_bandwidth_switch (#3051)
* support elastic_bandwidth_switch * add changelog * update --------- Co-authored-by: mikatong <[email protected]>
1 parent e41b59d commit 2deb037

File tree

11 files changed

+3567
-2444
lines changed

11 files changed

+3567
-2444
lines changed

.changelog/3051.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_ckafka_instance: support param `elastic_bandwidth_switch`
3+
```

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ require (
4242
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfw v1.0.1018
4343
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/chdfs v1.0.600
4444
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ciam v1.0.695
45-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748
45+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.1073
4646
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034
4747
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033
4848
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.1046

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ciam v1.0.695 h1:FGwsF1
862862
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ciam v1.0.695/go.mod h1:HAasVoWz8ed6kAg7Q/DTg+8uZXiOgW7lmJeAGGrquEQ=
863863
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748 h1:rVvRHow8cFGJFT31sk3cEVW17a9OewHWhC1acUGNg7c=
864864
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748/go.mod h1:nvb4W+PgsAe8NFG1ZevZa9ZLfto3aeBcJqxzYCRI9V4=
865+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.1073 h1:+nTp32YOtwreGWNjbTHglsnxu5pruPyHOosQ1yN/tkE=
866+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.1073/go.mod h1:D9xdyB3utAtgGwTExSGxHSVQMfVHEUo/bfaBTxjHkao=
865867
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034 h1:nZBr0eJI2iTLSm26QZXNgk4VT3Fxtt+zgXCiCH6avmo=
866868
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034/go.mod h1:q8fxlV0OQPmG3Zqq4f06m+EOqfU8BvZPnVsPCkCdv6E=
867869
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033 h1:dIr+MVsZeUBiKZELfJh5HRJdI+BI6lCp5pv/2oXekuk=

tencentcloud/services/ckafka/resource_tc_ckafka_instance.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,11 @@ func ResourceTencentCloudCkafkaInstance() *schema.Resource {
268268
ValidateFunc: tccommon.ValidateIntegerInRange(1024, 12*1024*1024),
269269
Description: "The size of a single message in bytes at the instance level. Value range: `1024 - 12*1024*1024 bytes (i.e., 1KB-12MB).",
270270
},
271+
"elastic_bandwidth_switch": {
272+
Type: schema.TypeInt,
273+
Optional: true,
274+
Description: "Elastic bandwidth switch 0 not turned on 1 turned on (0 default). This takes effect only when the instance is created.",
275+
},
271276
"vip": {
272277
Type: schema.TypeString,
273278
Computed: true,
@@ -364,6 +369,10 @@ func ckafkaRequestSetParams(request interface{}, d *schema.ResourceData) {
364369
}
365370
values.FieldByName("ZoneIds").Set(reflect.ValueOf(zoneIds))
366371
}
372+
373+
if v, ok := d.GetOk("elastic_bandwidth_switch"); ok {
374+
values.FieldByName("ElasticBandwidthSwitch").Set(reflect.ValueOf(helper.Int64(int64(v.(int)))))
375+
}
367376
}
368377

369378
func createCkafkaInstancePostPaid(ctx context.Context, d *schema.ResourceData, meta interface{}) (instanceId *string, err error) {
@@ -721,7 +730,7 @@ func resourceTencentCloudCkafkaInstanceUpdate(d *schema.ResourceData, meta inter
721730
"zone_id", "period", "vpc_id",
722731
"subnet_id", "renew_flag", "kafka_version",
723732
"multi_zone_flag", "zone_ids", "disk_type",
724-
"specifications_type", "instance_type",
733+
"specifications_type", "instance_type", "elastic_bandwidth_switch",
725734
}
726735

727736
for _, v := range immutableArgs {

tencentcloud/services/ckafka/resource_tc_ckafka_instance_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func TestAccTencentCloudCkafkaInstanceResource_prepaid(t *testing.T) {
3838
resource.TestCheckResourceAttr("tencentcloud_ckafka_instance.kafka_instance", "disk_type", "CLOUD_BASIC"),
3939
resource.TestCheckResourceAttrSet("tencentcloud_ckafka_instance.kafka_instance", "vip"),
4040
resource.TestCheckResourceAttrSet("tencentcloud_ckafka_instance.kafka_instance", "vport"),
41+
resource.TestCheckResourceAttr("tencentcloud_ckafka_instance.kafka_instance", "elastic_bandwidth_switch", "1"),
4142
),
4243
},
4344
{
@@ -54,6 +55,7 @@ func TestAccTencentCloudCkafkaInstanceResource_prepaid(t *testing.T) {
5455
resource.TestCheckResourceAttr("tencentcloud_ckafka_instance.kafka_instance", "kafka_version", "1.1.1"),
5556
resource.TestCheckResourceAttr("tencentcloud_ckafka_instance.kafka_instance", "disk_size", "300"),
5657
resource.TestCheckResourceAttr("tencentcloud_ckafka_instance.kafka_instance", "disk_type", "CLOUD_BASIC"),
58+
resource.TestCheckResourceAttr("tencentcloud_ckafka_instance.kafka_instance", "elastic_bandwidth_switch", "1"),
5759
),
5860
},
5961
{
@@ -63,7 +65,7 @@ func TestAccTencentCloudCkafkaInstanceResource_prepaid(t *testing.T) {
6365
ResourceName: "tencentcloud_ckafka_instance.kafka_instance",
6466
ImportState: true,
6567
ImportStateVerify: true,
66-
ImportStateVerifyIgnore: []string{"period", "max_message_byte", "upgrade_strategy"},
68+
ImportStateVerifyIgnore: []string{"period", "max_message_byte", "upgrade_strategy", "elastic_bandwidth_switch"},
6769
},
6870
},
6971
})
@@ -113,7 +115,7 @@ func TestAccTencentCloudCkafkaInstanceResource_postpaid(t *testing.T) {
113115
ResourceName: "tencentcloud_ckafka_instance.kafka_instance_postpaid",
114116
ImportState: true,
115117
ImportStateVerify: true,
116-
ImportStateVerifyIgnore: []string{"period", "max_message_byte", "upgrade_strategy"},
118+
ImportStateVerifyIgnore: []string{"period", "max_message_byte", "upgrade_strategy", "elastic_bandwidth_switch"},
117119
},
118120
},
119121
})
@@ -257,7 +259,7 @@ resource "tencentcloud_ckafka_instance" "kafka_instance" {
257259
band_width = 20
258260
disk_type = "CLOUD_BASIC"
259261
partition = 400
260-
262+
elastic_bandwidth_switch = 1
261263
262264
config {
263265
auto_create_topic_enable = true
@@ -299,7 +301,7 @@ resource "tencentcloud_ckafka_instance" "kafka_instance" {
299301
band_width = 20
300302
disk_type = "CLOUD_BASIC"
301303
partition = 400
302-
304+
elastic_bandwidth_switch = 1
303305
304306
config {
305307
auto_create_topic_enable = true

0 commit comments

Comments
 (0)