Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWSmappingfix-ELBv1&v2<--ENI #1331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cartography/intel/aws/ec2/network_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ def transform_network_interface_data(data_list: List[Dict[str, Any]], region: st
elb_v2_id = None
elb_match = re.match(r'^ELB (?:net|app)/([^\/]+)\/(.*)', network_interface.get('Description', ''))
if elb_match:
elb_v1_id = f'{elb_match[1]}-{elb_match[2]}.elb.{region}.amazonaws.com'
elb_v2_id = elb_match[1]
else:
elb_match = re.match(r'^ELB (.*)', network_interface.get('Description', ''))
if elb_match:
elb_v2_id = elb_match[1]
elb_v1_id = elb_match[1]
# TODO issue #1024 change this to arn when ready
network_interface_id = network_interface['NetworkInterfaceId']
network_interface_list.append(
Expand All @@ -79,6 +79,7 @@ def transform_network_interface_data(data_list: List[Dict[str, Any]], region: st
'SubnetId': network_interface['SubnetId'],
'ElbV1Id': elb_v1_id,
'ElbV2Id': elb_v2_id,
'Region': region,
},
)
if network_interface.get('PrivateIpAddresses'):
Expand Down
2 changes: 1 addition & 1 deletion cartography/models/aws/ec2/networkinterfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class EC2NetworkInterfaceToElbV2RelProperties(CartographyRelProperties):
class EC2NetworkInterfaceToElbV2(CartographyRelSchema):
target_node_label: str = 'LoadBalancerV2'
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
{'id': PropertyRef('ElbV2Id')},
{'name': PropertyRef('ElbV2Id'), 'region': PropertyRef('Region')},
)
direction: LinkDirection = LinkDirection.INWARD
rel_label: str = "NETWORK_INTERFACE"
Expand Down
Loading