@@ -492,37 +492,27 @@ def lambda_resources(
492492 }
493493 )
494494
495- if self .runtime is not None :
496- params ["Runtime" ] = self .runtime
497-
498- if self .handler is not None :
499- params ["Handler" ] = self .handler
495+ optional_params = {
496+ "Runtime" : self .runtime ,
497+ "Handler" : self .handler ,
498+ "MemorySize" : self .memory_size ,
499+ "ReservedConcurrentExecutions" : self .reserved_concurrent_executions ,
500+ "LoggingConfig" : self .logging_config ,
501+ "DeadLetterConfig" : self .dl_config ,
502+ "VpcConfig" : self .vpc_config ,
503+ }
504+ params .update ({k : v for k , v in optional_params .items () if v is not None })
500505
501506 if self .architecture is not None :
502507 params ["Architectures" ] = [self .architecture .value ]
503508
504- if self .memory_size is not None :
505- params ["MemorySize" ] = self .memory_size
506-
507509 if self .ephemeral_storage_size is not None :
508510 params ["EphemeralStorage" ] = awslambda .EphemeralStorage (
509511 Size = self .ephemeral_storage_size
510512 )
511513 if self .environment is not None :
512514 params ["Environment" ] = awslambda .Environment (Variables = self .environment )
513515
514- if self .reserved_concurrent_executions is not None :
515- params ["ReservedConcurrentExecutions" ] = self .reserved_concurrent_executions
516-
517- if self .logging_config is not None :
518- params ["LoggingConfig" ] = self .logging_config
519-
520- if self .dl_config is not None :
521- params ["DeadLetterConfig" ] = self .dl_config
522-
523- if self .vpc_config is not None :
524- params ["VpcConfig" ] = self .vpc_config
525-
526516 result = [awslambda .Function (name_to_id (self .name ), ** params )]
527517 # If retention duration is given provide a log group.
528518 # If not provided the lambda creates a log group with
0 commit comments