1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

verify arns differently than function names (#23966)

This commit is contained in:
Sloane Hertel 2017-05-03 12:01:42 -04:00 committed by GitHub
parent e8a0215cd3
commit 4278618746

View file

@ -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']