Skip to content

Commit aa08764

Browse files
WeiMengXSWeiMengXS
andauthored
Fix/vpc modif cidr (#2356)
* fix: vpc modify cidr * fix: vpc modify cidr * fix: vpc modify cidr * fix: vpc modify cidr * fix: bug type * feat: doc --------- Co-authored-by: WeiMengXS <nickcchen@tencent.com>
1 parent 52645e1 commit aa08764

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.changelog/2356.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
resource/tencentcloud_vpc: Fix modify `assistant_cidrs` request
3+
```

tencentcloud/resource_tc_vpc.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,17 @@ func resourceTencentCloudVpcInstanceUpdate(d *schema.ResourceData, meta interfac
294294
old, now := d.GetChange("assistant_cidrs")
295295
request := vpc.NewModifyAssistantCidrRequest()
296296
request.VpcId = &id
297-
request.NewCidrBlocks = helper.InterfacesStringsPoint(now.([]interface{}))
298-
request.OldCidrBlocks = helper.InterfacesStringsPoint(old.([]interface{}))
297+
298+
nowTmp, ok := now.([]interface{})
299+
if ok && len(nowTmp) > 0 {
300+
request.NewCidrBlocks = helper.InterfacesStringsPoint(nowTmp)
301+
}
302+
303+
oldTmp, ok := old.([]interface{})
304+
if ok && len(oldTmp) > 0 {
305+
request.OldCidrBlocks = helper.InterfacesStringsPoint(oldTmp)
306+
}
307+
299308
if err := vpcService.ModifyAssistantCidr(ctx, request); err != nil {
300309
return err
301310
}

0 commit comments

Comments
 (0)