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
This commit is contained in:
parent
b95f74956a
commit
85be12d783
|
@ -84,14 +84,21 @@ func (b *Local) opApply(
|
||||||
if mustConfirm {
|
if mustConfirm {
|
||||||
var desc, query string
|
var desc, query string
|
||||||
if op.Destroy {
|
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" +
|
desc = "Terraform will destroy all your managed infrastructure, as shown above.\n" +
|
||||||
"There is no undo. Only 'yes' will be accepted to confirm."
|
"There is no undo. Only 'yes' will be accepted to confirm."
|
||||||
query = "Do you really want to destroy?"
|
|
||||||
} else {
|
} 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" +
|
desc = "Terraform will perform the actions described above.\n" +
|
||||||
"Only 'yes' will be accepted to approve."
|
"Only 'yes' will be accepted to approve."
|
||||||
query = "Do you want to perform these actions?"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !trivialPlan {
|
if !trivialPlan {
|
||||||
|
|
Loading…
Reference in New Issue