From cf6bc7163a678f9a49fce649049369cb11815308 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 9 Sep 2020 15:36:46 -0400 Subject: [PATCH] not all plan action changes are provider bugs A provider cannot influence CreateThenDelete vs DeleteThenCreate, so we shouldn't attribute this to the provider in the error. --- terraform/eval_diff.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/terraform/eval_diff.go b/terraform/eval_diff.go index 509bd5bbcd..c8777b436e 100644 --- a/terraform/eval_diff.go +++ b/terraform/eval_diff.go @@ -59,6 +59,18 @@ func (n *EvalCheckPlannedChange) Eval(ctx EvalContext) (interface{}, error) { // all of the unknown values, since the final values might actually // match what was there before after all. log.Printf("[DEBUG] After incorporating new values learned so far during apply, %s change has become NoOp", absAddr) + + case (plannedChange.Action == plans.CreateThenDelete && actualChange.Action == plans.DeleteThenCreate) || + (plannedChange.Action == plans.DeleteThenCreate && actualChange.Action == plans.CreateThenDelete): + // If the order of replacement changed, then that is a bug in terraform + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Error, + "Terraform produced inconsistent final plan", + fmt.Sprintf( + "When expanding the plan for %s to include new values learned so far during apply, the planned action changed from %s to %s.\n\nThis is a bug in Terraform and should be reported.", + absAddr, plannedChange.Action, actualChange.Action, + ), + )) default: diags = diags.Append(tfdiags.Sourceless( tfdiags.Error,