2222import traceback
2323import lambda_uploader
2424
25- from os import getcwd , path
25+ from os import getcwd , path , getenv
2626from lambda_uploader import package , config , uploader
2727
2828LOG = logging .getLogger (__name__ )
@@ -47,7 +47,7 @@ def _print(txt):
4747def _execute (args ):
4848 pth = path .abspath (args .function_dir )
4949
50- cfg = config .Config (pth , args .config )
50+ cfg = config .Config (pth , args .config , role = args . role )
5151
5252 _print ('Building Package' )
5353 pkg = package .build_package (pth , cfg .requirements )
@@ -97,6 +97,10 @@ def main(arv=None):
9797 action = 'store_const' ,
9898 help = 'publish an upload to an immutable version' ,
9999 const = True )
100+ parser .add_argument ('--role' , dest = 'role' ,
101+ default = getenv ('LAMBDA_UPLOADER_ROLE' ),
102+ help = ('IAM role to assign the lambda function, '
103+ 'can be set with $LAMBDA_UPLOADER_ROLE' ))
100104 parser .add_argument ('--profile' , dest = 'profile' ,
101105 help = 'specify AWS cli profile' )
102106 alias_help = 'alias for published version (WILL SET THE PUBLISH FLAG)'
0 commit comments