Aws-cdk: Override / Remove y/n prompt

Created on 31 Aug 2019  Â·  15Comments  Â·  Source: aws/aws-cdk

As requested in the Forum:
https://forums.aws.amazon.com/thread.jspa?threadID=308982

Please provide a mechanism to override or remove the y/n prompt for a cdk deploy or destroy.

Big thx!

efformedium feature-request packagtools

Most helpful comment

I think —force should apply to deploy as well

All 15 comments

There’s a flag you can supply that’s something like “—require-approval never” and it will bypass that prompt.

Hey @rhboyd , thanks for the suggestion.

It appears that only works for the deploy but NOT the destroy:
(I have a Java CDK executed in Jenkins)...

cdk -o ./target/cdk.out/ --app mvn exec:java destroy --require-approval never
...BUILD SUCCESS...
Are you sure you want to delete: (y/n)?

cdk -o ./target/cdk.out/ --app mvn exec:java deploy --require-approval never
...BUILD SUCCESS...
: deploying...

does yes | cdk destory ..... work?

https://en.wikipedia.org/wiki/Yes_(Unix)

Yes, yes | cdk destory ... does work.

Not sure if yes is available on Windows via the Linux layer. Still, there should be a command line option anyway.

cdk destroy --force

Superb @jogold

For deploy use --require-approval never
For destroy use --force

This works for on both Windows and Linux

I think —force should apply to deploy as well

Sorry for closing the ticket @eladb

I tried --force for a deploy but the prompt still appeared...I will test and confirm later

@ColWillis, I think @eladb meant that CDK is missing that feature and should have it so he reopened the issue so one of the engineers can add the behavior.

@eladb I’m all for consistency not only in this project but across the board with all other AWS tools, frameworks, CLI’s, etc.

I can confirm --force does not work for a deploy.

I can confirm --force does not work for a deploy.

That's right it needs to be implemented.
When adding the --force functionality to destroy, the deploy behavior should be updated to also take in the same flag for the same behavior.

echo yes | cdk $1 --require-approval never
works for both deploy and destroy.

@badi159 deploy, destroy, and bootstrap all support --force now

Resolving this issue. Feel free to re-open if I've missed something!

I can confirm deploy --force now works

cdk --app "python app.py" deploy * --force

EDIT - I spoke too soon, this does not work (I still get a manual-approval prompt)

Can you confirm which cdk version this should work in? I have tested with 1.57.0 (build 2ccfc50)

Was this page helpful?
0 / 5 - 0 ratings