Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(uninstallation): ignore accounts scheduled for closure #726

Open
wants to merge 1 commit into
base: release/v1.11.2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import {
KMSClient,
ScheduleKeyDeletionCommand,
} from '@aws-sdk/client-kms';
import { ListAccountsCommand, OrganizationsClient } from '@aws-sdk/client-organizations';
import { AccountStatus, ListAccountsCommand, OrganizationsClient } from '@aws-sdk/client-organizations';
import {
DeleteBucketCommand,
DeleteObjectsCommand,
Expand Down Expand Up @@ -710,6 +710,10 @@ export class AcceleratorTool {
organizationsClient.send(new ListAccountsCommand({ NextToken: nextToken })),
);
for (const account of page.Accounts ?? []) {
if (account.Status == AccountStatus.SUSPENDED) {
this.logger.error(`Account ${account.Name} (${account.Email}) is suspended, will not be cleaned up`);
continue;
}
if (account.Id && account.Name) {
accountIds.push({ accountName: account.Name, accountId: account.Id });
}
Expand Down