From 85be12d78348363bb160a88c6651e1a8d03811db Mon Sep 17 00:00:00 2001 From: Kristin Laemmert Date: Tue, 19 Jun 2018 13:35:28 -0700 Subject: [PATCH] cli: show workspace name in destroy confirmation (#18253) * cli: show workspace name in destroy confirmation If the workspace name is not "default", include it in the confirmation message for `terraform destroy`. Fixes #15480 --- backend/local/backend_apply.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/local/backend_apply.go b/backend/local/backend_apply.go index 2f749444c..9bb777dc6 100644 --- a/backend/local/backend_apply.go +++ b/backend/local/backend_apply.go @@ -84,14 +84,21 @@ func (b *Local) opApply( if mustConfirm { var desc, query string if op.Destroy { - // Default destroy message + if op.Workspace != "default" { + query = "Do you really want to destroy all resources in workspace \"" + op.Workspace + "\"?" + } else { + query = "Do you really want to destroy all resources?" + } desc = "Terraform will destroy all your managed infrastructure, as shown above.\n" + "There is no undo. Only 'yes' will be accepted to confirm." - query = "Do you really want to destroy?" } else { + if op.Workspace != "default" { + query = "Do you want to perform these actions in workspace \"" + op.Workspace + "\"?" + } else { + query = "Do you want to perform these actions?" + } desc = "Terraform will perform the actions described above.\n" + "Only 'yes' will be accepted to approve." - query = "Do you want to perform these actions?" } if !trivialPlan {