cloud-nuke
cloud-nuke copied to clipboard
UI overhaul and per-resource error reporting
Demo
- Nuking multiple resource types, mix of success and error outcomes
- Nuking multiple resource types successfully
Description
These changes:
- Implement support for displaying the status of a given cloud-nuke run in a pterm.sh table
- Attempt to provide a per-resource status that is more accurate, rather than returning
nilwhen something in a batch process fails - Suppress excessive
stdoutlogging by replacing allInfofcalls withDebugf, so that the original information can still be retrieved by passing--log-level DEBUG - Implement a spinner that displays
Nuking resources...for the duration of the cloud-nuke run. On run completion, the spinner is replaced with the table.
These changes are conceived of as an incremental improvement to the legibility of cloud-nuke's output, and a prerequisite to work that will leverage cloud-nuke to programmatically tear down deployed Reference Architectures.
Example tables
❯ aws-vault exec nuketest -- ./cloud-nuke \
aws \
--region us-east-1 \
--resource-type sqs \
--resource-type snstopic \
--resource-type lambda \
--resource-type elasticache
[cloud-nuke] INFO[2022-09-06T14:50:16-04:00] The following resource types will be nuked:
[cloud-nuke] INFO[2022-09-06T14:50:16-04:00] - sqs
[cloud-nuke] INFO[2022-09-06T14:50:16-04:00] - snstopic
[cloud-nuke] INFO[2022-09-06T14:50:16-04:00] - lambda
[cloud-nuke] INFO[2022-09-06T14:50:16-04:00] - elasticache
[cloud-nuke] INFO[2022-09-06T14:50:17-04:00] Retrieving active AWS resources in [us-east-1]
[cloud-nuke] INFO[2022-09-06T14:50:18-04:00] The following 2 AWS resources will be nuked:
[cloud-nuke] INFO[2022-09-06T14:50:18-04:00] * lambda myFunction us-east-1
[cloud-nuke] INFO[2022-09-06T14:50:18-04:00] * elasticache test-redis us-east-1
THE NEXT STEPS ARE DESTRUCTIVE AND COMPLETELY IRREVERSIBLE, PROCEED WITH CAUTION!!!
Are you sure you want to nuke all listed resources? Enter 'nuke' to confirm (or exit with ^C): nuke
Nuking complete:
┌─────────────────────────────────────────────────────┐
| Identifier | Resource Type | Deleted Successfully |
| myFunction | Lambda function | ✅ |
| --------------------------------------------------- |
| test-redis | Elasticache | ✅ |
└─────────────────────────────────────────────────────┘
❯ aws-vault exec nuketest -- ./cloud-nuke \
aws \
--region us-east-1 \
--resource-type sqs \
--resource-type snstopic \
--resource-type lambda \
--resource-type elasticache
[cloud-nuke] INFO[2022-09-06T15:03:02-04:00] The following resource types will be nuked:
[cloud-nuke] INFO[2022-09-06T15:03:02-04:00] - sqs
[cloud-nuke] INFO[2022-09-06T15:03:02-04:00] - snstopic
[cloud-nuke] INFO[2022-09-06T15:03:02-04:00] - lambda
[cloud-nuke] INFO[2022-09-06T15:03:02-04:00] - elasticache
[cloud-nuke] INFO[2022-09-06T15:03:03-04:00] Retrieving active AWS resources in [us-east-1]
[cloud-nuke] INFO[2022-09-06T15:03:04-04:00] The following 3 AWS resources will be nuked:
[cloud-nuke] INFO[2022-09-06T15:03:04-04:00] * snstopic arn:aws:sns:us-east-1:297077893752:TopicOne us-east-1
[cloud-nuke] INFO[2022-09-06T15:03:04-04:00] * snstopic arn:aws:sns:us-east-1:297077893752:TopicThree us-east-1
[cloud-nuke] INFO[2022-09-06T15:03:04-04:00] * snstopic arn:aws:sns:us-east-1:297077893752:TopicTwo.fifo us-east-1
THE NEXT STEPS ARE DESTRUCTIVE AND COMPLETELY IRREVERSIBLE, PROCEED WITH CAUTION!!!
Are you sure you want to nuke all listed resources? Enter 'nuke' to confirm (or exit with ^C): nuke
Nuking complete:
┌─────────────────────────────────────────────────────────────────────────────────────────┐
| Identifier | Resource Type | Deleted Successfully |
| arn:aws:sns:us-east-1:297077893752:TopicThree | SNS Topic | ✅ |
| --------------------------------------------------------------------------------------- |
| arn:aws:sns:us-east-1:297077893752:TopicOne | SNS Topic | ✅ |
| --------------------------------------------------------------------------------------- |
| arn:aws:sns:us-east-1:297077893752:TopicTwo.fifo | SNS Topic | ✅ |
└─────────────────────────────────────────────────────────────────────────────────────────┘
Fixes #357.
TODOs
Read the Gruntwork contribution guidelines.
- [ ] Update the docs.
- [ ] Run the relevant tests successfully, including pre-commit checks.
- [ ] Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
- [ ] Include release notes. If this PR is backward incompatible, include a migration guide.
Release Notes (draft)
Added / Removed / Updated [X].
Migration Guide
Overall, LGTM 👍