core: Partially fix TestContext2Apply_resourceDependsOnModule

InstanceInfo.HumanId() is no longer functional, since our shim from the
new to the old provider API doesn't populate it. Therefore we must use
other means to distingush the two instances here, and we'll use the "ami"
attribute value to do so.
This commit is contained in:
Martin Atkins 2018-09-11 17:11:16 -07:00
parent f0b7d01072
commit 3ad2930c21
3 changed files with 9 additions and 4 deletions

View File

@ -238,7 +238,8 @@ func TestContext2Apply_resourceDependsOnModule(t *testing.T) {
info *InstanceInfo,
is *InstanceState,
id *InstanceDiff) (*InstanceState, error) {
if info.HumanId() == "module.child.aws_instance.child" {
if id.Attributes["ami"].New == "child" {
// make the child slower than the parent
time.Sleep(50 * time.Millisecond)

View File

@ -1 +1,3 @@
resource "aws_instance" "child" {}
resource "aws_instance" "child" {
ami = "child"
}

View File

@ -1,7 +1,9 @@
module "child" {
source = "./child"
source = "./child"
}
resource "aws_instance" "a" {
depends_on = ["module.child"]
ami = "parent"
depends_on = ["module.child"]
}