Skip to content

Commit bbf48d0

Browse files
committed
tencentcloud_instances support filter by tags
1 parent 0d149f7 commit bbf48d0

File tree

6 files changed

+22
-3
lines changed

6 files changed

+22
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
## 1.42.3 (Unreleased)
2+
3+
ENHANCEMENTS:
4+
5+
* Data Source: `tencentcloud_instances` support filter by tags.
6+
27
## 1.42.2 (September 14, 2020)
38

49
BUG FIXES:

tencentcloud/data_source_tc_instances.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ func dataSourceTencentCloudInstances() *schema.Resource {
5858
Optional: true,
5959
Description: "ID of a vpc subnetwork.",
6060
},
61+
"tags": {
62+
Type: schema.TypeMap,
63+
Optional: true,
64+
Description: "Tags of the instance.",
65+
},
6166
"result_output_file": {
6267
Type: schema.TypeString,
6368
Optional: true,
@@ -260,6 +265,11 @@ func dataSourceTencentCloudInstancesRead(d *schema.ResourceData, meta interface{
260265
if v, ok := d.GetOk("subnet_id"); ok {
261266
filter["subnet-id"] = v.(string)
262267
}
268+
if v, ok := d.GetOk("tags"); ok {
269+
for key, value := range v.(map[string]interface{}) {
270+
filter["tag:"+key] = value.(string)
271+
}
272+
}
263273

264274
var instances []*cvm.Instance
265275
var errRet error

tencentcloud/extension_vpc.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ package tencentcloud
77
const GATE_WAY_TYPE_CVM = "CVM"
88
const GATE_WAY_TYPE_VPN = "VPN"
99
const GATE_WAY_TYPE_DIRECTCONNECT = "DIRECTCONNECT"
10+
const GATE_WAY_TYPE_PEERCONNECTION = "PEERCONNECTION"
1011
const GATE_WAY_TYPE_SSLVPN = "SSLVPN"
1112
const GATE_WAY_TYPE_NAT = "NAT"
1213
const GATE_WAY_TYPE_NORMAL_CVM = "NORMAL_CVM"
1314
const GATE_WAY_TYPE_EIP = "EIP"
1415
const GATE_WAY_TYPE_CCN = "CCN"
1516

16-
var ALL_GATE_WAY_TYPES = []string{GATE_WAY_TYPE_CVM,
17+
var ALL_GATE_WAY_TYPES = []string{
18+
GATE_WAY_TYPE_CVM,
1719
GATE_WAY_TYPE_VPN,
1820
GATE_WAY_TYPE_DIRECTCONNECT,
21+
GATE_WAY_TYPE_PEERCONNECTION,
1922
GATE_WAY_TYPE_SSLVPN,
2023
GATE_WAY_TYPE_NAT,
2124
GATE_WAY_TYPE_NORMAL_CVM,

tencentcloud/resource_tc_cbs_storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Example Usage
77
resource "tencentcloud_cbs_storage" "storage" {
88
storage_name = "mystorage"
99
storage_type = "CLOUD_SSD"
10-
storage_size = "50"
10+
storage_size = 100
1111
availability_zone = "ap-guangzhou-3"
1212
project_id = 0
1313
encrypt = false

website/docs/d/instances.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The following arguments are supported:
2929
* `project_id` - (Optional) The project CVM belongs to.
3030
* `result_output_file` - (Optional) Used to save results.
3131
* `subnet_id` - (Optional) ID of a vpc subnetwork.
32+
* `tags` - (Optional) Tags of the instance.
3233
* `vpc_id` - (Optional) ID of the vpc to be queried.
3334

3435
## Attributes Reference

website/docs/r/cbs_storage.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Provides a resource to create a CBS.
1717
resource "tencentcloud_cbs_storage" "storage" {
1818
storage_name = "mystorage"
1919
storage_type = "CLOUD_SSD"
20-
storage_size = "50"
20+
storage_size = 100
2121
availability_zone = "ap-guangzhou-3"
2222
project_id = 0
2323
encrypt = false

0 commit comments

Comments
 (0)