##// END OF EJS Templates
automation: detach policies before deleting role...
Gregory Szorc -
r42462:fcb97cb9 default
parent child Browse files
Show More
@@ -505,6 +505,10 b" def remove_resources(c, prefix='hg-'):"
505
505
506 for role in iamresource.roles.all():
506 for role in iamresource.roles.all():
507 if role.name.startswith(prefix):
507 if role.name.startswith(prefix):
508 for p in role.attached_policies.all():
509 print('detaching policy %s from %s' % (p.arn, role.name))
510 role.detach_policy(PolicyArn=p.arn)
511
508 print('removing role %s' % role.name)
512 print('removing role %s' % role.name)
509 role.delete()
513 role.delete()
510
514
General Comments 0
You need to be logged in to leave comments. Login now