if node[:aws_swiss][:port].nil?
  
  this_layer = node[:opsworks][:instance][:layers].first
  puts "first instance is: #{node[:opsworks][:layers][this_layer][:instances].values.first.inspect}"
  this_layers_cidrs = node[:opsworks][:layers][this_layer][:instances].values.reduce([]) { |result, instance|
    result << (instance[:ip] + "/32")
    result
  }
  
  Chef::Log.info("#{this_layers_cidrs.size} cidrs in this layer: #{this_layers_cidrs.sort.join(',')}")

  swiss_rds_enforcer do
    aws_access_key_id     node[:aws_swiss][:aws_access_key_id]
    aws_secret_access_key node[:aws_swiss][:aws_secret_access_key]
    region                node[:opsworks][:instance][:region]
    cidr_list             this_layers_cidrs
    security_group_list   [ node[:aws_swiss][:security_group], node[:aws_swiss][:fallback_group] ]
  end
end

if node[:aws_swiss][:port].nil?
  
  # CHANGE TO USE ALL INSTANCES IN THIS STACK
  # node[:opsworks][:layers][layer-shortname][:instances][instance-shortname][:elastic_ip] OR [:ip]
  this_stacks_cidrs = []
  node[:opsworks][:layers].each { | layer_shortname, layer_desc|
    layer_desc[:instances].values.each{ |instance|
      cidr = instance[:elastic_ip]
      if cidr.nil?
        cidr = instance[:ip]
      end
      this_stacks_cidrs << (cidr + "/32")
    }
  }
  this_stacks_cidrs.sort!.uniq!
  
  Chef::Log.info("#{this_stacks_cidrs.size} cidrs in this stack: #{this_stacks_cidrs.join(',')}")

  swiss_rds_enforcer do
    aws_access_key_id     node[:aws_swiss][:aws_access_key_id]
    aws_secret_access_key node[:aws_swiss][:aws_secret_access_key]
    region                node[:opsworks][:instance][:region]
    cidr_list             this_stacks_cidrs
    security_group_list   [ node[:aws_swiss][:security_group], node[:aws_swiss][:fallback_group] ]
  end
end

Use addresses of instances in the whole stack
Use addresses of instances in the whole stack