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

Should be able to make sure that objects are not removed when stage is set to production #7

Open
ghost opened this issue Dec 13, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Dec 13, 2017

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.

@sinofseven
Copy link
Owner

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?


Using Prompt

You can use prompt before deleting bucket.

custom:
  remover:
    prompt: true # default value is `false`
    buckets:
      - remover-bucket-a
      - remover-bucket-b

terminal.png

@ghost
Copy link
Author

ghost commented Dec 18, 2017

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.

@sepehr
Copy link

sepehr commented Mar 22, 2018

This would be a very handy feature to have.

@onhate
Copy link

onhate commented Jul 4, 2019

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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants