Considering the file strucutre below of main module and its submodules,
now it is possible to generate documentation for them main and all its
submodules in one execution, with `--recursive` flag.
Note that generating documentation recursively is allowed only with
`--output-file` set.
Path to find submodules can be configured with `--recursive-path`
(defaults to `modules`).
Each submodule can also have their own `.terraform-docs.yml` confi file,
to override configuration from root module.
```
.
├── README.md
├── main.tf
├── modules
│ └── my-sub-module
│ ├── README.md
│ ├── main.tf
│ ├── variables.tf
│ └── versions.tf
├── outputs.tf
├── variables.tf
└── versions.tf
```
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
If a code block (surrounded by triple backticks) are indented, in other
words the code block is placed inside ordered or unordered list, the
closing backticks of codeblock should honor the original indentation
properly.
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
Packer config, since 1.7.0, prefers HCL2 which effectively makes us to
reuse the same binary for generating documentation for it with terraform-docs
as well. The missing part was that terraform-config-inspect did not
recognize `pkr.hcl` and `pkr.json` as valid formats, which this fixes that.
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
The updated order of trying to look up for .terraform-docs.yml config
file, now, is:
1. root of module directory
2. `.config/` folder at root of module directory
3. current directory
4. `.config/` folder at current directory
5. `$HOME/.tfdocs.d/`
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
When passing `--output-template` as CLI flag, `\n` is not processed as
line break rather than literal strings, which caused a misleading error
of "value of '--output-template' should contain at least 3 lines".
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
New flag, `--lockfile`, is added to control whether ignore reading
.terraform.lock.hcl file in an attempt to extract the exact version of
provider being used or not. Default is true.
If set to true, exact version of provider available in lock file at the
time of execution will be extracted. If set to false, the version in .tf
file will be used (either exact, or a constrained version: >=, ~>, ...)
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
adding option to compare outputted file with generated
terraform-doc and fail if different
Signed-off-by: Ricardo Herrera <rickhl@outlook.com>
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
New psuedo section `all` is added and can be used to show or hide _all_
sections. This can be used as a replacement for, now, deprecated and
removed `--show-all` and `--hide-all` flags.
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
In v0.13.0 flags `--show-all` and `--hide-all` have been deprecated. And
they are completely being removed now (two releases after original
announcement)
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
In v0.13.0 flags `--sort-by-required` and `--sort-by-type` have been
deprecated in favor of `--sort-by required` and `--sort-by type`
respectively. And they are completely being removed now (two releases
after original announcement)
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
If .terraform.lock.hcl exists in module path, try to extract the exact
provider version being used as opposed to provided constraints.
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
As part of this normalization the following is made sure:
- leading `v` is shown in `-v, --version` and `version` command
- commit hash is shown in `-v, --version` and `version` command
- build date is removed
- version core (without pre-release) is used for constraint comparison
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>