Skip to content

Commit

Permalink
fix: map is complex nested type like list and set (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux authored Dec 30, 2021
1 parent 9b95fbb commit 8f93f0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/parser/hclparser/hcltype.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func getEvalContextForExpr(expr hcl.Expression) *hcl.EvalContext {
return &hcl.EvalContext{
Functions: map[string]function.Function{
"object": complexTypeFunc(types.TerraformObject),
"map": complexTypeFunc(types.TerraformMap),
"map": nestedTypeFunc(types.TerraformMap),
"list": nestedTypeFunc(types.TerraformList),
"set": nestedTypeFunc(types.TerraformSet),
},
Expand Down
7 changes: 4 additions & 3 deletions internal/parser/hclparser/hcltype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ var tests = []struct {
wantTypeLabel: "my_object_name",
},
{
expression: `map(my_object_name)`,
wantType: types.TerraformMap,
wantTypeLabel: "my_object_name",
expression: `map(my_object_name)`,
wantType: types.TerraformMap,
wantNestedType: types.TerraformObject,
wantNestedTypeLabel: "my_object_name",
},
{
expression: `object(another_object_name)`,
Expand Down

0 comments on commit 8f93f0a

Please sign in to comment.