Sha256: 6986d303258cb97dac394a5bcc03ceff2b8afe00f7d647465e1ac7e3a6689e6d
Contents?: true
Size: 1.41 KB
Versions: 18
Compression:
Stored size: 1.41 KB
Contents
class Ufo::Cfn::Stack class Params < Ufo::Cfn::Stack::Builder::Base def build logger.info "Building params" params = { Vpc: vpc.id, ElbSubnets: vpc.elb_subnets, EcsSubnets: vpc.ecs_subnets, CreateElb: vars[:create_elb] ? "true" : "false", ElbTargetGroup: vars[:elb_target_group].to_s, EcsSchedulingStrategy: Ufo.config.ecs.scheduling_strategy, } params[:EcsDesiredCount] = desired_count.to_s if desired_count # Note: cfn template is type String so it can be optional params = Ufo::Utils::Squeezer.new(params).squeeze parameters = params.map do |k,v| if v == :use_previous_value { parameter_key: k, use_previous_value: true } else { parameter_key: k, parameter_value: v } end end save_params(parameters) parameters end private def desired_count Ufo.config.ecs.desired_count end # No need to save template. That's already saved. def save_params(parameters) params = parameters.dup.map do |param| param.transform_keys do |key| key.to_s.camelize end end path = "#{Ufo.root}/.ufo/output/params.json" FileUtils.mkdir_p(File.dirname(path)) IO.write(path, JSON.pretty_generate(params)) logger.info " #{pretty_path(path)}" end def vpc Vpc.new(@options) end memoize :vpc end end
Version data entries
18 entries across 18 versions & 1 rubygems