command: "terraform apply" uses interactive confirmation by default #16502
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the 0.10 release we added an opt-in mode where Terraform would prompt interactively for confirmation during apply. We made this opt-in to give those who wrap Terraform in automation some time to update their scripts to explicitly opt out of this behavior where appropriate.
Here we switch the default so that a
terraform apply
with no arguments will -- if it computes a non-empty diff -- display the diff and wait for the user to type "yes" in similar vein to theterraform destroy
command.This makes the commonly-used
terraform apply
a safe workflow for interactive use, soterraform plan -out=...
is now mainly for use in automation where a separate planning step is used. Theapply
command remains non-interactive when given an explicit plan file, andterraform plan
with no arguments can still be used for a one-shot plan for testing purposes.The previous behavior -- though not recommended -- can be obtained by explicitly setting the
-auto-approve
option on the apply command line, and indeed that is how all of the tests are updated here so that they can continue to run non-interactively.