feat: ignore outputs, providers, resources with comments

Prepend any type of resource, including `resource`, `data`, `module`,
`variable`, and `output` with a comment including "terraform-docs-ignore"
to exclude it from the generated output.

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
This commit is contained in:
Khosrow Moossavi
2024-05-28 11:45:42 -04:00
parent 943489ca41
commit 8f74fd4453
19 changed files with 261 additions and 14 deletions

View File

@@ -63,8 +63,20 @@ data "aws_caller_identity" "ident" {
provider = "aws.ident"
}
# terraform-docs-ignore
data "aws_caller_identity" "ignored" {
provider = "aws"
}
resource "null_resource" "foo" {}
# This resource is going to get ignored from generated
# output by using the following known comment.
# terraform-docs-ignore
# And the ignore keyword also doesn't have to be the first,
# last, or only thing in a leading comment
resource "null_resource" "ignored" {}
module "bar" {
source = "baz"
version = "4.5.6"
@@ -84,3 +96,9 @@ module "baz" {
module "foobar" {
source = "git@github.com:module/path?ref=v7.8.9"
}
// terraform-docs-ignore
module "ignored" {
source = "foobaz"
version = "7.8.9"
}

View File

@@ -17,3 +17,8 @@ output "output-0.12" {
value = join(",", var.list-3)
description = "terraform 0.12 only"
}
// terraform-docs-ignore
output "ignored" {
value = "ignored"
}

View File

@@ -14,6 +14,11 @@ variable "bool-1" {
default = true
}
# terraform-docs-ignore
variable "ignored" {
default = ""
}
variable "string-3" {
default = ""
}