From bcbea5f7701248cefd11d10bd3169b66b93fa4f3 Mon Sep 17 00:00:00 2001 From: Elie Date: Fri, 16 Jul 2021 14:30:19 +0200 Subject: [PATCH] Add origin to `aws_route` in enumerator --- pkg/remote/aws/ec2_route_enumerator.go | 1 + pkg/remote/ec2_scanner_test.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/pkg/remote/aws/ec2_route_enumerator.go b/pkg/remote/aws/ec2_route_enumerator.go index 39077837..28f86364 100644 --- a/pkg/remote/aws/ec2_route_enumerator.go +++ b/pkg/remote/aws/ec2_route_enumerator.go @@ -36,6 +36,7 @@ func (e *EC2RouteEnumerator) Enumerate() ([]resource.Resource, error) { routeId, _ := aws.CalculateRouteID(routeTable.RouteTableId, route.DestinationCidrBlock, route.DestinationIpv6CidrBlock) data := map[string]interface{}{ "route_table_id": *routeTable.RouteTableId, + "origin": *route.Origin, } if route.DestinationCidrBlock != nil && *route.DestinationCidrBlock != "" { data["destination_cidr_block"] = *route.DestinationCidrBlock diff --git a/pkg/remote/ec2_scanner_test.go b/pkg/remote/ec2_scanner_test.go index 1f1dd67a..d7c15a40 100644 --- a/pkg/remote/ec2_scanner_test.go +++ b/pkg/remote/ec2_scanner_test.go @@ -1850,10 +1850,12 @@ func TestEC2Route(t *testing.T) { { DestinationCidrBlock: awssdk.String("1.1.1.1/32"), GatewayId: awssdk.String("igw-030e74f73bd67f21b"), + Origin: awssdk.String("CreateRoute"), }, { DestinationIpv6CidrBlock: awssdk.String("::/0"), GatewayId: awssdk.String("igw-030e74f73bd67f21b"), + Origin: awssdk.String("CreateRoute"), }, }, }, @@ -1867,10 +1869,12 @@ func TestEC2Route(t *testing.T) { { DestinationCidrBlock: awssdk.String("0.0.0.0/0"), GatewayId: awssdk.String("igw-030e74f73bd67f21b"), + Origin: awssdk.String("CreateRoute"), }, { DestinationIpv6CidrBlock: awssdk.String("::/0"), GatewayId: awssdk.String("igw-030e74f73bd67f21b"), + Origin: awssdk.String("CreateRoute"), }, }, }, @@ -1890,10 +1894,12 @@ func TestEC2Route(t *testing.T) { { DestinationCidrBlock: awssdk.String("10.1.1.0/24"), GatewayId: awssdk.String("igw-030e74f73bd67f21b"), + Origin: awssdk.String("CreateRoute"), }, { DestinationCidrBlock: awssdk.String("10.1.2.0/24"), GatewayId: awssdk.String("igw-030e74f73bd67f21b"), + Origin: awssdk.String("CreateRoute"), }, }, },