Method: Terrafying::Components::StaticSet#attach_load_balancer

Defined in:
lib/terrafying/components/staticset.rb

#attach_load_balancer(load_balancer) ⇒ Object



138
139
140
141
142
143
144
145
146
147
# File 'lib/terrafying/components/staticset.rb', line 138

def attach_load_balancer(load_balancer)
  @instances.product(load_balancer.target_groups).each.with_index { |(instance, target_group), i|
    resource :aws_lb_target_group_attachment, "#{load_balancer.name}-#{@name}-#{i}", {
               target_group_arn: target_group,
               target_id: instance.id,
             }
  }

  self.used_by(load_balancer) if load_balancer.type == "application"
end