Class: Ufo::Stack::Builder::Resources::TaskDefinition

Inherits:
Base
  • Object
show all
Defined in:
lib/ufo/stack/builder/resources/task_definition.rb,
lib/ufo/stack/builder/resources/task_definition/reconstructor.rb

Defined Under Namespace

Classes: Reconstructor

Instance Method Summary collapse

Methods inherited from Base

build, #copy_instance_variables, #initialize, #managed_security_group, #managed_security_groups_enabled?, #security_groups

Methods included from Ufo::Settings

#cfn, #network, #settings

Constructor Details

This class inherits a constructor from Ufo::Stack::Builder::Base

Instance Method Details

#buildObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/ufo/stack/builder/resources/task_definition.rb', line 3

def build
  return if @rollback_definition_arn

  {
    Type: "AWS::ECS::TaskDefinition",
    Properties: properties,
    DeletionPolicy: "Retain",
    UpdateReplacePolicy: "Retain",
  }
end

#propertiesObject



14
15
16
17
18
19
20
21
22
# File 'lib/ufo/stack/builder/resources/task_definition.rb', line 14

def properties
  props = Reconstructor.new(@task_definition).reconstruct

  # Decorate with iam roles if needed
  props[:TaskRoleArn] = {"Fn::GetAtt": "TaskRole.Arn"} if Roles::TaskRole.build?
  props[:ExecutionRoleArn] = {"Fn::GetAtt": "ExecutionRole.Arn"} if Roles::ExecutionRole.build?

  props
end