Skip to content

Commit

Permalink
Fix condition for master account membershipt
Browse files Browse the repository at this point in the history
  • Loading branch information
viren-nadkarni committed Dec 27, 2024
1 parent 5601d8f commit 9bbe518
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions moto/organizations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,9 @@ def list_organizational_units_for_parent(
]

def create_account(self, **kwargs: Any) -> Dict[str, Any]:
if (
self.org is None
or self.account_id not in organizations_backends.master_accounts
if self.org is None or (
self.account_id != self.org.master_account_id
and self.account_id not in organizations_backends.master_accounts
):
raise AWSOrganizationsNotInUseException

Expand All @@ -554,9 +554,9 @@ def create_account(self, **kwargs: Any) -> Dict[str, Any]:
return new_account.create_account_status

def close_account(self, **kwargs: Any) -> None:
if (
self.org is None
or self.account_id not in organizations_backends.master_accounts
if self.org is None or (
self.account_id != self.org.master_account_id
and self.account_id not in organizations_backends.master_accounts
):
raise AWSOrganizationsNotInUseException

Expand Down

0 comments on commit 9bbe518

Please sign in to comment.