Do you need to check if self.data[:security_groups] is set? I think that it is initialized to an empty hash in lib/fog/aws/elasticache.rb; then is it enough to use has_key?(name) to decide if the security group name has been used?