Skip to content

Generate doc failed if "type" present in object definition #170

Open
@eservent

Description

@eservent

Hello,
I tried to use /bin/terraform-docs.awk to generate documentation with terraform-docs.

An error occured with this variable from provider aws, resource "aws_ecs_service", property "ordered_placement_strategy" :

variable "ordered_placement_strategy" {
  type = list(object({
    type  = string
    field = string
  }))
  description = "Ordered task placement strategy on EC2 instances"
  default = [
    {
      type  = "spread"
      field = "attribute:ecs.availability-zone"
    }
  ]
}

Due to presence of "type" in the object definition, and default value, awk transformation failed to retrieve a valid hcl0.11 content.

Transformation result :

variable "ordered_placement_strategy" {
  type = "object"
  type = "string"
  description = "Ordered task placement strategy on EC2 instances"
  default = [
    {
  type = "spread"
}

Thank you for the awk hack anyway 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions