From 0dff8fe5e0f29d98ee2ebecfbe847f20612d8fa4 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Tue, 22 Jan 2019 16:49:49 +0000 Subject: [PATCH] Add failing test case for tuple --- command/format/diff_test.go | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/command/format/diff_test.go b/command/format/diff_test.go index 43d2002bb..0c34fc323 100644 --- a/command/format/diff_test.go +++ b/command/format/diff_test.go @@ -376,6 +376,41 @@ func TestResourceChange_JSON(t *testing.T) { } ) } +`, + }, + "in-place update (tuple of different types)": { + Action: plans.Update, + Mode: addrs.ManagedResourceMode, + Before: cty.ObjectVal(map[string]cty.Value{ + "id": cty.StringVal("i-02ae66f368e8518a9"), + "json_field": cty.StringVal(`{"aaa": [42, {"foo":"bar"}, "value"]}`), + }), + After: cty.ObjectVal(map[string]cty.Value{ + "id": cty.UnknownVal(cty.String), + "json_field": cty.StringVal(`{"aaa": [42, {"foo":"baz"}, "value"]}`), + }), + Schema: &configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "id": {Type: cty.String, Optional: true, Computed: true}, + "json_field": {Type: cty.String, Optional: true}, + }, + }, + RequiredReplace: cty.NewPathSet(), + ExpectedOutput: ` # test_instance.example will be updated in-place + ~ resource "test_instance" "example" { + ~ id = "i-02ae66f368e8518a9" -> (known after apply) + ~ json_field = jsonencode( + ~ { + ~ aaa = [ + 42, + ~ { + ~ foo = "bar" -> "baz" + }, + "value", + ] + } + ) + } `, }, "force-new update": { @@ -730,7 +765,6 @@ func TestResourceChange_JSON(t *testing.T) { } `, }, - // TODO: JSON with unknown values inside } runTestCases(t, testCases) }