lib/builderator/util.rb in builderator-1.0.0.pre.rc.11 vs lib/builderator/util.rb in builderator-1.0.0.pre.rc.12

- old
+ new

@@ -58,18 +58,22 @@ end ## # AWS Clients ## - def ec2 - @ec2 ||= Aws::EC2::Client.new(:region => Config.aws.region) + def ec2(region = Config.aws.region) + clients["ec2-#{region}"] ||= Aws::EC2::Client.new(:region => region) end - def asg - @asg ||= Aws::AutoScaling::Client.new(:region => Config.aws.region) + def asg(region = Config.aws.region) + clients["asg-#{region}"] ||= Aws::AutoScaling::Client.new(:region => region) end private + + def clients + @clients ||= {} + end def _filter_reduce(resource, filters) filters.reduce(true) do |memo, (k, v)| ## Allow for negation with a leading `~` if v[0] == '~'