Skip to content

Commit 5f7e41a

Browse files
authored
feat(cvm): [117096263] Output cpu, memory, os_name (#2608)
* add cvm output * add cvm output
1 parent 53bccde commit 5f7e41a

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

.changelog/2608.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_instance: add output `memory`, `os_name`, `cpu`
3+
```
4+
5+
```release-note:enhancement
6+
datasource/tencentcloud_instances: add output `os_name`
7+
```

tencentcloud/services/cvm/data_source_tc_instances.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ func DataSourceTencentCloudInstances() *schema.Resource {
103103
Computed: true,
104104
Description: "Instance memory capacity, unit in GB.",
105105
},
106+
"os_name": {
107+
Type: schema.TypeString,
108+
Computed: true,
109+
Description: "Instance os name.",
110+
},
106111
"availability_zone": {
107112
Type: schema.TypeString,
108113
Computed: true,
@@ -306,6 +311,7 @@ func dataSourceTencentCloudInstancesRead(d *schema.ResourceData, meta interface{
306311
"instance_type": instance.InstanceType,
307312
"cpu": instance.CPU,
308313
"memory": instance.Memory,
314+
"os_name": instance.OsName,
309315
"availability_zone": instance.Placement.Zone,
310316
"project_id": instance.Placement.ProjectId,
311317
"image_id": instance.ImageId,

tencentcloud/services/cvm/resource_tc_instance.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,21 @@ func ResourceTencentCloudInstance() *schema.Resource {
409409
Computed: true,
410410
Description: "Expired time of the instance.",
411411
},
412+
"cpu": {
413+
Type: schema.TypeInt,
414+
Computed: true,
415+
Description: "The number of CPU cores of the instance.",
416+
},
417+
"memory": {
418+
Type: schema.TypeInt,
419+
Computed: true,
420+
Description: "Instance memory capacity, unit in GB.",
421+
},
422+
"os_name": {
423+
Type: schema.TypeString,
424+
Computed: true,
425+
Description: "Instance os name.",
426+
},
412427
},
413428
}
414429
}
@@ -829,6 +844,9 @@ func resourceTencentCloudInstanceRead(d *schema.ResourceData, meta interface{})
829844
_ = d.Set("expired_time", instance.ExpiredTime)
830845
_ = d.Set("cam_role_name", instance.CamRoleName)
831846
_ = d.Set("disable_api_termination", instance.DisableApiTermination)
847+
_ = d.Set("cpu", instance.CPU)
848+
_ = d.Set("memory", instance.Memory)
849+
_ = d.Set("os_name", instance.OsName)
832850

833851
if instance.Uuid != nil {
834852
_ = d.Set("uuid", instance.Uuid)

website/docs/d/instances.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ In addition to all arguments above, the following attributes are exported:
5858
* `internet_charge_type` - The charge type of the instance.
5959
* `internet_max_bandwidth_out` - Public network maximum output bandwidth of the instance.
6060
* `memory` - Instance memory capacity, unit in GB.
61+
* `os_name` - Instance os name.
6162
* `private_ip` - Private IP of the instance.
6263
* `project_id` - The project CVM belongs to.
6364
* `public_ip` - Public IP of the instance.

website/docs/r/instance.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,12 @@ The `data_disks` object supports the following:
165165
In addition to all arguments above, the following attributes are exported:
166166

167167
* `id` - ID of the resource.
168+
* `cpu` - The number of CPU cores of the instance.
168169
* `create_time` - Create time of the instance.
169170
* `expired_time` - Expired time of the instance.
170171
* `instance_status` - Current status of the instance.
172+
* `memory` - Instance memory capacity, unit in GB.
173+
* `os_name` - Instance os name.
171174
* `public_ip` - Public IP of the instance.
172175
* `uuid` - Globally unique ID of the instance.
173176

0 commit comments

Comments
 (0)