Skip to content

Commit be84aaa

Browse files
authored
fix: vpc - distinguish assistant cidr type (#1304)
1 parent d14856d commit be84aaa

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

tencentcloud/resource_tc_vpc.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,15 @@ func resourceTencentCloudVpcInstance() *schema.Resource {
9898
"assistant_cidrs": {
9999
Type: schema.TypeList,
100100
Optional: true,
101-
Description: "List of Assistant CIDR.",
101+
Description: "List of Assistant CIDR, NOTE: Only `NORMAL` typed CIDRs included, check the Docker CIDR by readonly `assistant_docker_cidrs`.",
102+
Computed: true,
103+
Elem: &schema.Schema{
104+
Type: schema.TypeString,
105+
},
106+
},
107+
"docker_assistant_cidrs": {
108+
Type: schema.TypeList,
109+
Description: "List of Docker Assistant CIDR.",
102110
Computed: true,
103111
Elem: &schema.Schema{
104112
Type: schema.TypeString,
@@ -256,6 +264,7 @@ func resourceTencentCloudVpcInstanceRead(d *schema.ResourceData, meta interface{
256264
_ = d.Set("create_time", info.createTime)
257265
_ = d.Set("is_default", info.isDefault)
258266
_ = d.Set("assistant_cidrs", info.assistantCidrs)
267+
_ = d.Set("docker_assistant_cidrs", info.dockerAssistantCidrs)
259268
_ = d.Set("tags", tags)
260269

261270
return nil

tencentcloud/service_tencentcloud_vpc.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ var eipUnattachLocker = &sync.Mutex{}
2727

2828
// VPC basic information
2929
type VpcBasicInfo struct {
30-
vpcId string
31-
name string
32-
cidr string
33-
isMulticast bool
34-
isDefault bool
35-
dnsServers []string
36-
createTime string
37-
tags []*vpc.Tag
38-
assistantCidrs []string
30+
vpcId string
31+
name string
32+
cidr string
33+
isMulticast bool
34+
isDefault bool
35+
dnsServers []string
36+
createTime string
37+
tags []*vpc.Tag
38+
assistantCidrs []string
39+
dockerAssistantCidrs []string
3940
}
4041

4142
// subnet basic information
@@ -353,8 +354,13 @@ getMoreData:
353354

354355
if len(item.AssistantCidrSet) > 0 {
355356
for i := range item.AssistantCidrSet {
357+
kind := item.AssistantCidrSet[i].AssistantType
356358
cidr := item.AssistantCidrSet[i].CidrBlock
357-
basicInfo.assistantCidrs = append(basicInfo.assistantCidrs, *cidr)
359+
if kind != nil && *kind == 0 {
360+
basicInfo.assistantCidrs = append(basicInfo.assistantCidrs, *cidr)
361+
} else {
362+
basicInfo.dockerAssistantCidrs = append(basicInfo.dockerAssistantCidrs, *cidr)
363+
}
358364
}
359365
}
360366

website/docs/r/vpc.html.markdown

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The following arguments are supported:
4747

4848
* `cidr_block` - (Required, String, ForceNew) A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
4949
* `name` - (Required, String) The name of the VPC.
50-
* `assistant_cidrs` - (Optional, List: [`String`]) List of Assistant CIDR.
50+
* `assistant_cidrs` - (Optional, List: [`String`]) List of Assistant CIDR, NOTE: Only `NORMAL` typed CIDRs included, check the Docker CIDR by readonly `assistant_docker_cidrs`.
5151
* `dns_servers` - (Optional, Set: [`String`]) The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
5252
* `is_multicast` - (Optional, Bool) Indicates whether VPC multicast is enabled. The default value is 'true'.
5353
* `tags` - (Optional, Map) Tags of the VPC.
@@ -59,6 +59,7 @@ In addition to all arguments above, the following attributes are exported:
5959
* `id` - ID of the resource.
6060
* `create_time` - Creation time of VPC.
6161
* `default_route_table_id` - Default route table id, which created automatically after VPC create.
62+
* `docker_assistant_cidrs` - List of Docker Assistant CIDR.
6263
* `is_default` - Indicates whether it is the default VPC for this region.
6364

6465

0 commit comments

Comments
 (0)