class Ufo::Stack::Builder::Resources::TargetGroup

Public Instance Methods

build() click to toggle source
# File lib/ufo/stack/builder/resources/target_group.rb, line 3
def build
  {
    Type: "AWS::ElasticLoadBalancingV2::TargetGroup",
    Condition: "CreateTargetGroupIsTrue",
    Properties: properties,
  }
end
properties() click to toggle source
# File lib/ufo/stack/builder/resources/target_group.rb, line 11
def properties
  props = {
    VpcId: {Ref: "Vpc"},
    Tags: [
      {
        Key: "Name",
        Value: @stack_name,
      }
    ],
    Protocol: @default_target_group_protocol,
    Port: 80,
    HealthCheckIntervalSeconds: 10,
    HealthyThresholdCount: 2,
    UnhealthyThresholdCount: 2,
    TargetGroupAttributes: [
      {
        Key: "deregistration_delay.timeout_seconds",
        Value: 10
      }
    ]
  }

  props[:TargetType] = "ip" if @container[:network_mode] == "awsvpc"
  props[:HealthCheckPort] = @container[:port] if @elb_type == "network" && @network_mode == "awsvpc"

  props
end