class Ufo::Stack::Builder::Resources::Ecs
Public Instance Methods
build()
click to toggle source
# File lib/ufo/stack/builder/resources/ecs.rb, line 3 def build attrs = { Type: "AWS::ECS::Service", Properties: properties } attrs[:DependsOn] = "Listener" if @create_elb attrs end
properties()
click to toggle source
# File lib/ufo/stack/builder/resources/ecs.rb, line 14 def properties props = { Cluster: @cluster, DesiredCount: { "Fn::If": [ "EcsDesiredCountIsBlank", {Ref: "AWS::NoValue"}, {Ref: "EcsDesiredCount"} ] }, LoadBalancers: { "Fn::If": [ "CreateTargetGroupIsTrue", [ { ContainerName: @container[:name], ContainerPort: @container[:port], TargetGroupArn: {Ref: "TargetGroup"} } ], { "Fn::If": [ "ElbTargetGroupIsBlank", [], [ { ContainerName: @container[:name], ContainerPort: @container[:port], TargetGroupArn: {Ref: "ElbTargetGroup"} } ] ] } ] }, SchedulingStrategy: {Ref: "EcsSchedulingStrategy"} } props[:TaskDefinition] = @rollback_definition_arn ? @rollback_definition_arn : {Ref: "TaskDefinition"} if @container[:network_mode].to_s == 'awsvpc' props[:NetworkConfiguration] = { AwsvpcConfiguration: { Subnets: {Ref: "EcsSubnets"}, SecurityGroups: security_groups(:ecs) } } if @container[:fargate] props[:LaunchType] = "FARGATE" props[:NetworkConfiguration][:AwsvpcConfiguration][:AssignPublicIp] = "ENABLED" # Works with fargate but doesnt seem to work with non-fargate end end props end