Skip to content

Commit c28a839

Browse files
author
ivan
committed
需求 支持external CLB创建多AZ实例 Description添加master_zone及查询结果相应的字段
1 parent d9de732 commit c28a839

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

tencentcloud/data_source_tc_clb_instances.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ func dataSourceTencentCloudClbInstances() *schema.Resource {
5656
Optional: true,
5757
Description: "Used to save results.",
5858
},
59+
"master_zone": {
60+
Type: schema.TypeString,
61+
Optional: true,
62+
Description: "Master available zone id.",
63+
},
5964
"clb_list": {
6065
Type: schema.TypeList,
6166
Computed: true,
@@ -154,6 +159,31 @@ func dataSourceTencentCloudClbInstances() *schema.Resource {
154159
Computed: true,
155160
Description: "Max bandwidth out, only applicable to open CLB. Valid value ranges is [1, 2048]. Unit is MB.",
156161
},
162+
"zone_id": {
163+
Type: schema.TypeInt,
164+
Computed: true,
165+
Description: "Available zone unique id(numerical representation), This field maybe null, means cannot get a valid value",
166+
},
167+
"zone": {
168+
Type: schema.TypeString,
169+
Computed: true,
170+
Description: "Available zone unique id(string representation), This field maybe null, means cannot get a valid value",
171+
},
172+
"zone_name": {
173+
Type: schema.TypeString,
174+
Computed: true,
175+
Description: "Available zone name, This field maybe null, means cannot get a valid value",
176+
},
177+
"zone_region": {
178+
Type: schema.TypeString,
179+
Computed: true,
180+
Description: "Region that this available zone belong to, This field maybe null, means cannot get a valid value",
181+
},
182+
"local_zone": {
183+
Type: schema.TypeBool,
184+
Computed: true,
185+
Description: "Whether this available zone is local zone, This field maybe null, means cannot get a valid value",
186+
},
157187
},
158188
},
159189
},
@@ -180,6 +210,9 @@ func dataSourceTencentCloudClbInstancesRead(d *schema.ResourceData, meta interfa
180210
if v, ok := d.GetOk("network_type"); ok {
181211
params["network_type"] = v.(string)
182212
}
213+
if v, ok := d.GetOk("master_zone"); ok {
214+
params["master_zone"] = v.(string)
215+
}
183216

184217
clbService := ClbService{
185218
client: meta.(*TencentCloudClient).apiV3Conn,
@@ -221,6 +254,14 @@ func dataSourceTencentCloudClbInstancesRead(d *schema.ResourceData, meta interfa
221254
mapping["internet_charge_type"] = *clbInstance.NetworkAttributes.InternetChargeType
222255
mapping["internet_bandwidth_max_out"] = *clbInstance.NetworkAttributes.InternetMaxBandwidthOut
223256
}
257+
if clbInstance.MasterZone != nil {
258+
mapping["zone_id"] = *clbInstance.MasterZone.ZoneId
259+
mapping["zone"] = *clbInstance.MasterZone.Zone
260+
mapping["zone_name"] = *clbInstance.MasterZone.ZoneName
261+
mapping["zone_region"] = *clbInstance.MasterZone.ZoneRegion
262+
mapping["local_zone"] = *clbInstance.MasterZone.LocalZone
263+
}
264+
224265
if clbInstance.Tags != nil {
225266
tags := make(map[string]interface{}, len(clbInstance.Tags))
226267
for _, t := range clbInstance.Tags {

tencentcloud/service_tencentcloud_clb.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ func (me *ClbService) DescribeLoadBalancerByFilter(ctx context.Context, params m
7878
projectId := int64(v.(int))
7979
request.ProjectId = &projectId
8080
}
81+
if k == "master_zone" {
82+
request.MasterZone = helper.String(v.(string))
83+
}
8184
}
8285

8386
offset := int64(0)

0 commit comments

Comments
 (0)