lib/terraforming/resource/elb.rb in terraforming-0.1.3 vs lib/terraforming/resource/elb.rb in terraforming-0.1.4
- old
+ new
@@ -5,24 +5,24 @@
def self.tf(client: Aws::ElasticLoadBalancing::Client.new)
self.new(client).tf
end
- def self.tfstate(client: Aws::ElasticLoadBalancing::Client.new, tfstate_base: nil)
- self.new(client).tfstate(tfstate_base)
+ def self.tfstate(client: Aws::ElasticLoadBalancing::Client.new)
+ self.new(client).tfstate
end
def initialize(client)
@client = client
end
def tf
apply_template(@client, "tf/elb")
end
- def tfstate(tfstate_base)
- resources = load_balancers.inject({}) do |result, load_balancer|
+ def tfstate
+ load_balancers.inject({}) do |resources, load_balancer|
load_balancer_attributes = load_balancer_attributes_of(load_balancer)
attributes = {
"availability_zones.#" => load_balancer.availability_zones.length.to_s,
"connection_draining" => load_balancer_attributes.connection_draining.enabled.to_s,
"connection_draining_timeout" => load_balancer_attributes.connection_draining.timeout.to_s,
@@ -41,21 +41,19 @@
attributes.merge!(subnets_attributes_of(load_balancer))
attributes.merge!(instances_attributes_of(load_balancer))
attributes.merge!(tags_attributes_of(load_balancer))
- result["aws_elb.#{module_name_of(load_balancer)}"] = {
+ resources["aws_elb.#{module_name_of(load_balancer)}"] = {
"type" => "aws_elb",
"primary" => {
"id" => load_balancer.load_balancer_name,
"attributes" => attributes
}
}
- result
+ resources
end
-
- generate_tfstate(resources, tfstate_base)
end
def healthcheck_attributes_of(elb)
hashcode = healthcheck_hashcode_of(elb.health_check)
attributes = {