@@ -16,12 +16,10 @@ import (
16
16
awstypes "github.com/aws/aws-sdk-go-v2/service/ec2/types"
17
17
"github.com/hashicorp/aws-sdk-go-base/v2/tfawserr"
18
18
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
19
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
20
19
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
21
20
"github.com/hashicorp/terraform-provider-aws/internal/conns"
22
21
"github.com/hashicorp/terraform-provider-aws/internal/enum"
23
22
"github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag"
24
- tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices"
25
23
tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
26
24
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
27
25
"github.com/hashicorp/terraform-provider-aws/names"
@@ -339,7 +337,7 @@ func resourceEIPDelete(ctx context.Context, d *schema.ResourceData, meta any) di
339
337
timeout = 10 * time .Minute // IPAM eventual consistency
340
338
)
341
339
_ , err := tfresource .RetryUntilNotFound (ctx , timeout , func (ctx context.Context ) (any , error ) {
342
- return findIPAMPoolAllocationsForEIP (ctx , conn , ipamPoolID , d .Get ("allocation_id" ).(string ))
340
+ return findIPAMPoolAllocationsByIPAMPoolIDAndResourceID (ctx , conn , ipamPoolID , d .Get ("allocation_id" ).(string ))
343
341
})
344
342
345
343
if err != nil {
@@ -430,25 +428,3 @@ func disassociateEIP(ctx context.Context, conn *ec2.Client, associationID string
430
428
func eipARN (ctx context.Context , c * conns.AWSClient , allocationID string ) string {
431
429
return c .RegionalARN (ctx , names .EC2 , "elastic-ip/" + allocationID )
432
430
}
433
-
434
- func findIPAMPoolAllocationsForEIP (ctx context.Context , conn * ec2.Client , ipamPoolID , eipAllocationID string ) ([]awstypes.IpamPoolAllocation , error ) {
435
- input := ec2.GetIpamPoolAllocationsInput {
436
- IpamPoolId : aws .String (ipamPoolID ),
437
- }
438
-
439
- output , err := findIPAMPoolAllocations (ctx , conn , & input )
440
-
441
- if err != nil {
442
- return nil , err
443
- }
444
-
445
- output = tfslices .Filter (output , func (v awstypes.IpamPoolAllocation ) bool {
446
- return v .ResourceType == awstypes .IpamPoolAllocationResourceTypeEip && aws .ToString (v .ResourceId ) == eipAllocationID
447
- })
448
-
449
- if len (output ) == 0 {
450
- return nil , & retry.NotFoundError {}
451
- }
452
-
453
- return output , nil
454
- }
0 commit comments