Open ghost opened 6 years ago
I think your concern is correct. You can display the prompt before deleting the object with the PR you received earlier. Can you satisfy your request with this function?
You can use prompt before deleting bucket.
custom:
remover:
prompt: true # default value is `false`
buckets:
- remover-bucket-a
- remover-bucket-b
I think that is a great solution if you are manually uploading. What if the prompt displayed by default if your env was set to prod
or production
? Either way, it is a great solution, though I would still be concerned about an automated process. How about if you allow a user to specify when to take no action in their yml file? For example:
custom:
remover:
no-action:
stage: production
env:
- no-delete
buckets:
- remover-bucket-a
- remover-bucket-b
In this case, if the stage was set to production OR and environment variable was set to no-delete, no action would be taken. I think the stage is the most important thing, I put the env distinction in there to cover any other use cases that might have the same concern.
This would be a very handy feature to have.
For those getting into this issue willing to have different cleanup setup for each environment, this is the approach I used and it works fine.
custom:
remover-config:
default:
buckets:
- a-bucket-name-goes-here
prod:
buckets: []
remover: ${self:custom.remover-config.${self:custom.stage}, self:custom.remover-config.default}
It feels dangerous that you can destroy all of the data in production with a single accidental command. This plugin should allow you to specify no action given a specific stage setting. That way there is at least some protection from erasing all production data.