Skip to content

Do not use comments as variable description #552

@pbikki

Description

@pbikki

Describe the bug

I have a variables.tf file with # some comment and then variables definitions follow
When I generate docs, the comment is used as variable description. I want to avoid that. Is there a config setting I can use to prevent this ?

How can we reproduce it?

  1. Create variables.tf with definition
# some comment
variable "var1" {
}
  1. Run
▶ terraform-docs markdown --output-check --show inputs ./

Input section will be rendered.

Output is as follows:


## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_var1"></a> [var1](#input\_var1) | some comment | `any` | n/a | yes |

Generated markdown:

Inputs

Name Description Type Default Required
var1 some comment any n/a yes

Desired output

Inputs

Name Description Type Default Required
var1 n/a any n/a yes

Environment information

  • terraform-docs version (use terraform-docs --version):
▶ terraform-docs version                                          

terraform-docs version v0.15.0 darwin/amd64
  • OS (e.g. Windows, MacOS): MacOS

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions