Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore inputs with terraform-docs-ignore comment #651

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kampka
Copy link

@kampka kampka commented Nov 10, 2022

Description of your changes

In our monorepo projects, we often have a set of variables that is shared amongst modules, eg. a tags variable that is accepted by all modules in the repo. This is typically done by symlinking a common-vars.tf file into all modules in the repo. This leads to those documentation these inputs being generated on every modules documentation.
This is not only rather repetitive, it also clutters the documentation by mixing the module specific inputs with the common ones, making it harder to read the module docs.

This PR introduces the possibility to add a comment # terraform-docs-ignore to a variable, telling terraform-docs to ignore and not render the variable in the documentation.

Example:

# terraform-docs-ignore
variable "tags" {
  type        = map(string)
  default     = {}
  description = "A set of tags added to the resource."
}

I have:

  • Read and followed terraform-docs' [contribution process].
  • All tests pass when I run make test.

How has this code been tested

The unit test shows that the variable tagged with # terraform-docs-ignore is not present after loading the module.

@Makeshift
Copy link

This is exactly what I needed for our repos, with exactly the same usecase. I'd really like to see this merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Proposed
Development

Successfully merging this pull request may close these issues.

None yet

2 participants