Skip to content

terraform_docs_replace should support --header-from for reading doc headers from files other than main.tf #177

@tidzo

Description

@tidzo

terraform-docs itself supports the header-from option on the command line or in its config file. This defaults to a value of main.tf, which works fine with this project's terraform_docs_replace hook.

However, if using a different value of header-from that does not end in .tf (or .tfvars, but that would be... strange) , such as doc_header.md, then the logic on (currently) line 33 of terraform_docs_replace..py means that a change to the header file will not result in README.md being recreated.

My proposal to resolve this is to add an argparse argument to terraform_docs_replace.py named --header-from, defaulting to main.tf, and amend the logic near line 33 so that a supplied value of that argument (if it doesn't end in .tf), also gets added to the list.

If this sounds reasonable, I will submit a PR to that effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    estimate/2hNeed 2 hours to be donefeatureNew feature or requestgood first issueGood for newcomershook/terraform_docs_replacePython hookstaleDenotes an issue or PR has remained open with no activity and has become stale.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions