From cb99dddb4d3d8f78c12cfd593290c5530c6a2666 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 10 Mar 2020 16:12:12 -0400 Subject: [PATCH] fix a flapping test involving CreateBeforeDestroy A typo in the config caused it to disagree with the plan on whether a resource should be CreateBeforeDestroy, preventing it from being ordered properly. Add the new CreateBeforeDestroy field to the test fixture state as well for completeness. --- terraform/context_apply_test.go | 5 +++-- terraform/testdata/apply-module-replace-cycle/mod1/main.tf | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/terraform/context_apply_test.go b/terraform/context_apply_test.go index 44ac90f71..3fe1400d2 100644 --- a/terraform/context_apply_test.go +++ b/terraform/context_apply_test.go @@ -10230,8 +10230,9 @@ func TestContext2Apply_moduleReplaceCycle(t *testing.T) { Name: "a", }.Instance(addrs.NoKey), &states.ResourceInstanceObjectSrc{ - Status: states.ObjectReady, - AttrsJSON: []byte(`{"id":"a","require_new":"old"}`), + Status: states.ObjectReady, + AttrsJSON: []byte(`{"id":"a","require_new":"old"}`), + CreateBeforeDestroy: mode == "cbd", }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("aws"), diff --git a/terraform/testdata/apply-module-replace-cycle/mod1/main.tf b/terraform/testdata/apply-module-replace-cycle/mod1/main.tf index 2ade442bf..3dd26cb8e 100644 --- a/terraform/testdata/apply-module-replace-cycle/mod1/main.tf +++ b/terraform/testdata/apply-module-replace-cycle/mod1/main.tf @@ -1,8 +1,5 @@ resource "aws_instance" "a" { require_new = "new" - lifecycle { - create_before_destroy = true - } } output "ids" {