configs/configupgrade: Use single-line syntax for empty object exprs

This commit is contained in:
Martin Atkins 2019-05-15 15:56:30 -07:00
parent bec4641867
commit 004c2056a7
3 changed files with 12 additions and 0 deletions

View File

@ -4,8 +4,12 @@ variable "s" {
variable "l" { variable "l" {
type = "list" type = "list"
default = []
} }
variable "m" { variable "m" {
type = "map" type = "map"
default = {}
} }

View File

@ -4,8 +4,12 @@ variable "s" {
variable "l" { variable "l" {
type = list(string) type = list(string)
default = []
} }
variable "m" { variable "m" {
type = map(string) type = map(string)
default = {}
} }

View File

@ -184,6 +184,10 @@ Value:
buf.WriteString("]") buf.WriteString("]")
case *hcl1ast.ObjectType: case *hcl1ast.ObjectType:
if len(tv.List.Items) == 0 {
buf.WriteString("{}")
break
}
buf.WriteString("{\n") buf.WriteString("{\n")
for _, item := range tv.List.Items { for _, item := range tv.List.Items {
if len(item.Keys) != 1 { if len(item.Keys) != 1 {