From 1a418c1452b1c47e43c607e06d2871324c7c13a7 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 22 Oct 2016 12:36:47 -0700 Subject: [PATCH] command/apply: -Xnew-destroy --- command/apply.go | 20 ++++++++++++++++++++ command/meta.go | 1 + 2 files changed, 21 insertions(+) diff --git a/command/apply.go b/command/apply.go index 345b2f7ee..2b40eb947 100644 --- a/command/apply.go +++ b/command/apply.go @@ -115,6 +115,26 @@ func (c *ApplyCommand) Run(args []string) int { } } + // Check for the new destroy + if terraform.X_newDestroy { + desc := "Experimental new destroy graph has been enabled. This may still\n" + + "have bugs, and should be used with care. If you'd like to continue,\n" + + "you must enter exactly 'yes' as a response." + v, err := c.UIInput().Input(&terraform.InputOpts{ + Id: "Xnew-destroy", + Query: "Experimental feature enabled: new destroy graph. Continue?", + Description: desc, + }) + if err != nil { + c.Ui.Error(fmt.Sprintf("Error asking for confirmation: %s", err)) + return 1 + } + if v != "yes" { + c.Ui.Output("Apply cancelled.") + return 1 + } + } + // Build the context based on the arguments given ctx, planned, err := c.Context(contextOpts{ Destroy: c.Destroy, diff --git a/command/meta.go b/command/meta.go index dbacb3854..b8c419c1e 100644 --- a/command/meta.go +++ b/command/meta.go @@ -337,6 +337,7 @@ func (m *Meta) flagSet(n string) *flag.FlagSet { // Experimental features f.BoolVar(&terraform.X_newApply, "Xnew-apply", false, "experiment: new apply") + f.BoolVar(&terraform.X_newDestroy, "Xnew-destroy", false, "experiment: new destroy") // Create an io.Writer that writes to our Ui properly for errors. // This is kind of a hack, but it does the job. Basically: create