From 19d67b760678e572b5af8b2cf39721fef1ab99fe Mon Sep 17 00:00:00 2001 From: James Bardin Date: Fri, 11 Sep 2020 17:27:12 -0400 Subject: [PATCH] don't leave old refreshed state in the context After apply, any refreshed state from a plan would be invalid. Normal usage doesn't ever see this, bu internal tests may re-use the context. --- terraform/context.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terraform/context.go b/terraform/context.go index 266fe50a6..dd9889721 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -492,6 +492,10 @@ Note that the -target option is not suitable for routine use, and is provided on )) } + // This isn't technically needed, but don't leave an old refreshed state + // around in case we re-use the context in internal tests. + c.refreshState = c.state.DeepCopy() + return c.state, diags }