[cloud] Delete stack using CloudFormation role ARN if available

This commit is contained in:
Justin Menga 2017-10-30 07:13:34 +13:00 committed by Ryan S. Brown
parent cc802624a6
commit fa313c58c0

View file

@ -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())