From 22436555a7d8c5fa207f1f5500451d8e96986315 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 15 Jan 2015 11:08:06 -0800 Subject: [PATCH] helper/schema: test setting computed value and retrieving it via state --- helper/schema/resource_data_test.go | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/helper/schema/resource_data_test.go b/helper/schema/resource_data_test.go index c351260cf..92851c9bc 100644 --- a/helper/schema/resource_data_test.go +++ b/helper/schema/resource_data_test.go @@ -2258,6 +2258,37 @@ func TestResourceDataState(t *testing.T) { Attributes: map[string]string{}, }, }, + + // #22 + { + Schema: map[string]*Schema{ + "foo": &Schema{ + Type: TypeString, + Optional: true, + Computed: true, + }, + }, + + State: nil, + + Diff: &terraform.InstanceDiff{ + Attributes: map[string]*terraform.ResourceAttrDiff{ + "foo": &terraform.ResourceAttrDiff{ + NewComputed: true, + }, + }, + }, + + Set: map[string]interface{}{ + "foo": "bar", + }, + + Result: &terraform.InstanceState{ + Attributes: map[string]string{ + "foo": "bar", + }, + }, + }, } for i, tc := range cases {