Skip to content

Commit 950163a

Browse files
committed
add
1 parent 791cc7e commit 950163a

File tree

2 files changed

+56
-5
lines changed

2 files changed

+56
-5
lines changed

tencentcloud/services/vpc/resource_tc_vpc_ipv6_cidr_block.go

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,32 @@ func ResourceTencentCloudVpcIpv6CidrBlock() *schema.Resource {
4040
"ipv6_cidr_block": {
4141
Type: schema.TypeString,
4242
Computed: true,
43-
Description: "ipv6 cidr block.",
43+
Description: "Ipv6 cidr block.",
44+
},
45+
46+
"ipv6_cidr_block_set": {
47+
Type: schema.TypeList,
48+
Computed: true,
49+
Description: "Ipv6 cidr block set.",
50+
Elem: &schema.Resource{
51+
Schema: map[string]*schema.Schema{
52+
"ipv6_cidr_block": {
53+
Type: schema.TypeString,
54+
Computed: true,
55+
Description: "Ipv6 cidr block.",
56+
},
57+
"address_type": {
58+
Type: schema.TypeString,
59+
Computed: true,
60+
Description: "Apply for the type of IPv6 Cidr, GUA (Global Unicast Address), ULA (Unique Local Address).",
61+
},
62+
"isp_type": {
63+
Type: schema.TypeString,
64+
Computed: true,
65+
Description: "Range of network operator types: 'BGP' - default, 'CMCC' - China Mobile, 'CTCC' - China Telecom, 'CUCC' - China Joint Debugging.",
66+
},
67+
},
68+
},
4469
},
4570
},
4671
}
@@ -112,9 +137,31 @@ func resourceTencentCloudVpcIpv6CidrBlockRead(d *schema.ResourceData, meta inter
112137
_ = d.Set("vpc_id", instance.VpcId)
113138
}
114139

115-
if instance.Ipv6CidrBlockSet != nil && len(instance.Ipv6CidrBlockSet) != 0 {
116-
_ = d.Set("address_type", instance.Ipv6CidrBlockSet[0].AddressType)
117-
_ = d.Set("ipv6_cidr_block", instance.Ipv6CidrBlockSet[0].IPv6CidrBlock)
140+
if instance.Ipv6CidrBlock != nil {
141+
_ = d.Set("ipv6_cidr_block", instance.Ipv6CidrBlock)
142+
}
143+
144+
if instance.Ipv6CidrBlockSet != nil && len(instance.Ipv6CidrBlockSet) > 0 {
145+
tmpList := make([]map[string]interface{}, 0, len(instance.Ipv6CidrBlockSet))
146+
for _, item := range instance.Ipv6CidrBlockSet {
147+
dMap := make(map[string]interface{})
148+
if item.IPv6CidrBlock != nil {
149+
dMap["ipv6_cidr_block"] = item.IPv6CidrBlock
150+
}
151+
152+
if item.AddressType != nil {
153+
dMap["address_type"] = item.AddressType
154+
_ = d.Set("address_type", item.AddressType)
155+
}
156+
157+
if item.ISPType != nil {
158+
dMap["isp_type"] = item.ISPType
159+
}
160+
161+
tmpList = append(tmpList, dMap)
162+
}
163+
164+
_ = d.Set("ipv6_cidr_block_set", tmpList)
118165
}
119166

120167
return nil

website/docs/r/vpc_ipv6_cidr_block.html.markdown

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ The following arguments are supported:
4545
In addition to all arguments above, the following attributes are exported:
4646

4747
* `id` - ID of the resource.
48-
* `ipv6_cidr_block` - ipv6 cidr block.
48+
* `ipv6_cidr_block_set` - Ipv6 cidr block set.
49+
* `address_type` - Apply for the type of IPv6 Cidr, GUA (Global Unicast Address), ULA (Unique Local Address).
50+
* `ipv6_cidr_block` - Ipv6 cidr block.
51+
* `isp_type` - Range of network operator types: 'BGP' - default, 'CMCC' - China Mobile, 'CTCC' - China Telecom, 'CUCC' - China Joint Debugging.
52+
* `ipv6_cidr_block` - Ipv6 cidr block.
4953

5054

5155
## Import

0 commit comments

Comments
 (0)