Skip to content

Commit fe2445a

Browse files
tongyimingmikatong
andauthored
fix dayu bound ip (#1558)
* fix dayu bound ip * update * add changelog --------- Co-authored-by: mikatong <mikatong@tencent.com>
1 parent 4db00de commit fe2445a

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

.changelog/1558.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_dayu_ddos_ip_attachment_v2: fix delete failed
3+
```

tencentcloud/resource_tc_dayu_ddos_ip_attachment_v2.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,11 @@ func resourceTencentCloudDayuDDosIpAttachmentReadV2(d *schema.ResourceData, meta
188188
_ = d.Set("bgp_instance_id", bgpInstanceId)
189189
boundIpList := make([]map[string]interface{}, 0)
190190
if boundip.EipProductInfos != nil {
191-
boundIpListItem := make(map[string]interface{})
192191
for _, item := range boundip.EipProductInfos {
193192
if _, ok := boundIpMap[*item.Ip]; !ok {
194193
continue
195194
}
195+
boundIpListItem := make(map[string]interface{})
196196
boundIpListItem["ip"] = *item.Ip
197197
boundIpListItem["biz_type"] = *item.BizType
198198
boundIpListItem["instance_id"] = *item.InstanceId
@@ -226,10 +226,11 @@ func resourceTencentCloudDayuDDosIpAttachmentDeleteV2(d *schema.ResourceData, me
226226
request.Id = helper.String(bgpInstanceId)
227227
ubBoundDevList := make([]*antiddos.BoundIpInfo, 0)
228228
for _, boundIp := range strings.Split(boundIps, COMMA_SP) {
229+
boundIpValue := boundIp
229230
ubBoundDevList = append(
230231
ubBoundDevList,
231232
&antiddos.BoundIpInfo{
232-
Ip: &boundIp,
233+
Ip: &boundIpValue,
233234
},
234235
)
235236
}

tencentcloud/resource_tc_dayu_ddos_ip_attachment_v2_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func TestAccTencentCloudDayuDdosIpAttachmentV2Resource_basic(t *testing.T) {
2222
Check: resource.ComposeTestCheckFunc(
2323
testAccCheckDayuDdosIpAttachmentExists("tencentcloud_dayu_ddos_ip_attachment_v2.boundip"),
2424
resource.TestCheckResourceAttrSet("tencentcloud_dayu_ddos_ip_attachment_v2.boundip", "bgp_instance_id"),
25-
resource.TestCheckResourceAttr("tencentcloud_dayu_ddos_ip_attachment_v2.boundip", "bound_ip_list.#", "1"),
25+
resource.TestCheckResourceAttr("tencentcloud_dayu_ddos_ip_attachment_v2.boundip", "bound_ip_list.#", "2"),
2626
),
2727
},
2828
},
@@ -115,12 +115,18 @@ func testAccCheckDayuDdosIpAttachmentExists(n string) resource.TestCheckFunc {
115115

116116
const testAccDayuDdosIpAttachment_basic = `
117117
resource "tencentcloud_dayu_ddos_ip_attachment_v2" "boundip" {
118-
bgp_instance_id = "bgp-000001co"
118+
bgp_instance_id = "bgp-00000fih"
119119
bound_ip_list {
120120
ip = "43.136.81.73"
121121
biz_type = "public"
122122
instance_id = "ins-eukucmzm"
123123
device_type = "cvm"
124124
}
125+
bound_ip_list {
126+
ip = "43.139.245.210"
127+
biz_type = "public"
128+
instance_id = "ins-c6vwi48a"
129+
device_type = "cvm"
130+
}
125131
}
126132
`

0 commit comments

Comments
 (0)