verify arns differently than function names (#23966)

pull/24256/head
Sloane Hertel 8 years ago committed by GitHub
parent e8a0215cd3
commit 4278618746

@ -229,9 +229,12 @@ def validate_params(module, aws):
module.fail_json( module.fail_json(
msg='Function name {0} is invalid. Names must contain only alphanumeric characters and hyphens.'.format(function_name) 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)) 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 # check if 'function_name' needs to be expanded in full ARN format
if not module.params['lambda_function_arn'].startswith('arn:aws:lambda:'): if not module.params['lambda_function_arn'].startswith('arn:aws:lambda:'):
function_name = module.params['lambda_function_arn'] function_name = module.params['lambda_function_arn']

Loading…
Cancel
Save