terraform-plugin-docs icon indicating copy to clipboard operation
terraform-plugin-docs copied to clipboard

"Block List" confusing to user reading docs, perhaps "repeatable Block"?

Open OJFord opened this issue 4 years ago • 2 comments

(Block List) as a type rendered in documentation makes sense to the maintainer of a provider, but IMO it's confusing or even misleading to the end user.

Concrete example here: https://github.com/OJFord/terraform-provider-wireguard/commit/58ef3d8c27cdedae643e77b499d75fecac03246e#diff-60a95e399cf5c94cb98075600ad42997cdae1a9839f293569766d66acdaa0bcfR59

peer in:

data "wireguard_config_document" "peer1" {
  private_key = wireguard_asymmetric_key.peer1.private_key
  listen_port = 1234
  dns = [
    "1.1.1.1",
    "1.0.0.1",
    "2606:4700:4700:0:0:0:0:64",
    "2606:4700:4700:0:0:0:0:6400",
  ]

  peer {
    public_key = wireguard_asymmetric_key.peer2.public_key
    allowed_ips = [
      "0.0.0.0/0",
    ]
    persistent_keepalive = 25
  }

  peer {
    public_key = wireguard_asymmetric_key.peer3.public_key
    endpoint   = "example.com:51820"
    allowed_ips = [
      "::/0",
    ]
  }
}

to a user isn't a 'list', it's just a block. One that can be specified multiple times, sure, and maybe that's represented as a list behind the scenes, but as someone using the resource or data source it isn't a list.

It's rendered in docs (by tfplugindocs v0.4.0) as:

  • peer (Block List) (see below for nested schema)

but I think better would be:

  • peer (Block, repeatable) (see below for nested schema)

or 'multiple allowed', or similar.

OJFord avatar Mar 08 '21 00:03 OJFord

Also, I would argue that if it's a TypeList with MaxLength=1 (which is a fairly common pattern), it should be rendered simply as "Block" since for the end user that's what it is and it will unlikely to change down the road.

alekc avatar Sep 14 '21 09:09 alekc

That's a good point. With my suggestion of , repeatable, that could just be omitted if max 1. Or perhaps changed to specify the maximum if set, regardless of value.

OJFord avatar Sep 30 '21 10:09 OJFord