lib/terraforming/resource/elb.rb in terraforming-0.8.0 vs lib/terraforming/resource/elb.rb in terraforming-0.9.0
- old
+ new
@@ -29,14 +29,20 @@
"cross_zone_load_balancing" => load_balancer_attributes.cross_zone_load_balancing.enabled.to_s,
"dns_name" => load_balancer.dns_name,
"id" => load_balancer.load_balancer_name,
"idle_timeout" => load_balancer_attributes.connection_settings.idle_timeout.to_s,
"instances.#" => load_balancer.instances.length.to_s,
+ "internal" => internal?(load_balancer).to_s,
"name" => load_balancer.load_balancer_name,
"source_security_group" => load_balancer.source_security_group.group_name,
}
+ if load_balancer_attributes.access_log.enabled
+
+ end
+
+ attributes.merge!(access_logs_attributes_of(load_balancer_attributes))
attributes.merge!(healthcheck_attributes_of(load_balancer))
attributes.merge!(listeners_attributes_of(load_balancer))
attributes.merge!(sg_attributes_of(load_balancer))
attributes.merge!(subnets_attributes_of(load_balancer))
attributes.merge!(instances_attributes_of(load_balancer))
@@ -53,10 +59,27 @@
resources
end
end
+ def access_logs_attributes_of(load_balancer_attributes)
+ access_log = load_balancer_attributes.access_log
+
+ if access_log.enabled
+ {
+ "access_logs.#" => "1",
+ "access_logs.0.bucket" => access_log.s3_bucket_name,
+ "access_logs.0.bucket_prefix" => access_log.s3_bucket_prefix,
+ "access_logs.0.interval" => access_log.emit_interval.to_s,
+ }
+ else
+ {
+ "access_logs.#" => "0",
+ }
+ end
+ end
+
def healthcheck_attributes_of(elb)
hashcode = healthcheck_hashcode_of(elb.health_check)
attributes = {
# Now each ELB supports one heatlhcheck
"health_check.#" => "1",
@@ -169,9 +192,13 @@
normalize_module_name(load_balancer.load_balancer_name)
end
def vpc_elb?(load_balancer)
load_balancer.vpc_id != ""
+ end
+
+ def internal?(load_balancer)
+ load_balancer.scheme == "internal"
end
end
end
end