Skip to content

feat(ccn): [120069939] add ipv6s #2898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading