From 4278618746be2456d009c33e6563aa69f39f0872 Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Wed, 3 May 2017 12:01:42 -0400 Subject: [PATCH] verify arns differently than function names (#23966) --- lib/ansible/modules/cloud/amazon/lambda_event.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/amazon/lambda_event.py b/lib/ansible/modules/cloud/amazon/lambda_event.py index 2a0426c964..f24619f12f 100644 --- a/lib/ansible/modules/cloud/amazon/lambda_event.py +++ b/lib/ansible/modules/cloud/amazon/lambda_event.py @@ -229,9 +229,12 @@ def validate_params(module, aws): module.fail_json( msg='Function name {0} is invalid. Names must contain only alphanumeric characters and hyphens.'.format(function_name) ) - if len(function_name) > 64: + if len(function_name) > 64 and not function_name.startswith('arn:aws:lambda:'): module.fail_json(msg='Function name "{0}" exceeds 64 character limit'.format(function_name)) + elif len(function_name) > 140 and function_name.startswith('arn:aws:lambda:'): + module.fail_json(msg='ARN "{0}" exceeds 140 character limit'.format(function_name)) + # check if 'function_name' needs to be expanded in full ARN format if not module.params['lambda_function_arn'].startswith('arn:aws:lambda:'): function_name = module.params['lambda_function_arn']