feat: Add lacework cloud-account backup/delete --bulk/restore/cleanup commands - #1844
Merged
Conversation
PengyuanZhao
marked this pull request as ready for review
July 14, 2026 21:45
lokesh-vadlamudi
self-requested a review
July 15, 2026 16:45
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira/Github ticket
https://lacework.atlassian.net/browse/LINK-4430
Summary
Adds four composable
lacework cloud-accountsubcommands for backing up, bulk-deleting, restoring, and cleaning up cloud account integrations. These are general-purpose primitives (keyed off the existing--typeregistry, so they work for any cloud-account type); together they support migrating from many single-account AWS Config (AwsCfg) integrations to a single org-level integration, but they're reusable beyond that scenario.New / changed commands
cloud-account backup -t <Type> [--account-ids | --account-ids-file] [-f <file>]Writes the integrations of a given type to a local JSON file. For AWS types,
--account-idsfilters by the account parsed from each role ARN. Prompts for a save directory when-fisn't given (auto-generates the filename); non-interactive runs use the current directory.cloud-account delete --bulk --file <backup> [--dry-run]Extends the existing
deletecommand to remove every integration listed in a backup file.delete <guid>still works.cloud-account restore --file <backup> [--dry-run]Re-creates the integrations from a backup (undoes
delete --bulk). Because Create is server-assigned, restored integrations get new GUIDs — the command prints an old→new GUID mapping table.cloud-account cleanup --file <backup> [-t <Type>] [--dry-run] [--aws-profile] [--aws-region] [--assume-role-name] [--no-assume-role]Deletes the AWS resources a deleted AWS Config integration leaves behind: the IAM role and its customer-managed/inline policies (AWS-managed policies such as
SecurityAuditare only detached, never deleted), and the owning CloudFormation stack.cleanupdetails--assume-role-name(defaultOrganizationAccountAccessRole) into each target account. Auto-detects when the base credentials are already in the target account (e.g. the management account's own integration) and uses them directly;--no-assume-roleforces direct credentials.DescribeStackResources(PhysicalResourceId=<role>), searching the account's regions (base/--aws-regionfirst, then the rest) since CloudFormation is regional. Deletes the stack in its own region and waits for completion. IAM cleanup and stack deletion are independent — a failure of one does not block the other.Suggested migration workflow
cloud-account backup -t AwsCfg --account-ids-file accounts.txtcloud-account delete --bulk --file <backup>cloud-account restore --file <backup>cloud-account cleanup --file <backup>Implementation notes
--apply/confirmation and honor--noninteractiveand--json.github.com/aws/aws-sdk-go-v2/service/cloudformationdependency (vendored).How did you test this change?
Manually test all new commands.