@@ -40,7 +40,32 @@ func ResourceTencentCloudVpcIpv6CidrBlock() *schema.Resource {
40
40
"ipv6_cidr_block" : {
41
41
Type : schema .TypeString ,
42
42
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
+ },
44
69
},
45
70
},
46
71
}
@@ -112,9 +137,31 @@ func resourceTencentCloudVpcIpv6CidrBlockRead(d *schema.ResourceData, meta inter
112
137
_ = d .Set ("vpc_id" , instance .VpcId )
113
138
}
114
139
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 )
118
165
}
119
166
120
167
return nil
0 commit comments