Skip to content

Incorrect formatter_trailing_comma finding with lists of objects #35

@fatbasstard

Description

@fatbasstard

HI,

Encountered an invalid finding on the formatter_trailing_comma rule when a list of objects. Encountered this with a local module.

Broken in to a small test setup:

module/test/variables.tf:

variable "columns" {
  type = list(object({
    name = string,
    type = string,
  }))
  default     = []
  description = "XXX"
}

terraform/comma_test.tf:

module "comma_test" {
  source = "../comma_test"
  columns = [
    { name = "name", type = "string" },
    { name = "code", type = "string" },
  ]
}

TFLint output:

terraform/comma_test.tf:3:13: Warning - List value should end with a comma (actual: 4, expected: 2) (formatter_trailing_comma)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions