From 322647ca50c32acb8419c0f6ef7d1472b4b74326 Mon Sep 17 00:00:00 2001 From: Angie Pinilla Date: Fri, 28 Jan 2022 17:37:21 -0500 Subject: [PATCH] fix rebase errors --- internal/service/ec2/find.go | 25 +++++++++++++++++++ .../ec2/network_acls_data_source_test.go | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/internal/service/ec2/find.go b/internal/service/ec2/find.go index c7bcdb25de0..5a03ceb2f4a 100644 --- a/internal/service/ec2/find.go +++ b/internal/service/ec2/find.go @@ -177,6 +177,31 @@ func FindEBSVolume(conn *ec2.EC2, input *ec2.DescribeVolumesInput) (*ec2.Volume, return output[0], nil } +func FindEIPs(conn *ec2.EC2, input *ec2.DescribeAddressesInput) ([]*ec2.Address, error) { + var addresses []*ec2.Address + + output, err := conn.DescribeAddresses(input) + + if tfawserr.ErrCodeEquals(err, ErrCodeInvalidAddressNotFound, ErrCodeInvalidAllocationIDNotFound) { + return nil, &resource.NotFoundError{ + LastError: err, + LastRequest: input, + } + } + + if err != nil { + return nil, err + } + + for _, v := range output.Addresses { + if v != nil { + addresses = append(addresses, v) + } + } + + return addresses, nil +} + func FindHostByID(conn *ec2.EC2, id string) (*ec2.Host, error) { input := &ec2.DescribeHostsInput{ HostIds: aws.StringSlice([]string{id}), diff --git a/internal/service/ec2/network_acls_data_source_test.go b/internal/service/ec2/network_acls_data_source_test.go index bb72cfbbc3b..692413f3ca4 100644 --- a/internal/service/ec2/network_acls_data_source_test.go +++ b/internal/service/ec2/network_acls_data_source_test.go @@ -23,7 +23,7 @@ func TestAccEC2NetworkACLsDataSource_basic(t *testing.T) { { Config: testAccNetworkACLsDataSourceConfig_basic(rName), Check: resource.ComposeTestCheckFunc( - testCheckResourceAttrGreaterThanValue(dataSourceName, "ids.#", "1"), + acctest.CheckResourceAttrGreaterThanValue(dataSourceName, "ids.#", "1"), ), }, },