Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions cfndsl_ext/lambda_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def render_lambda_functions(cfndsl, lambdas, lambda_metadata, distribution)
Runtime(lambda_config['runtime'])
Timeout(lambda_config['timeout'] || 10)
if !lambda_config['vpc'].nil? && lambda_config['vpc']
# TODO implement VPC config
VpcConfig lambda_config['vpc']
end

if !lambda_config['named'].nil? && lambda_config['named']
Expand All @@ -53,7 +53,7 @@ def render_lambda_functions(cfndsl, lambdas, lambda_metadata, distribution)
end

Lambda_Version("#{name}Version#{lambda_metadata['version'][key]}") do
DeletionPolicy('Retain')
DeletionPolicy lambda_config.has_key?('deletion_policy') ? lambda_config['deletion_policy'] : ('Retain')
FunctionName(Ref(name))
CodeSha256(lambda_metadata['sha256'][key])
end
Expand Down Expand Up @@ -104,7 +104,13 @@ def render_lambda_functions(cfndsl, lambdas, lambda_metadata, distribution)

if lambda_config.has_key?('log_retention')
Logs_LogGroup("#{name}LogGroup") do
LogGroupName "/aws/lambda/#{name}"
if !lambda_config['named'].nil? && lambda_config['named']
if lambda_config['function_name'].nil?
LogGroupName "/aws/lambda/#{name}"
else
LogGroupName FnJoin('/', ['/aws/lambda', FnSub(lambda_config['function_name'])])
end
end
RetentionInDays lambda_config['log_retention'].to_i
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cfhighlander.compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def compileCfnDsl(out_format)
component_cfndsl.gsub!("\n", "\n\t")
component_cfndsl.gsub!("\r\n", "\r\n\t")
# render cfndsl
renderer = ERB.new(File.read("#{__dir__}/../templates/cfndsl.component.template.erb"), nil, '-')
renderer = ERB.new(File.read("#{__dir__}/../templates/cfndsl.component.template.erb"), trim_mode: '-')
cfn_template = renderer.result(OpenStruct.new({
'dsl' => dsl,
'component_cfndsl' => component_cfndsl,
Expand Down