diff --git a/terraform/evaluate.go b/terraform/evaluate.go index d5d2680fa..9fafff841 100644 --- a/terraform/evaluate.go +++ b/terraform/evaluate.go @@ -974,15 +974,12 @@ func getValMarks(schema *configschema.Block, val cty.Value, path cty.Path) []cty switch blockS.Nesting { case configschema.NestingSingle, configschema.NestingGroup: pvm = append(pvm, getValMarks(&blockS.Block, blockV, blockPath)...) - case configschema.NestingList: + case configschema.NestingList, configschema.NestingMap: for it := blockV.ElementIterator(); it.Next(); { idx, blockEV := it.Element() morePaths := getValMarks(&blockS.Block, blockEV, append(blockPath, cty.IndexStep{Key: idx})) pvm = append(pvm, morePaths...) } - case configschema.NestingMap: - // TODO - continue case configschema.NestingSet: // TODO continue diff --git a/terraform/evaluate_test.go b/terraform/evaluate_test.go index d8a67c446..519a9ab2c 100644 --- a/terraform/evaluate_test.go +++ b/terraform/evaluate_test.go @@ -135,7 +135,7 @@ func TestEvaluatorGetResource(t *testing.T) { }.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance), &states.ResourceInstanceObjectSrc{ Status: states.ObjectReady, - AttrsJSON: []byte(`{"id":"foo", "value":"hello", "nesting_list": [{"sensitive_value":"abc"}]}`), + AttrsJSON: []byte(`{"id":"foo", "nesting_list": [{"sensitive_value":"abc"}], "nesting_map": {"foo":{"foo":"x"}}, "value":"hello"}`), }, addrs.AbsProviderConfig{ Provider: addrs.NewDefaultProvider("test"), @@ -198,6 +198,14 @@ func TestEvaluatorGetResource(t *testing.T) { }, Nesting: configschema.NestingList, }, + "nesting_map": { + Block: configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "foo": {Type: cty.String, Optional: true, Sensitive: true}, + }, + }, + Nesting: configschema.NestingMap, + }, }, }, }, @@ -219,6 +227,9 @@ func TestEvaluatorGetResource(t *testing.T) { "value": cty.NullVal(cty.String), }), }), + "nesting_map": cty.MapVal(map[string]cty.Value{ + "foo": cty.ObjectVal(map[string]cty.Value{"foo": cty.StringVal("x").Mark("sensitive")}), + }), "value": cty.StringVal("hello").Mark("sensitive"), })