diff --git a/terraform/context_apply_test.go b/terraform/context_apply_test.go index b1b70283c..3308d966b 100644 --- a/terraform/context_apply_test.go +++ b/terraform/context_apply_test.go @@ -524,7 +524,7 @@ func TestContext2Apply_resourceDependsOnModuleInModule(t *testing.T) { var called int32 var checked bool p.ApplyFn = func(info *InstanceInfo, is *InstanceState, id *InstanceDiff) (*InstanceState, error) { - if id.Attributes["ami"].New == "child" { + if id.Attributes["ami"].New == "grandchild" { checked = true // Sleep to allow parallel execution @@ -532,7 +532,7 @@ func TestContext2Apply_resourceDependsOnModuleInModule(t *testing.T) { // Verify that called is 0 (dep not called) if atomic.LoadInt32(&called) != 0 { - return nil, fmt.Errorf("nothing else should not be called") + return nil, fmt.Errorf("something else was applied before grandchild; grandchild should be first") } } diff --git a/terraform/terraform_test.go b/terraform/terraform_test.go index d20db6d76..4924440f0 100644 --- a/terraform/terraform_test.go +++ b/terraform/terraform_test.go @@ -831,6 +831,8 @@ module.child: aws_instance.b: ID = foo provider = provider.aws + ami = child + type = aws_instance Dependencies: module.grandchild @@ -838,6 +840,8 @@ module.child.grandchild: aws_instance.c: ID = foo provider = provider.aws + ami = grandchild + type = aws_instance ` const testTerraformApplyTaintStr = ` diff --git a/terraform/test-fixtures/apply-resource-depends-on-module-in-module/child/child/main.tf b/terraform/test-fixtures/apply-resource-depends-on-module-in-module/child/child/main.tf index 28d867a3d..77203263d 100644 --- a/terraform/test-fixtures/apply-resource-depends-on-module-in-module/child/child/main.tf +++ b/terraform/test-fixtures/apply-resource-depends-on-module-in-module/child/child/main.tf @@ -1,4 +1,3 @@ resource "aws_instance" "c" { ami = "grandchild" } -