From 22ea3d693fb4118448d8e68d42f737ff9cdda63a Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Wed, 12 Aug 2015 18:41:12 -0500 Subject: [PATCH] update prevent_destroy error message per recommendations by @nathanielks closes #2473 --- terraform/context_plan_test.go | 2 +- terraform/eval_check_prevent_destroy.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/context_plan_test.go b/terraform/context_plan_test.go index 61864fb5d..240fd24dd 100644 --- a/terraform/context_plan_test.go +++ b/terraform/context_plan_test.go @@ -604,7 +604,7 @@ func TestContext2Plan_preventDestroy_bad(t *testing.T) { plan, err := ctx.Plan() - expectedErr := "aws_instance.foo: plan would destroy" + expectedErr := "aws_instance.foo: the plan would destroy" if !strings.Contains(fmt.Sprintf("%s", err), expectedErr) { t.Fatalf("expected err would contain %q\nerr: %s\nplan: %s", expectedErr, err, plan) diff --git a/terraform/eval_check_prevent_destroy.go b/terraform/eval_check_prevent_destroy.go index 7cab76d10..ae9dc4f82 100644 --- a/terraform/eval_check_prevent_destroy.go +++ b/terraform/eval_check_prevent_destroy.go @@ -29,4 +29,4 @@ func (n *EvalCheckPreventDestroy) Eval(ctx EvalContext) (interface{}, error) { return nil, nil } -const preventDestroyErrStr = `%s: plan would destroy, but resource has prevent_destroy set. To avoid this error, either disable prevent_destroy, or change your config so the plan does not destroy this resource.` +const preventDestroyErrStr = `%s: the plan would destroy this resource, but it currently has lifecycle.prevent_destroy set to true. To avoid this error and continue with the plan, either disable lifecycle.prevent_destroy or adjust the scope of the plan using the -target flag.`