diff --git a/command/apply.go b/command/apply.go index c65b2df5178f..bffddd826a63 100644 --- a/command/apply.go +++ b/command/apply.go @@ -28,7 +28,7 @@ type ApplyCommand struct { } func (c *ApplyCommand) Run(args []string) int { - var destroyForce, refresh, autoApprove bool + var destroyForce, refresh, applyForce bool args, err := c.Meta.process(args, true) if err != nil { return 1 @@ -45,7 +45,7 @@ func (c *ApplyCommand) Run(args []string) int { } cmdFlags.BoolVar(&refresh, "refresh", true, "refresh") if !c.Destroy { - cmdFlags.BoolVar(&autoApprove, "auto-approve", false, "skip interactive approval of plan before applying") + cmdFlags.BoolVar(&applyForce, "force", false, "do not ask for input to approve plan before applying") } cmdFlags.IntVar( &c.Meta.parallelism, "parallelism", DefaultParallelism, "parallelism") @@ -155,7 +155,7 @@ func (c *ApplyCommand) Run(args []string) int { opReq.Plan = plan opReq.PlanRefresh = refresh opReq.Type = backend.OperationTypeApply - opReq.AutoApprove = autoApprove + opReq.AutoApprove = applyForce opReq.DestroyForce = destroyForce // Perform the operation @@ -250,7 +250,7 @@ Options: -lock-timeout=0s Duration to retry a state lock. - -auto-approve Skip interactive approval of plan before applying. + -force Don't ask for input to approve plan before applying. -input=true Ask for input for variables if not directly set. diff --git a/command/apply_test.go b/command/apply_test.go index 968f8595f57e..b5cf383942b3 100644 --- a/command/apply_test.go +++ b/command/apply_test.go @@ -35,7 +35,7 @@ func TestApply(t *testing.T) { args := []string{ "-state", statePath, - "-auto-approve", + "-force", testFixturePath("apply"), } if code := c.Run(args); code != 0 { @@ -73,7 +73,7 @@ func TestApply_lockedState(t *testing.T) { args := []string{ "-state", statePath, - "-auto-approve", + "-force", testFixturePath("apply"), } if code := c.Run(args); code == 0 { @@ -115,7 +115,7 @@ func TestApply_lockedStateWait(t *testing.T) { args := []string{ "-state", statePath, "-lock-timeout", "4s", - "-auto-approve", + "-force", testFixturePath("apply"), } if code := c.Run(args); code != 0 { @@ -189,7 +189,7 @@ func TestApply_parallelism(t *testing.T) { args := []string{ "-state", statePath, - "-auto-approve", + "-force", fmt.Sprintf("-parallelism=%d", par), testFixturePath("parallelism"), } @@ -243,7 +243,7 @@ func TestApply_configInvalid(t *testing.T) { args := []string{ "-state", testTempFile(t), - "-auto-approve", + "-force", testFixturePath("apply-config-invalid"), } if code := c.Run(args); code != 1 { @@ -286,7 +286,7 @@ func TestApply_defaultState(t *testing.T) { serial := localState.State().Serial args := []string{ - "-auto-approve", + "-force", testFixturePath("apply"), } if code := c.Run(args); code != 0 { @@ -350,7 +350,7 @@ func TestApply_error(t *testing.T) { args := []string{ "-state", statePath, - "-auto-approve", + "-force", testFixturePath("apply-error"), } if code := c.Run(args); code != 1 { @@ -392,7 +392,7 @@ func TestApply_input(t *testing.T) { args := []string{ "-state", statePath, - "-auto-approve", + "-force", testFixturePath("apply-input"), } if code := c.Run(args); code != 0 { @@ -428,7 +428,7 @@ func TestApply_inputPartial(t *testing.T) { args := []string{ "-state", statePath, - "-auto-approve", + "-force", "-var", "foo=foovalue", testFixturePath("apply-input-partial"), } @@ -469,7 +469,7 @@ func TestApply_noArgs(t *testing.T) { args := []string{ "-state", statePath, - "-auto-approve", + "-force", } if code := c.Run(args); code != 0 { t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String()) @@ -793,7 +793,7 @@ func TestApply_refresh(t *testing.T) { args := []string{ "-state", statePath, - "-auto-approve", + "-force", testFixturePath("apply"), } if code := c.Run(args); code != 0 { @@ -877,7 +877,7 @@ func TestApply_shutdown(t *testing.T) { args := []string{ "-state", statePath, - "-auto-approve", + "-force", testFixturePath("apply-shutdown"), } if code := c.Run(args); code != 0 { @@ -937,7 +937,7 @@ func TestApply_state(t *testing.T) { // Run the apply command pointing to our existing state args := []string{ "-state", statePath, - "-auto-approve", + "-force", testFixturePath("apply"), } if code := c.Run(args); code != 0 { @@ -1012,7 +1012,7 @@ func TestApply_sensitiveOutput(t *testing.T) { args := []string{ "-state", statePath, - "-auto-approve", + "-force", testFixturePath("apply-sensitive-output"), } @@ -1045,7 +1045,7 @@ func TestApply_stateFuture(t *testing.T) { args := []string{ "-state", statePath, - "-auto-approve", + "-force", testFixturePath("apply"), } if code := c.Run(args); code == 0 { @@ -1077,7 +1077,7 @@ func TestApply_statePast(t *testing.T) { args := []string{ "-state", statePath, - "-auto-approve", + "-force", testFixturePath("apply"), } if code := c.Run(args); code != 0 { @@ -1110,7 +1110,7 @@ func TestApply_vars(t *testing.T) { } args := []string{ - "-auto-approve", + "-force", "-var", "foo=bar", "-state", statePath, testFixturePath("apply-vars"), @@ -1154,7 +1154,7 @@ func TestApply_varFile(t *testing.T) { } args := []string{ - "-auto-approve", + "-force", "-var-file", varFilePath, "-state", statePath, testFixturePath("apply-vars"), @@ -1208,7 +1208,7 @@ func TestApply_varFileDefault(t *testing.T) { } args := []string{ - "-auto-approve", + "-force", "-state", statePath, testFixturePath("apply-vars"), } @@ -1261,7 +1261,7 @@ func TestApply_varFileDefaultJSON(t *testing.T) { } args := []string{ - "-auto-approve", + "-force", "-state", statePath, testFixturePath("apply-vars"), } @@ -1314,7 +1314,7 @@ func TestApply_backup(t *testing.T) { // Run the apply command pointing to our existing state args := []string{ - "-auto-approve", + "-force", "-state", statePath, "-backup", backupPath, testFixturePath("apply"), @@ -1365,7 +1365,7 @@ func TestApply_disableBackup(t *testing.T) { // Run the apply command pointing to our existing state args := []string{ - "-auto-approve", + "-force", "-state", statePath, "-backup", "-", testFixturePath("apply"), @@ -1424,7 +1424,7 @@ func TestApply_terraformEnv(t *testing.T) { } args := []string{ - "-auto-approve", + "-force", "-state", statePath, testFixturePath("apply-terraform-env"), } @@ -1480,7 +1480,7 @@ func TestApply_terraformEnvNonDefault(t *testing.T) { } args := []string{ - "-auto-approve", + "-force", testFixturePath("apply-terraform-env"), } if code := c.Run(args); code != 0 { diff --git a/command/e2etest/automation_test.go b/command/e2etest/automation_test.go index 8c51f381b962..9a9dcb75ba63 100644 --- a/command/e2etest/automation_test.go +++ b/command/e2etest/automation_test.go @@ -149,7 +149,7 @@ func TestAutoApplyInAutomation(t *testing.T) { } //// APPLY - stdout, stderr, err = tf.Run("apply", "-input=false", "-auto-approve") + stdout, stderr, err = tf.Run("apply", "-input=false", "-force") if err != nil { t.Fatalf("unexpected apply error: %s\nstderr:\n%s", err, stderr) } diff --git a/website/docs/commands/apply.html.markdown b/website/docs/commands/apply.html.markdown index f8a63746dc76..b5722ffb19f8 100644 --- a/website/docs/commands/apply.html.markdown +++ b/website/docs/commands/apply.html.markdown @@ -33,7 +33,7 @@ The command-line flags are all optional. The list of available flags are: * `-input=true` - Ask for input for variables if not directly set. -* `-auto-approve` - Skip interactive approval of plan before applying. +* `-force` - Don't ask for input to approve plan before applying. * `-no-color` - Disables output with coloring. diff --git a/website/guides/running-terraform-in-automation.html.md b/website/guides/running-terraform-in-automation.html.md index 0493b0c8efbf..32fcdc14518d 100644 --- a/website/guides/running-terraform-in-automation.html.md +++ b/website/guides/running-terraform-in-automation.html.md @@ -174,10 +174,10 @@ Where manual approval is not required, a simpler sequence of commands can be used: * `terraform init -input=false` -* `terraform apply -input=false -auto-approve` +* `terraform apply -input=false -force` This variant of the `apply` command implicitly creates a new plan and then -immediately applies it. The `-auto-approve` option tells Terraform not +immediately applies it. The `-force` option tells Terraform not to require interactive approval of the plan before applying it. ~> When Terraform is empowered to make destructive changes to infrastructure, diff --git a/website/upgrade-guides/0-11.html.markdown b/website/upgrade-guides/0-11.html.markdown index fd20aced7876..eeca6ae1f9ee 100644 --- a/website/upgrade-guides/0-11.html.markdown +++ b/website/upgrade-guides/0-11.html.markdown @@ -44,7 +44,7 @@ default unless a plan file is provided on the command line. When it is always recommended to separate plan from apply, but if existing automation was running `terraform apply` with no arguments it may now be necessary to update it to either generate an explicit plan using `terraform plan -out=...` -or to run `terraform apply -auto-approve` to bypass the interactive confirmation +or to run `terraform apply -force` to bypass the interactive confirmation step. The latter should be done only in unimportant environments. **Action:** For interactive use in a terminal, prefer to use `terraform apply` @@ -53,7 +53,7 @@ followed by `terraform apply tfplan`. **Action:** Update any automation scripts that run Terraform non-interactively so that they either use separated plan and apply or override the confirmation -behavior using the `-auto-approve` option. +behavior using the `-force` option. ## Relative Paths in Module `source`