[cloud] Delete stack using CloudFormation role ARN if available
This commit is contained in:
parent
cc802624a6
commit
fa313c58c0
1 changed files with 4 additions and 1 deletions
|
@ -651,7 +651,10 @@ def main():
|
||||||
if not stack:
|
if not stack:
|
||||||
result = {'changed': False, 'output': 'Stack not found.'}
|
result = {'changed': False, 'output': 'Stack not found.'}
|
||||||
else:
|
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))
|
result = stack_operation(cfn, stack_params['StackName'], 'DELETE', stack_params.get('ClientRequestToken', None))
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
module.fail_json(msg=boto_exception(err), exception=traceback.format_exc())
|
module.fail_json(msg=boto_exception(err), exception=traceback.format_exc())
|
||||||
|
|
Loading…
Reference in a new issue