To avoid the `.map.compact!` expression, you can do `security_groups.select { |sg| .. }` instead