Enables a footer to be appended to the end of a generated document
sourced from tf files or documents in the same way as the header
Adds the `footer-from` field to the config yml
Adds the `--footer-from` flag to the cli
Signed-off-by: Simon Clifford <siclifford@gmail.com>
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
This is going to preserve line-ending of extracted header text as they
are provided by users. In other words we are going to always assume the
header text is formatted in the "intended" way by users. So we're never
going to modify line-endings and won't append `<SPACE><SPACE>` at the
end of paragraph lines.
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
There are two modes for saving into file:
- inject: partially replace the target file with generated output
- replace: completely replace the target file with generated output
The output generated by formatters (markdown, asciidoc, etc) will be
inserted into a template before getting saved into the file. This
template can be customized with '--output-template' CLI flag or
corresponding item in '.terraform-docs.yml' config file. Its default
value is:
```
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
```
This consists of three items, all of them are mandatory:
- begin comment
- content variable
- end comment
You may change the wording of comment as you wish, but the comment must
be present in the template.
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
Two new flags are added: '--default bool' and '--type bool' to
control the visibility of Default and Type columns and section
respectively in Markdown and AsciiDoc.
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
If version contraints of required providers contain anything except of
fixed version (e.g. '1.2.3', or '= 1.2.3'), there's no way to extract
the actual intended version while being offline and solely by looking at
the terraform files, as such if such a version was provided we're going
to fall back to 'latest' as part of resource URL.
The link, unfortunately, will not be 100% accurate all the times. For
example constraint might be '>= 1.2.3, < 2.0.0' but the latest version
of said resource is at 3.x. But the silver lining is that the generated
link is never broken.
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
Generated output will not have any empty line or
carriage return at the end of the last line and
one carriage return (\n) will be added when we
print that to stdout.
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
BREAKING CHANGE: - Following flags have been deprecated and will be
removed in the following releases:
- Flag `--no-color` has been deprecated, use `--color=false` instead
- Flag `--no-escape` has been deprecated, use `--escape=false` instead
- Flag `--no-header` has been deprecated, use `--hide header` instead
- Flag `--no-inputs` has been deprecated, use `--hide inputs` instead
- Flag `--no-outputs` has been deprecated, use `--hide outputs` instead
- Flag `--no-providers` has been deprecated, use `--hide providers` instead
- Flag `--no-requirements` has been deprecated, use `--hide requirements` instead
- Flag `--no-required` has been deprecated, use `--required=false` instead
- Flag `--no-sensitive` has been deprecated, use `--sensitive=false` instead
- Flag `--no-sort` has been deprecated, use `--sort=false` instead
* Implement AsciiDoc renderer
* Add missing tests to maintain expected code coverage
* Keep alphabetical order
* Refactor indent function (accept char argument and make homogeneous for both MD and Adoc renderers)
* Force asciidoc syntax in every table column
* Remove extra NL before code blocks and add autowidth tables
* Move char argument after settings in indent function
* Implement new factory function for asciidoc renderer
* Update asciidoc table docs
* Return empty indentation if no indent scpecified
* Prevent adding a trailing whitespace in table rows
* Change asciidoc alias to match file extension
* Update docs
* Mark variables not required if default set to null
* Move github.com/hashicorp/terraform-config-inspect to internal/tfconfig
Internally we depend on terraform-config-inspect, but at the moment
they state that they consider the project is feature-complete and
they do not accept any enhancement pull requests, as such we've
decided to bring over the project as internal package here rather than
being a vendor dependency and apply the fix from @jstewmon from
https://github.com/hashicorp/terraform-config-inspect/pull/24 directly
here.
Since the terraform-config-inspect is considered to be feature-complete
we don't expect to have any more changes on the package, and if there
was a change on upstream we're going to bring it down in the
corresponding package.
* Add notice to the new package
* add license of terraform-config-inspect code
* fix tests after merging master
* fix test after merge master
* show 'required' attribute in JSON, XML, YAML
* update docs
* Allow hiding the "Sensitive" column in markdown
Use case: for projects where all outputs are expected to not be sensitive, it adds noise
* Document the new --no-sensitive option
* Fixed tests, they were written on a previous branch
* Fix tests following merge with master
* Update internal/format/document.go
Co-Authored-By: Khosrow Moossavi <khos2ow@gmail.com>
Co-authored-by: Khosrow Moossavi <khos2ow@gmail.com>