Skip to content

Commit 0d24364

Browse files
authored
add computed attribute for tse gw (#2210)
* add computed attribute for tse gw * add computed attribute for tse gw * add computed attribute for tse gw
1 parent cd37ad3 commit 0d24364

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

.changelog/2210.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
tencentcloud_tse_cngw_gateway: Add computed `instance_port` and `public_ip_addresses`
3+
```

tencentcloud/resource_tc_tse_cngw_gateway.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,35 @@ func resourceTencentCloudTseCngwGateway() *schema.Resource {
232232
Optional: true,
233233
Description: "Tag description list.",
234234
},
235+
236+
"instance_port": {
237+
Computed: true,
238+
Type: schema.TypeList,
239+
Description: "Port information that the instance listens to.",
240+
Elem: &schema.Resource{
241+
Schema: map[string]*schema.Schema{
242+
"http_port": {
243+
Type: schema.TypeString,
244+
Computed: true,
245+
Description: "Http port range.",
246+
},
247+
"https_port": {
248+
Type: schema.TypeString,
249+
Computed: true,
250+
Description: "Https port range.",
251+
},
252+
},
253+
},
254+
},
255+
256+
"public_ip_addresses": {
257+
Type: schema.TypeSet,
258+
Elem: &schema.Schema{
259+
Type: schema.TypeString,
260+
},
261+
Computed: true,
262+
Description: "Public IP address list.",
263+
},
235264
},
236265
}
237266
}
@@ -465,6 +494,29 @@ func resourceTencentCloudTseCngwGatewayRead(d *schema.ResourceData, meta interfa
465494
_ = d.Set("trade_type", cngwGateway.TradeType)
466495
}
467496

497+
if cngwGateway.InstancePort != nil {
498+
instancePortMap := map[string]interface{}{}
499+
500+
if cngwGateway.InstancePort.HttpPort != nil {
501+
instancePortMap["http_port"] = cngwGateway.InstancePort.HttpPort
502+
}
503+
504+
if cngwGateway.InstancePort.HttpsPort != nil {
505+
instancePortMap["https_port"] = cngwGateway.InstancePort.HttpsPort
506+
}
507+
508+
_ = d.Set("instance_port", []interface{}{instancePortMap})
509+
}
510+
511+
if cngwGateway.PublicIpAddresses != nil {
512+
513+
addresses := make([]*string, len(cngwGateway.PublicIpAddresses))
514+
515+
addresses = append(addresses, cngwGateway.PublicIpAddresses...)
516+
517+
_ = d.Set("public_ip_addresses", addresses)
518+
}
519+
468520
tcClient := meta.(*TencentCloudClient).apiV3Conn
469521
tagService := &TagService{client: tcClient}
470522
tags, err := tagService.DescribeResourceTags(ctx, "tse", "gateway", tcClient.Region, d.Id())

website/docs/r/tse_cngw_gateway.html.markdown

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ The `vpc_config` object supports the following:
103103
In addition to all arguments above, the following attributes are exported:
104104

105105
* `id` - ID of the resource.
106-
106+
* `instance_port` - Port information that the instance listens to.
107+
* `http_port` - Http port range.
108+
* `https_port` - Https port range.
109+
* `public_ip_addresses` - Public IP address list.
107110

108111

0 commit comments

Comments
 (0)