Merge pull request #2552 from bblommers/IAM-role-name-validation
IAM - Validate duplicate role names
This commit is contained in:
commit
9a30b8e8d5
3 changed files with 49 additions and 3 deletions
|
|
@ -820,7 +820,7 @@ class IAMBackend(BaseBackend):
|
|||
)
|
||||
if policy.arn in self.managed_policies:
|
||||
raise EntityAlreadyExists(
|
||||
"A policy called {} already exists. Duplicate names are not allowed.".format(
|
||||
"A policy called {0} already exists. Duplicate names are not allowed.".format(
|
||||
policy_name
|
||||
)
|
||||
)
|
||||
|
|
@ -898,6 +898,10 @@ class IAMBackend(BaseBackend):
|
|||
permissions_boundary
|
||||
),
|
||||
)
|
||||
if [role for role in self.get_roles() if role.name == role_name]:
|
||||
raise EntityAlreadyExists(
|
||||
"Role with name {0} already exists.".format(role_name)
|
||||
)
|
||||
|
||||
clean_tags = self._tag_verification(tags)
|
||||
role = Role(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue