Confirm SLS command


#1

Is there a way to ask for a confirmation (Y/N) when running a sls command, especially sls remove?

I’d like to add this kind of security warning before breaking down my production stage for instance.

I wonder what can be used there, without assuming a custom “confirm” bash function defined in bashrc or alike.


#2

As mentioned the sls remove command doesn’t confirm that you actually want to proceed with removing your serverless stack, and you could wrap the sls remove in a custom bash function. However, I believe this would indeed be a nice feature to add to the cli itself, and imagine other users would appreciate this feature. You could submit an issue to the serverless community on the GitHub Serverless Repo and it could get added to the project. Or if you’d be interested you could add this yourself by contributing to the project.


#3

Asked on GitHub: https://github.com/serverless/serverless/issues/5356


#4

@Vadorequest-SL

(I have added a similar comment in the GitHub issue you opened, but I am posting here as well.)

I have written a plugin called serverless-confirm-command that allows you to make commands require confirmation before execution. It might suit your needs. :slightly_smiling_face: