Skip to content

Commit

Permalink
feat(ccn): [120069939] add ipv6s (#2898)
Browse files Browse the repository at this point in the history
* support ipv6s

* support ipv6s
  • Loading branch information
hellertang authored Oct 18, 2024
1 parent ea2fac3 commit c93284b
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/2898.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
datasource/tencentcloud_enis: add `ipv6s`
```
47 changes: 47 additions & 0 deletions tencentcloud/services/vpc/data_source_tc_enis.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,40 @@ func DataSourceTencentCloudEnis() *schema.Resource {
},
},
},
"ipv6s": {
Type: schema.TypeList,
Computed: true,
Description: "A set of intranet IPv6s.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"address": {
Type: schema.TypeString,
Computed: true,
Description: "`IPv6` address, such as `3402:4e00:20:100:0:8cd9:2a67:71f3`.",
},
"primary": {
Type: schema.TypeBool,
Computed: true,
Description: "Whether it is a primary `IP`.",
},
"address_id": {
Type: schema.TypeString,
Computed: true,
Description: "The `ID` of the `EIP` instance, such as `eip-hxlqja90`.",
},
"description": {
Type: schema.TypeString,
Computed: true,
Description: "Message description.",
},
"is_wan_ip_blocked": {
Type: schema.TypeBool,
Computed: true,
Description: "Whether the public IP is blocked.",
},
},
},
},
"instance_id": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -255,6 +289,18 @@ func dataSourceTencentCloudEnisRead(d *schema.ResourceData, m interface{}) error
})
}

ipv6s := make([]map[string]interface{}, 0, len(eni.Ipv6AddressSet))

for _, ipv6 := range eni.Ipv6AddressSet {
ipv6s = append(ipv6s, map[string]interface{}{
"address": ipv6.Address,
"primary": ipv6.Primary,
"address_id": ipv6.AddressId,
"description": ipv6.Description,
"is_wan_ip_blocked": ipv6.IsWanIpBlocked,
})
}

sgs := make([]string, 0, len(eni.GroupSet))
for _, sg := range eni.GroupSet {
sgs = append(sgs, *sg)
Expand All @@ -278,6 +324,7 @@ func dataSourceTencentCloudEnisRead(d *schema.ResourceData, m interface{}) error
"state": eni.State,
"create_time": eni.CreatedTime,
"ipv4s": ipv4s,
"ipv6s": ipv6s,
"security_groups": sgs,
"tags": respTags,
"cdc_id": eni.CdcId,
Expand Down
6 changes: 6 additions & 0 deletions website/docs/d/enis.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ In addition to all arguments above, the following attributes are exported:
* `description` - Description of the IP.
* `ip` - Intranet IP.
* `primary` - Indicates whether the IP is primary.
* `ipv6s` - A set of intranet IPv6s.
* `address_id` - The `ID` of the `EIP` instance, such as `eip-hxlqja90`.
* `address` - `IPv6` address, such as `3402:4e00:20:100:0:8cd9:2a67:71f3`.
* `description` - Message description.
* `is_wan_ip_blocked` - Whether the public IP is blocked.
* `primary` - Whether it is a primary `IP`.
* `mac` - MAC address.
* `name` - Name of the ENI.
* `primary` - Indicates whether the IP is primary.
Expand Down

0 comments on commit c93284b

Please sign in to comment.