diff --git a/pkg/vpcmodel/grouping.go b/pkg/vpcmodel/grouping.go index c2741d3e7..759a522aa 100644 --- a/pkg/vpcmodel/grouping.go +++ b/pkg/vpcmodel/grouping.go @@ -169,17 +169,11 @@ func (g *GroupConnLines) groupExternalAddressesForSubnets() { continue } connString := conns.EnhancedString() - hasExternal := false - switch dst.(type) { - case Node: - if dst.(Node).IsPublicInternet() { - hasExternal = true - g.srcToDst.addPublicConnectivity(src, connString, dst.(Node)) - } - } - // since pgw enable only egress src can not be public internet - // not an external connection in source or destination - nothing to group, just append - if !hasExternal { + if dstNode, ok := dst.(Node); ok && dstNode.IsPublicInternet() { + g.srcToDst.addPublicConnectivity(src, connString, dstNode) + } else { + // since pgw enable only egress src can not be public internet + // not an external connection in source or destination - nothing to group, just append res = append(res, &GroupedConnLine{src, dst, connString}) } } diff --git a/pkg/vpcmodel/subnetsConnectivity.go b/pkg/vpcmodel/subnetsConnectivity.go index 6bef56410..7667ac04d 100644 --- a/pkg/vpcmodel/subnetsConnectivity.go +++ b/pkg/vpcmodel/subnetsConnectivity.go @@ -1,9 +1,10 @@ package vpcmodel import ( + "github.com/np-guard/vpc-network-config-analyzer/pkg/common" + "errors" "fmt" - "github.com/np-guard/vpc-network-config-analyzer/pkg/common" ) // VPCsubnetConnectivity captures allowed connectivity for subnets, considering nacl and pgw resources