Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ckafka): [121324902] support elastic_bandwidth_switch #3051

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3051.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_ckafka_instance: support param `elastic_bandwidth_switch`
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfw v1.0.1018
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/chdfs v1.0.600
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ciam v1.0.695
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.1073
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.1046
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ciam v1.0.695 h1:FGwsF1
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ciam v1.0.695/go.mod h1:HAasVoWz8ed6kAg7Q/DTg+8uZXiOgW7lmJeAGGrquEQ=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748 h1:rVvRHow8cFGJFT31sk3cEVW17a9OewHWhC1acUGNg7c=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.748/go.mod h1:nvb4W+PgsAe8NFG1ZevZa9ZLfto3aeBcJqxzYCRI9V4=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.1073 h1:+nTp32YOtwreGWNjbTHglsnxu5pruPyHOosQ1yN/tkE=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.1073/go.mod h1:D9xdyB3utAtgGwTExSGxHSVQMfVHEUo/bfaBTxjHkao=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034 h1:nZBr0eJI2iTLSm26QZXNgk4VT3Fxtt+zgXCiCH6avmo=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034/go.mod h1:q8fxlV0OQPmG3Zqq4f06m+EOqfU8BvZPnVsPCkCdv6E=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033 h1:dIr+MVsZeUBiKZELfJh5HRJdI+BI6lCp5pv/2oXekuk=
Expand Down
11 changes: 10 additions & 1 deletion tencentcloud/services/ckafka/resource_tc_ckafka_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ func ResourceTencentCloudCkafkaInstance() *schema.Resource {
ValidateFunc: tccommon.ValidateIntegerInRange(1024, 12*1024*1024),
Description: "The size of a single message in bytes at the instance level. Value range: `1024 - 12*1024*1024 bytes (i.e., 1KB-12MB).",
},
"elastic_bandwidth_switch": {
Type: schema.TypeInt,
Optional: true,
Description: "Elastic bandwidth switch 0 not turned on 1 turned on (0 default). This takes effect only when the instance is created.",
},
"vip": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -364,6 +369,10 @@ func ckafkaRequestSetParams(request interface{}, d *schema.ResourceData) {
}
values.FieldByName("ZoneIds").Set(reflect.ValueOf(zoneIds))
}

if v, ok := d.GetOk("elastic_bandwidth_switch"); ok {
values.FieldByName("ElasticBandwidthSwitch").Set(reflect.ValueOf(helper.Int64(int64(v.(int)))))
}
}

func createCkafkaInstancePostPaid(ctx context.Context, d *schema.ResourceData, meta interface{}) (instanceId *string, err error) {
Expand Down Expand Up @@ -721,7 +730,7 @@ func resourceTencentCloudCkafkaInstanceUpdate(d *schema.ResourceData, meta inter
"zone_id", "period", "vpc_id",
"subnet_id", "renew_flag", "kafka_version",
"multi_zone_flag", "zone_ids", "disk_type",
"specifications_type", "instance_type",
"specifications_type", "instance_type", "elastic_bandwidth_switch",
}

for _, v := range immutableArgs {
Expand Down
10 changes: 6 additions & 4 deletions tencentcloud/services/ckafka/resource_tc_ckafka_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestAccTencentCloudCkafkaInstanceResource_prepaid(t *testing.T) {
resource.TestCheckResourceAttr("tencentcloud_ckafka_instance.kafka_instance", "disk_type", "CLOUD_BASIC"),
resource.TestCheckResourceAttrSet("tencentcloud_ckafka_instance.kafka_instance", "vip"),
resource.TestCheckResourceAttrSet("tencentcloud_ckafka_instance.kafka_instance", "vport"),
resource.TestCheckResourceAttr("tencentcloud_ckafka_instance.kafka_instance", "elastic_bandwidth_switch", "1"),
),
},
{
Expand All @@ -54,6 +55,7 @@ func TestAccTencentCloudCkafkaInstanceResource_prepaid(t *testing.T) {
resource.TestCheckResourceAttr("tencentcloud_ckafka_instance.kafka_instance", "kafka_version", "1.1.1"),
resource.TestCheckResourceAttr("tencentcloud_ckafka_instance.kafka_instance", "disk_size", "300"),
resource.TestCheckResourceAttr("tencentcloud_ckafka_instance.kafka_instance", "disk_type", "CLOUD_BASIC"),
resource.TestCheckResourceAttr("tencentcloud_ckafka_instance.kafka_instance", "elastic_bandwidth_switch", "1"),
),
},
{
Expand All @@ -63,7 +65,7 @@ func TestAccTencentCloudCkafkaInstanceResource_prepaid(t *testing.T) {
ResourceName: "tencentcloud_ckafka_instance.kafka_instance",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"period", "max_message_byte", "upgrade_strategy"},
ImportStateVerifyIgnore: []string{"period", "max_message_byte", "upgrade_strategy", "elastic_bandwidth_switch"},
},
},
})
Expand Down Expand Up @@ -113,7 +115,7 @@ func TestAccTencentCloudCkafkaInstanceResource_postpaid(t *testing.T) {
ResourceName: "tencentcloud_ckafka_instance.kafka_instance_postpaid",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"period", "max_message_byte", "upgrade_strategy"},
ImportStateVerifyIgnore: []string{"period", "max_message_byte", "upgrade_strategy", "elastic_bandwidth_switch"},
},
},
})
Expand Down Expand Up @@ -257,7 +259,7 @@ resource "tencentcloud_ckafka_instance" "kafka_instance" {
band_width = 20
disk_type = "CLOUD_BASIC"
partition = 400

elastic_bandwidth_switch = 1

config {
auto_create_topic_enable = true
Expand Down Expand Up @@ -299,7 +301,7 @@ resource "tencentcloud_ckafka_instance" "kafka_instance" {
band_width = 20
disk_type = "CLOUD_BASIC"
partition = 400

elastic_bandwidth_switch = 1

config {
auto_create_topic_enable = true
Expand Down
Loading
Loading