Skip to content

Commit 4e18f1f

Browse files
committed
fix: modify eip
1 parent 930693e commit 4e18f1f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

tencentcloud/services/cvm/resource_tc_eip_association.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ func ResourceTencentCloudEipAssociation() *schema.Resource {
6666
},
6767
Description: "Indicates an IP belongs to the `network_interface_id`. This field is conflict with `instance_id`.",
6868
},
69+
"cdc_id": {
70+
Type: schema.TypeString,
71+
Optional: true,
72+
Description: "CDC Unique ID.",
73+
},
6974
},
7075
}
7176
}
@@ -82,8 +87,9 @@ func resourceTencentCloudEipAssociationCreate(d *schema.ResourceData, meta inter
8287
)
8388

8489
eipId := d.Get("eip_id").(string)
90+
cdcId := d.Get("cdc_id").(string)
8591
err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
86-
eip, errRet = vpcService.DescribeEipById(ctx, eipId, "")
92+
eip, errRet = vpcService.DescribeEipById(ctx, eipId, cdcId)
8793
if errRet != nil {
8894
return tccommon.RetryError(errRet, tccommon.InternalError)
8995
}
@@ -120,7 +126,7 @@ func resourceTencentCloudEipAssociationCreate(d *schema.ResourceData, meta inter
120126

121127
associationId := fmt.Sprintf("%v::%v", eipId, instanceId)
122128
err = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
123-
eip, errRet = vpcService.DescribeEipById(ctx, eipId, "")
129+
eip, errRet = vpcService.DescribeEipById(ctx, eipId, cdcId)
124130
if errRet != nil {
125131
return tccommon.RetryError(errRet)
126132
}
@@ -183,7 +189,7 @@ func resourceTencentCloudEipAssociationCreate(d *schema.ResourceData, meta inter
183189
id := fmt.Sprintf("%v::%v::%v", eipId, networkId, privateIp)
184190

185191
err = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
186-
eip, errRet = vpcService.DescribeEipById(ctx, eipId, "")
192+
eip, errRet = vpcService.DescribeEipById(ctx, eipId, cdcId)
187193
if errRet != nil {
188194
return tccommon.RetryError(errRet)
189195
}
@@ -226,8 +232,9 @@ func resourceTencentCloudEipAssociationRead(d *schema.ResourceData, meta interfa
226232
return err
227233
}
228234

235+
cdcId := d.Get("cdc_id").(string)
229236
err = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
230-
eip, errRet := vpcService.DescribeEipById(ctx, association.EipId, "")
237+
eip, errRet := vpcService.DescribeEipById(ctx, association.EipId, cdcId)
231238
if errRet != nil {
232239
return tccommon.RetryError(errRet)
233240
}
@@ -270,8 +277,9 @@ func resourceTencentCloudEipAssociationDelete(d *schema.ResourceData, meta inter
270277
return err
271278
}
272279

280+
cdcId := d.Get("cdc_id").(string)
273281
err = resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
274-
e := vpcService.UnattachEip(ctx, association.EipId, "")
282+
e := vpcService.UnattachEip(ctx, association.EipId, cdcId)
275283
if e != nil {
276284
return tccommon.RetryError(e, "DesOperation.MutexTaskRunning")
277285
}

0 commit comments

Comments
 (0)