commit
3817cf8c67
|
@ -1,6 +1,7 @@
|
||||||
package aws
|
package aws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/snyk/driftctl/pkg/remote/aws/repository"
|
"github.com/snyk/driftctl/pkg/remote/aws/repository"
|
||||||
remoteerror "github.com/snyk/driftctl/pkg/remote/error"
|
remoteerror "github.com/snyk/driftctl/pkg/remote/error"
|
||||||
"github.com/snyk/driftctl/pkg/resource"
|
"github.com/snyk/driftctl/pkg/resource"
|
||||||
|
@ -32,6 +33,10 @@ func (e *EC2EipEnumerator) Enumerate() ([]*resource.Resource, error) {
|
||||||
results := make([]*resource.Resource, 0, len(addresses))
|
results := make([]*resource.Resource, 0, len(addresses))
|
||||||
|
|
||||||
for _, address := range addresses {
|
for _, address := range addresses {
|
||||||
|
if address.AllocationId == nil {
|
||||||
|
logrus.Warn("Elastic IP does not have an allocation ID, ignoring")
|
||||||
|
continue
|
||||||
|
}
|
||||||
results = append(
|
results = append(
|
||||||
results,
|
results,
|
||||||
e.factory.CreateAbstractResource(
|
e.factory.CreateAbstractResource(
|
||||||
|
|
|
@ -232,7 +232,9 @@ func TestEC2Eip(t *testing.T) {
|
||||||
test: "no eips",
|
test: "no eips",
|
||||||
dirName: "aws_ec2_eip_empty",
|
dirName: "aws_ec2_eip_empty",
|
||||||
mocks: func(repository *repository.MockEC2Repository, alerter *mocks.AlerterInterface) {
|
mocks: func(repository *repository.MockEC2Repository, alerter *mocks.AlerterInterface) {
|
||||||
repository.On("ListAllAddresses").Return([]*ec2.Address{}, nil)
|
repository.On("ListAllAddresses").Return([]*ec2.Address{
|
||||||
|
{}, // Test Eip without AllocationId because it can happen (seen in sentry)
|
||||||
|
}, nil)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue