Skip to content

Commit d9e23ae

Browse files
author
hellertang
authored
fix ckafka (#974)
1 parent bf0fd4f commit d9e23ae

7 files changed

+80
-48
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 1.69.1 (April 19, 2022)
2+
3+
BUGFIXES:
4+
5+
* resource `tencentcloud_ckafka_instance` plan change
6+
* resource `tencentcloud_mysql_instance` ignore lowercase when 8.0
7+
18
## 1.69.0 (April 19, 2022)
29

310
FEATURES:

tencentcloud/data_source_tc_ckafka_acls_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
77
)
88

9-
func TestAccTencentCloudDataSourceCkafkaAcls(t *testing.T) {
9+
func TestAccTencentCloudCkafkaAclsDataSource(t *testing.T) {
1010
t.Parallel()
1111
resource.Test(t, resource.TestCase{
1212
PreCheck: func() { testAccPreCheck(t) },

tencentcloud/data_source_tc_ckafka_users_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
77
)
88

9-
func TestAccTencentCloudDataSourceCkafkaUsers(t *testing.T) {
9+
func TestAccTencentCloudCkafkaUsersDataSource(t *testing.T) {
1010
t.Parallel()
1111
resource.Test(t, resource.TestCase{
1212
PreCheck: func() { testAccPreCheck(t) },

tencentcloud/resource_tc_ckafka_instance.go

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,24 @@ Example Usage
77
88
```hcl
99
resource "tencentcloud_ckafka_instance" "foo" {
10-
instance_name = "demo-hello"
11-
zone_id = 100006
10+
band_width = 40
11+
disk_size = 500
12+
disk_type = "CLOUD_BASIC"
1213
period = 1
13-
vpc_id = "vpc-boi1ah65"
14-
subnet_id = "subnet-7ros461e"
14+
instance_name = "ckafka-instance-tf-test"
15+
kafka_version = "1.1.1"
1516
msg_retention_time = 1300
17+
multi_zone_flag = true
18+
partition = 800
19+
public_network = 3
1620
renew_flag = 0
17-
kafka_version = "1.1.1"
18-
disk_size = 500
19-
disk_type = "CLOUD_BASIC"
20-
21+
subnet_id = "subnet-4vwihrzk"
22+
vpc_id = "vpc-82p1t1nv"
23+
zone_id = 100006
24+
zone_ids = [
25+
100006,
26+
100007,
27+
]
2128
2229
config {
2330
auto_create_topic_enable = true
@@ -26,7 +33,10 @@ resource "tencentcloud_ckafka_instance" "foo" {
2633
}
2734
2835
dynamic_retention_config {
29-
enable = 1
36+
bottom_retention = 0
37+
disk_quota_percentage = 0
38+
enable = 1
39+
step_forward_percentage = 0
3040
}
3141
}
3242
```
@@ -88,7 +98,7 @@ func resourceTencentCloudCkafkaInstance() *schema.Resource {
8898
},
8999
"period": {
90100
Type: schema.TypeInt,
91-
Required: true,
101+
Optional: true,
92102
ForceNew: true,
93103
Description: "Prepaid purchase time, such as 1, is one month.",
94104
},
@@ -127,26 +137,29 @@ func resourceTencentCloudCkafkaInstance() *schema.Resource {
127137
ForceNew: true,
128138
Description: "Kafka version (0.10.2/1.1.1/2.4.1).",
129139
},
130-
"disk_size": {
131-
Type: schema.TypeInt,
132-
Optional: true,
133-
Computed: true,
134-
ForceNew: true,
135-
Description: "Disk Size.",
136-
},
137140
"band_width": {
138-
Type: schema.TypeInt,
139-
Optional: true,
140-
Computed: true,
141-
ForceNew: true,
142-
Description: "Instance bandwidth in Mbps.",
141+
Type: schema.TypeInt,
142+
Optional: true,
143+
Computed: true,
144+
ForceNew: true,
145+
ValidateFunc: validateIntegerInRange(40, 1200),
146+
Description: "Instance bandwidth in MBps. interval:40-1200.",
147+
},
148+
"disk_size": {
149+
Type: schema.TypeInt,
150+
Optional: true,
151+
Computed: true,
152+
ForceNew: true,
153+
Description: "Disk Size. Its interval varies with bandwidth, and the input must be within the interval, which can be viewed through the control. " +
154+
"If it is not within the interval, the plan will cause a change when first created.",
143155
},
144156
"partition": {
145-
Type: schema.TypeInt,
146-
Optional: true,
147-
Computed: true,
148-
ForceNew: true,
149-
Description: "Partition size, the professional version does not need set.",
157+
Type: schema.TypeInt,
158+
Optional: true,
159+
Computed: true,
160+
ForceNew: true,
161+
Description: "Partition Size. Its interval varies with bandwidth, and the input must be within the interval, which can be viewed through the control. " +
162+
"If it is not within the interval, the plan will cause a change when first created.",
150163
},
151164
"multi_zone_flag": {
152165
Type: schema.TypeBool,
@@ -484,16 +497,17 @@ func resourceTencentCloudCkafkaInstanceRead(d *schema.ResourceData, meta interfa
484497
_ = d.Set("instance_name", info.InstanceName)
485498
_ = d.Set("zone_id", info.ZoneId)
486499
// calculate period
487-
createTime := *info.CreateTime
488-
expireTime := *info.ExpireTime
489-
period := (expireTime - createTime) / (3600 * 24 * 31)
490-
_ = d.Set("period", &period)
500+
//createTime := *info.CreateTime
501+
//expireTime := *info.ExpireTime
502+
//period := (expireTime - createTime) / (3600 * 24 * 31)
503+
//_ = d.Set("period", &period)
491504
_ = d.Set("vpc_id", info.VpcId)
492505
_ = d.Set("subnet_id", info.SubnetId)
493506
_ = d.Set("renew_flag", info.RenewFlag)
494507
_ = d.Set("kafka_version", info.Version)
495508
_ = d.Set("disk_size", info.DiskSize)
496-
_ = d.Set("band_width", info.Bandwidth)
509+
bandWidth := info.Bandwidth
510+
_ = d.Set("band_width", *bandWidth/8)
497511
_ = d.Set("partition", info.MaxPartitionNumber)
498512

499513
if len(info.ZoneIds) > 0 {

tencentcloud/resource_tc_ckafka_instance_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/hashicorp/terraform-plugin-sdk/terraform"
1010
)
1111

12-
func TestAccTencentCloudKafkaInstance(t *testing.T) {
12+
func TestAccTencentCloudCKafkaInstance(t *testing.T) {
1313
t.Parallel()
1414
resource.Test(t, resource.TestCase{
1515
PreCheck: func() { testAccPreCheck(t) },

tencentcloud/resource_tc_ckafka_topic_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/hashicorp/terraform-plugin-sdk/terraform"
1111
)
1212

13-
func TestAccTencentCloudKafkaTopic(t *testing.T) {
13+
func TestAccTencentCloudCKafkaTopic(t *testing.T) {
1414
t.Parallel()
1515
resource.Test(t, resource.TestCase{
1616
PreCheck: func() { testAccPreCheck(t) },

website/docs/r/ckafka_instance.html.markdown

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,24 @@ Use this resource to create ckafka instance.
1717

1818
```hcl
1919
resource "tencentcloud_ckafka_instance" "foo" {
20-
instance_name = "demo-hello"
21-
zone_id = 100006
20+
band_width = 40
21+
disk_size = 500
22+
disk_type = "CLOUD_BASIC"
2223
period = 1
23-
vpc_id = "vpc-boi1ah65"
24-
subnet_id = "subnet-7ros461e"
24+
instance_name = "ckafka-instance-tf-test"
25+
kafka_version = "1.1.1"
2526
msg_retention_time = 1300
27+
multi_zone_flag = true
28+
partition = 800
29+
public_network = 3
2630
renew_flag = 0
27-
kafka_version = "1.1.1"
28-
disk_size = 500
29-
disk_type = "CLOUD_BASIC"
31+
subnet_id = "subnet-4vwihrzk"
32+
vpc_id = "vpc-82p1t1nv"
33+
zone_id = 100006
34+
zone_ids = [
35+
100006,
36+
100007,
37+
]
3038
3139
config {
3240
auto_create_topic_enable = true
@@ -35,7 +43,10 @@ resource "tencentcloud_ckafka_instance" "foo" {
3543
}
3644
3745
dynamic_retention_config {
38-
enable = 1
46+
bottom_retention = 0
47+
disk_quota_percentage = 0
48+
enable = 1
49+
step_forward_percentage = 0
3950
}
4051
}
4152
```
@@ -45,19 +56,19 @@ resource "tencentcloud_ckafka_instance" "foo" {
4556
The following arguments are supported:
4657

4758
* `instance_name` - (Required) Instance name.
48-
* `period` - (Required, ForceNew) Prepaid purchase time, such as 1, is one month.
4959
* `subnet_id` - (Required, ForceNew) Subnet id.
5060
* `vpc_id` - (Required, ForceNew) Vpc id.
5161
* `zone_id` - (Required, ForceNew) Available zone id.
52-
* `band_width` - (Optional, ForceNew) Instance bandwidth in Mbps.
62+
* `band_width` - (Optional, ForceNew) Instance bandwidth in MBps. interval:40-1200.
5363
* `config` - (Optional) Instance configuration.
54-
* `disk_size` - (Optional, ForceNew) Disk Size.
64+
* `disk_size` - (Optional, ForceNew) Disk Size. Its interval varies with bandwidth, and the input must be within the interval, which can be viewed through the control. If it is not within the interval, the plan will cause a change when first created.
5565
* `disk_type` - (Optional, ForceNew) Type of disk.
5666
* `dynamic_retention_config` - (Optional) Dynamic message retention policy configuration.
5767
* `kafka_version` - (Optional, ForceNew) Kafka version (0.10.2/1.1.1/2.4.1).
5868
* `msg_retention_time` - (Optional) The maximum retention time of instance logs, in minutes. the default is 10080 (7 days), the maximum is 30 days, and the default 0 is not filled, which means that the log retention time recovery policy is not enabled.
5969
* `multi_zone_flag` - (Optional, ForceNew) Indicates whether the instance is multi zones. NOTE: if set to `true`, `zone_ids` must set together.
60-
* `partition` - (Optional, ForceNew) Partition size, the professional version does not need set.
70+
* `partition` - (Optional, ForceNew) Partition Size. Its interval varies with bandwidth, and the input must be within the interval, which can be viewed through the control. If it is not within the interval, the plan will cause a change when first created.
71+
* `period` - (Optional, ForceNew) Prepaid purchase time, such as 1, is one month.
6172
* `public_network` - (Optional) Timestamp.
6273
* `rebalance_time` - (Optional) Modification of the rebalancing time after upgrade.
6374
* `renew_flag` - (Optional, ForceNew) Prepaid automatic renewal mark, 0 means the default state, the initial state, 1 means automatic renewal, 2 means clear no automatic renewal (user setting).

0 commit comments

Comments
 (0)