Sha256: e8e25be59cdefc6e323f75729818740078681dca0391982e9f40406100f498f2

Contents?: true

Size: 988 Bytes

Versions: 3

Compression:

Stored size: 988 Bytes

Contents

class Ufo::Cfn::Stack::Builder::Resources
  class TargetGroup < Base
    def build
      {
        Type: "AWS::ElasticLoadBalancingV2::TargetGroup",
        Condition: "CreateTargetGroupIsTrue",
        Properties: properties,
      }
    end

    def properties
      props = {
        VpcId: {Ref: "Vpc"},
        Tags: [
          {
            Key: "Name",
            Value: @stack_name,
          }
        ],
        Protocol: vars[:default_target_group_protocol],
        Port: 80,
        HealthCheckIntervalSeconds: 10,
        HealthyThresholdCount: 2,
        UnhealthyThresholdCount: 2,
        TargetGroupAttributes: [
          {
            Key: "deregistration_delay.timeout_seconds",
            Value: 10
          }
        ]
      }

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

      props
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ufo-6.0.2 lib/ufo/cfn/stack/builder/resources/target_group.rb
ufo-6.0.1 lib/ufo/cfn/stack/builder/resources/target_group.rb
ufo-6.0.0 lib/ufo/cfn/stack/builder/resources/target_group.rb