From 74ffebe8eadad72a521dd462ce2a1c7ac3bd5f13 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Tue, 25 Sep 2018 16:05:06 -0700 Subject: [PATCH] core: Fix TestContext2Apply_compute The testDiffFn doesn't include "compute" in the diff it produces and so it no longer appears in the shimmed output. This is just a quirk of this weird mock implementation; real providers always copy all of the values from thec config into the diff before adding in any other changes. --- terraform/context_apply_test.go | 36 +++++++++++++++++++++++++++++++++ terraform/terraform_test.go | 1 - 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/terraform/context_apply_test.go b/terraform/context_apply_test.go index a8d9007f6..469075ed4 100644 --- a/terraform/context_apply_test.go +++ b/terraform/context_apply_test.go @@ -2075,6 +2075,42 @@ func TestContext2Apply_compute(t *testing.T) { p := testProvider("aws") p.ApplyFn = testApplyFn p.DiffFn = testDiffFn + p.GetSchemaReturn = &ProviderSchema{ + ResourceTypes: map[string]*configschema.Block{ + "aws_instance": { + Attributes: map[string]*configschema.Attribute{ + "num": { + Type: cty.Number, + Optional: true, + }, + "compute": { + Type: cty.String, + Optional: true, + }, + "compute_value": { + Type: cty.String, + Optional: true, + }, + "foo": { + Type: cty.String, + Optional: true, + }, + "id": { + Type: cty.String, + Computed: true, + }, + "type": { + Type: cty.String, + Computed: true, + }, + "value": { // Populated from compute_value because compute = "value" in the config fixture + Type: cty.String, + Computed: true, + }, + }, + }, + }, + } ctx := testContext2(t, &ContextOpts{ Config: m, diff --git a/terraform/terraform_test.go b/terraform/terraform_test.go index 1e5b4dfb6..7e5238ec8 100644 --- a/terraform/terraform_test.go +++ b/terraform/terraform_test.go @@ -431,7 +431,6 @@ aws_instance.bar: aws_instance.foo: ID = foo provider = provider.aws - compute = value num = 2 type = aws_instance value = computed_value