Class: Ufo::Cfn::Stack::Builder::Base
- Inherits:
-
Base
- Object
- Ufo::CLI::Base
- Base
- Ufo::Cfn::Stack::Builder::Base
- Defined in:
- lib/ufo/cfn/stack/builder/base.rb
Direct Known Subclasses
Conditions, Outputs, Parameters, Resources, Resources::Base, Resources::Dns, Resources::Elb, Resources::IamRoles::Base, Resources::Scaling::Base, Resources::SecurityGroup::Base, Params
Instance Attribute Summary collapse
-
#vars ⇒ Object
readonly
Returns the value of attribute vars.
Attributes inherited from Ufo::CLI::Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
-
#manage_ecs_security_group? ⇒ Boolean
With network mode is awsvpc always create UFO managed ECS security group With bridge mode, never create as there’s no point.
- #managed_security_group(type) ⇒ Object
-
#security_groups(type) ⇒ Object
type: elb or ecs NOTE: Application ELBs always seem to need a security group even though the docs say its not required However, there’s a case where no ELB is created for a worker tier and if the settings are all blank CloudFormation fails to resolve and splits out this error:.
Methods included from Ufo::Concerns
Methods included from Ufo::Concerns::Names
Methods included from AwsServices
#acm, #applicationautoscaling, #aws_options, #cfn, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb, #s3, #ssm_client, #waf_client
Methods included from AwsServices::Concerns
#find_stack, #find_stack_resources, #stack_resources, #status, #task_definition_arns
Methods included from Utils::Sure
Methods included from Utils::Pretty
#pretty_home, #pretty_path, #pretty_time
Methods included from Utils::Logging
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
4 5 6 7 |
# File 'lib/ufo/cfn/stack/builder/base.rb', line 4 def initialize(={}) super @vars = [:vars] end |
Instance Attribute Details
#vars ⇒ Object (readonly)
Returns the value of attribute vars.
3 4 5 |
# File 'lib/ufo/cfn/stack/builder/base.rb', line 3 def vars @vars end |
Class Method Details
.build(options = {}) ⇒ Object
40 41 42 |
# File 'lib/ufo/cfn/stack/builder/base.rb', line 40 def self.build(={}) new().build end |
Instance Method Details
#manage_ecs_security_group? ⇒ Boolean
With network mode is awsvpc always create UFO managed ECS security group With bridge mode, never create as there’s no point.
36 37 38 |
# File 'lib/ufo/cfn/stack/builder/base.rb', line 36 def manage_ecs_security_group? vars[:container][:network_mode].to_s == 'awsvpc' end |
#managed_security_group(type) ⇒ Object
29 30 31 32 |
# File 'lib/ufo/cfn/stack/builder/base.rb', line 29 def managed_security_group(type) logical_id = type == :elb || manage_ecs_security_group? ? "#{type.to_s.camelize}SecurityGroup" : "AWS::NoValue" {Ref: logical_id} end |
#security_groups(type) ⇒ Object
type: elb or ecs NOTE: Application ELBs always seem to need a security group even though the docs say its not required However, there’s a case where no ELB is created for a worker tier and if the settings are all blank CloudFormation fails to resolve and splits out this error:
Template error: every Fn::Split object requires two parameters
So we will not assign security groups at all for case of workers with no security groups at all.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ufo/cfn/stack/builder/base.rb', line 18 def security_groups(type) group_ids = Ufo.config.vpc.security_groups[type] || [] # no security groups at all return if type == :ecs && !manage_ecs_security_group? && group_ids.blank? groups = [] groups += group_ids groups += [managed_security_group(type)] if manage_ecs_security_group? || type == :elb groups end |