Class: Ufo::Stack::Builder::Resources::Ecs
- Defined in:
- lib/ufo/stack/builder/resources/ecs.rb
Instance Method Summary collapse
Methods inherited from Base
build, #copy_instance_variables, #initialize, #managed_security_group, #managed_security_groups?, #security_groups
Methods included from Ufo::Settings
Constructor Details
This class inherits a constructor from Ufo::Stack::Builder::Base
Instance Method Details
#build ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# 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 ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# 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 |