mirror of
https://github.com/terraform-docs/terraform-docs.git
synced 2026-03-27 12:58:35 +07:00
Ignore inputs with terraform-docs-ignore comment
This commit is contained in:
committed by
Khosrow Moossavi
parent
80c406f95d
commit
943489ca41
@@ -187,10 +187,17 @@ func loadInputs(tfmodule *tfconfig.Module, config *print.Config) ([]*Input, []*I
|
|||||||
var optional = make([]*Input, 0, len(tfmodule.Variables))
|
var optional = make([]*Input, 0, len(tfmodule.Variables))
|
||||||
|
|
||||||
for _, input := range tfmodule.Variables {
|
for _, input := range tfmodule.Variables {
|
||||||
|
comments := loadComments(input.Pos.Filename, input.Pos.Line)
|
||||||
|
|
||||||
|
// Skip over inputs that are marked as being ignored
|
||||||
|
if strings.Contains(comments, "terraform-docs-ignore") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// convert CRLF to LF early on (https://github.com/terraform-docs/terraform-docs/issues/305)
|
// convert CRLF to LF early on (https://github.com/terraform-docs/terraform-docs/issues/305)
|
||||||
inputDescription := strings.ReplaceAll(input.Description, "\r\n", "\n")
|
inputDescription := strings.ReplaceAll(input.Description, "\r\n", "\n")
|
||||||
if inputDescription == "" && config.Settings.ReadComments {
|
if inputDescription == "" && config.Settings.ReadComments {
|
||||||
inputDescription = loadComments(input.Pos.Filename, input.Pos.Line)
|
inputDescription = comments
|
||||||
}
|
}
|
||||||
|
|
||||||
i := &Input{
|
i := &Input{
|
||||||
|
|||||||
6
terraform/testdata/full-example/variables.tf
vendored
6
terraform/testdata/full-example/variables.tf
vendored
@@ -28,3 +28,9 @@ variable "G" {
|
|||||||
description = "G description"
|
description = "G description"
|
||||||
default = null
|
default = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# terraform-docs-ignore
|
||||||
|
variable "H" {
|
||||||
|
description = "H description"
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user