core: test to prove that data diffs are broken

Apparently there's been a regression in the creation of data resource
diffs: they aren't showing up in the plan at all.

As a first step to fixing this, this is an intentionally-failing test
that proves it's broken.
This commit is contained in:
Martin Atkins 2016-05-21 13:00:46 -07:00
parent 18803d9b93
commit d9c137555f
2 changed files with 39 additions and 0 deletions

View File

@ -864,6 +864,37 @@ func TestContext2Plan_computed(t *testing.T) {
} }
} }
func TestContext2Plan_computedDataResource(t *testing.T) {
m := testModule(t, "plan-computed-data-resource")
p := testProvider("aws")
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Module: m,
Providers: map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p),
},
})
plan, err := ctx.Plan()
if err != nil {
t.Fatalf("err: %s", err)
}
if got := len(plan.Diff.Modules); got != 1 {
t.Fatalf("got %d modules; want 1", got)
}
moduleDiff := plan.Diff.Modules[0]
if _, ok := moduleDiff.Resources["aws_instance.foo"]; !ok {
t.Fatalf("missing diff for aws_instance.foo")
}
_, ok := moduleDiff.Resources["data.aws_vpc.bar"]
if !ok {
t.Fatalf("missing diff for data.aws_vpc.bar")
}
}
func TestContext2Plan_computedList(t *testing.T) { func TestContext2Plan_computedList(t *testing.T) {
m := testModule(t, "plan-computed-list") m := testModule(t, "plan-computed-list")
p := testProvider("aws") p := testProvider("aws")

View File

@ -0,0 +1,8 @@
resource "aws_instance" "foo" {
num = "2"
compute = "foo"
}
data "aws_vpc" "bar" {
foo = "${aws_instance.foo.foo}"
}