mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[cloud] Support deadletter queue configuration in lambda
module (#21720)
* Add dead_letter_arn option for Lambda.py * fix logic so DeadLetterConfig can be deleted
This commit is contained in:
parent
776116e809
commit
942ed42eb0
1 changed files with 18 additions and 0 deletions
|
@ -103,6 +103,12 @@ options:
|
||||||
default: None
|
default: None
|
||||||
aliases: [ 'environment' ]
|
aliases: [ 'environment' ]
|
||||||
version_added: "2.3"
|
version_added: "2.3"
|
||||||
|
dead_letter_arn:
|
||||||
|
description:
|
||||||
|
- The parent object that contains the target Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.
|
||||||
|
required: false
|
||||||
|
default: None
|
||||||
|
version_added: "2.3"
|
||||||
author:
|
author:
|
||||||
- 'Steyn Huizinga (@steynovich)'
|
- 'Steyn Huizinga (@steynovich)'
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
|
@ -236,6 +242,7 @@ def main():
|
||||||
vpc_subnet_ids=dict(type='list', default=None),
|
vpc_subnet_ids=dict(type='list', default=None),
|
||||||
vpc_security_group_ids=dict(type='list', default=None),
|
vpc_security_group_ids=dict(type='list', default=None),
|
||||||
environment_variables=dict(type='dict', default=None),
|
environment_variables=dict(type='dict', default=None),
|
||||||
|
dead_letter_arn=dict(type='str', default=None),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -266,6 +273,7 @@ def main():
|
||||||
vpc_subnet_ids = module.params.get('vpc_subnet_ids')
|
vpc_subnet_ids = module.params.get('vpc_subnet_ids')
|
||||||
vpc_security_group_ids = module.params.get('vpc_security_group_ids')
|
vpc_security_group_ids = module.params.get('vpc_security_group_ids')
|
||||||
environment_variables = module.params.get('environment_variables')
|
environment_variables = module.params.get('environment_variables')
|
||||||
|
dead_letter_arn = module.params.get('dead_letter_arn')
|
||||||
|
|
||||||
check_mode = module.check_mode
|
check_mode = module.check_mode
|
||||||
changed = False
|
changed = False
|
||||||
|
@ -324,6 +332,13 @@ def main():
|
||||||
func_kwargs.update({'MemorySize': memory_size})
|
func_kwargs.update({'MemorySize': memory_size})
|
||||||
if (environment_variables is not None) and (current_config['Environment']['Variables'] != environment_variables):
|
if (environment_variables is not None) and (current_config['Environment']['Variables'] != environment_variables):
|
||||||
func_kwargs.update({'Environment':{'Variables': environment_variables}})
|
func_kwargs.update({'Environment':{'Variables': environment_variables}})
|
||||||
|
if dead_letter_arn is not None:
|
||||||
|
if current_config.get('DeadLetterConfig'):
|
||||||
|
if current_config['DeadLetterConfig']['TargetArn'] != dead_letter_arn:
|
||||||
|
func_kwargs.update({'DeadLetterConfig': {'TargetArn': dead_letter_arn}})
|
||||||
|
else:
|
||||||
|
if dead_letter_arn != "":
|
||||||
|
func_kwargs.update({'DeadLetterConfig': {'TargetArn': dead_letter_arn}})
|
||||||
|
|
||||||
# Check for unsupported mutation
|
# Check for unsupported mutation
|
||||||
if current_config['Runtime'] != runtime:
|
if current_config['Runtime'] != runtime:
|
||||||
|
@ -442,6 +457,9 @@ def main():
|
||||||
'Environment':{'Variables': environment_variables}
|
'Environment':{'Variables': environment_variables}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if dead_letter_arn:
|
||||||
|
func_kwargs.update({'DeadLetterConfig': {'TargetARN': dead_letter_arn}})
|
||||||
|
|
||||||
# If VPC configuration is given
|
# If VPC configuration is given
|
||||||
if vpc_subnet_ids or vpc_security_group_ids:
|
if vpc_subnet_ids or vpc_security_group_ids:
|
||||||
if len(vpc_subnet_ids) < 1:
|
if len(vpc_subnet_ids) < 1:
|
||||||
|
|
Loading…
Reference in a new issue