From fa313c58c0be408680b317ad985fc95205642d39 Mon Sep 17 00:00:00 2001 From: Justin Menga Date: Mon, 30 Oct 2017 07:13:34 +1300 Subject: [PATCH] [cloud] Delete stack using CloudFormation role ARN if available --- lib/ansible/modules/cloud/amazon/cloudformation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/amazon/cloudformation.py b/lib/ansible/modules/cloud/amazon/cloudformation.py index 920a4d7aaab..48e6d6aa91b 100644 --- a/lib/ansible/modules/cloud/amazon/cloudformation.py +++ b/lib/ansible/modules/cloud/amazon/cloudformation.py @@ -651,7 +651,10 @@ def main(): if not stack: result = {'changed': False, 'output': 'Stack not found.'} else: - cfn.delete_stack(StackName=stack_params['StackName']) + if stack_params.get('RoleARN') is None: + cfn.delete_stack(StackName=stack_params['StackName']) + else: + cfn.delete_stack(StackName=stack_params['StackName'], RoleARN=stack_params['RoleARN']) result = stack_operation(cfn, stack_params['StackName'], 'DELETE', stack_params.get('ClientRequestToken', None)) except Exception as err: module.fail_json(msg=boto_exception(err), exception=traceback.format_exc())