refactor: simplify middleware code

following code review feedback. pkg/middlewares/aws_route_table_expander.go
main
sundowndev 2021-04-07 11:10:56 +02:00
parent 257c1260dd
commit 5f60cf44bc
1 changed files with 2 additions and 8 deletions

View File

@ -224,15 +224,9 @@ func (m *AwsRouteTableExpander) handleDefaultTable(table *aws.AwsDefaultRouteTab
func (m *AwsRouteTableExpander) routeExists(routeId string, resourcesFromState []resource.Resource) bool { func (m *AwsRouteTableExpander) routeExists(routeId string, resourcesFromState []resource.Resource) bool {
for _, res := range resourcesFromState { for _, res := range resourcesFromState {
if res.TerraformType() != aws.AwsRouteResourceType { if res.TerraformType() == aws.AwsRouteResourceType && res.TerraformId() == routeId {
continue return true
} }
if res.TerraformId() != routeId {
continue
}
return true
} }
return false return false