Skip to content

Commit 7b0ee55

Browse files
gitmknanonymous
andauthored
fix: add field cpu info device_type (#1996)
* fix: add field cpu info device_type * feat: add changelog * fix: judgment empty --------- Co-authored-by: anonymous <anonymous@mail.org>
1 parent b3d0f2f commit 7b0ee55

File tree

3 files changed

+41
-7
lines changed

3 files changed

+41
-7
lines changed

.changelog/1996.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
datasource/tencentcloud_mysql_zone_config: Support querying `cpu`, `info`, `device_type`
3+
```

tencentcloud/data_source_tc_mysql_zone_config.go

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ func TencentMysqlSellType() map[string]*schema.Schema {
2727
"cdb_type": {
2828
Type: schema.TypeString,
2929
Computed: true,
30-
Description: "",
30+
Description: "Instance type, the possible value ranges are: `UNIVERSAL` (universal type), `EXCLUSIVE` (exclusive type), `BASIC` (basic type), `BASIC_V2` (basic type v2).",
31+
},
32+
"cpu": {
33+
Type: schema.TypeInt,
34+
Computed: true,
35+
Description: "Number of CPU cores.",
3136
},
3237
"mem_size": {
3338
Type: schema.TypeInt,
@@ -54,6 +59,11 @@ func TencentMysqlSellType() map[string]*schema.Schema {
5459
Computed: true,
5560
Description: "Queries per second.",
5661
},
62+
"info": {
63+
Type: schema.TypeString,
64+
Computed: true,
65+
Description: "Application Scenario Description.",
66+
},
5767
}
5868
}
5969

@@ -291,12 +301,30 @@ func dataSourceTencentMysqlZoneConfigRead(d *schema.ResourceData, meta interface
291301
engineVersions = append(engineVersions, *sellItem.EngineType)
292302

293303
var showConfigMap = make(map[string]interface{})
294-
showConfigMap["cdb_type"] = *sellItem.DeviceType
295-
showConfigMap["mem_size"] = int(*sellItem.Memory)
296-
showConfigMap["max_volume_size"] = int(*sellItem.VolumeMax)
297-
showConfigMap["min_volume_size"] = int(*sellItem.VolumeMin)
298-
showConfigMap["volume_step"] = int(*sellItem.VolumeStep)
299-
showConfigMap["qps"] = int(*sellItem.Iops)
304+
if sellItem.DeviceType != nil {
305+
showConfigMap["cdb_type"] = *sellItem.DeviceType
306+
}
307+
if sellItem.Cpu != nil {
308+
showConfigMap["cpu"] = int(*sellItem.Cpu)
309+
}
310+
if sellItem.Memory != nil {
311+
showConfigMap["mem_size"] = int(*sellItem.Memory)
312+
}
313+
if sellItem.VolumeMax != nil {
314+
showConfigMap["max_volume_size"] = int(*sellItem.VolumeMax)
315+
}
316+
if sellItem.VolumeMin != nil {
317+
showConfigMap["min_volume_size"] = int(*sellItem.VolumeMin)
318+
}
319+
if sellItem.VolumeStep != nil {
320+
showConfigMap["volume_step"] = int(*sellItem.VolumeStep)
321+
}
322+
if sellItem.Iops != nil {
323+
showConfigMap["qps"] = int(*sellItem.Iops)
324+
}
325+
if sellItem.Info != nil {
326+
showConfigMap["info"] = *sellItem.Info
327+
}
300328
sells = append(sells, showConfigMap)
301329

302330
zoneConfig["engine_versions"] = engineVersions

website/docs/d/mysql_zone_config.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ In addition to all arguments above, the following attributes are exported:
4242
* `remote_ro_zones` - Zone information about remote ro instance.
4343
* `second_slave_zones` - Zone information about second slave instance.
4444
* `sells` - A list of supported instance types for sell:
45+
* `cdb_type` - Instance type, the possible value ranges are: `UNIVERSAL` (universal type), `EXCLUSIVE` (exclusive type), `BASIC` (basic type), `BASIC_V2` (basic type v2).
46+
* `cpu` - Number of CPU cores.
47+
* `info` - Application Scenario Description.
4548
* `max_volume_size` - Maximum disk size (in GB).
4649
* `mem_size` - Memory size (in MB).
4750
* `min_volume_size` - Minimum disk size (in GB).

0 commit comments

Comments
 (0)