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.
- #managed_security_group(type) ⇒ Object
- #managed_security_groups? ⇒ Boolean
-
#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
39 40 41 |
# File 'lib/ufo/cfn/stack/builder/base.rb', line 39 def self.build(={}) new().build end |
Instance Method Details
#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 = managed_security_groups? ? "#{type.camelize}SecurityGroup" : "AWS::NoValue" {Ref: logical_id} end |
#managed_security_groups? ⇒ Boolean
34 35 36 37 |
# File 'lib/ufo/cfn/stack/builder/base.rb', line 34 def managed_security_groups? managed = Ufo.config.vpc.security_groups.managed managed.nil? ? true : managed 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 !managed_security_groups? && group_ids.blank? groups = [] groups += group_ids groups += [managed_security_group(type.to_s.camelize)] if managed_security_groups? groups end |