Commit Graph

24 Commits

Author SHA1 Message Date
Julien Duchesne
52653b5107 fix: Render special chars in variables' default value properly (#284)
* Fix: No longer crashes when there are special chars in a variable default

* Do not escape chars everywhere

* Cleanup go.mod
2020-07-17 13:13:50 -04:00
Khosrow Moossavi
fd97ec5930 feat: Add support for .terraform-docs.yml config file (#272)
* Add support for .terraform-docs.yml config file

* add config reader

* add usage documentation and reference guide

* typo

* update docs
2020-07-13 22:06:30 -04:00
Khosrow Moossavi
fbbf01e451 Read header from .adoc, .md and .txt file as well (#252)
* Allow reading header from a markdown file

* wording

* add supports for .adoc and .txt as well

* wording

* revert docs

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2020-04-29 15:30:48 -04:00
Khosrow Moossavi
8f930437fa fix: Make sure requirements section is sorted (#233)
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2020-04-01 17:25:52 -04:00
Khosrow Moossavi
a3e0a56ce6 fix: Mark variables not required if default set to null (#221)
* 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
2020-03-30 16:16:55 -04:00
Khosrow Moossavi
b6241751d9 feat: Add section for module requirements (#222)
* Add section for module requirements

* cleanup

* reorder items logically
2020-03-24 14:20:13 -04:00
Khosrow Moossavi
01c8fa1c61 feat: Add support for fetching the module header from any file (#217)
* Add support for fetching the module header from any file

* fix the failing test because of lines reader
2020-03-12 13:58:35 -04:00
Khosrow Moossavi
4ff4582dff feat: Show sensitivity of the output value in rendered result (#207) 2020-02-26 12:08:24 -05:00
Khosrow Moossavi
743d4f3ebc refactor: Add Default value types for better marshalling (#196)
* Add Default value types for better marshalling

* fix output-values tests
2020-02-19 15:37:48 -05:00
Gretchen Shelby-Dormer
31cdef0f67 feat: Extract and render output values from Terraform (#191)
* Allow users to pass '--output-values'

Pass empty string to CreateModule.outputValuePath

* Fix bug causing 'pretty' tests to fail

* Link formats documentation in README (#181)

Co-authored-by: Khosrow Moossavi <khos2ow@gmail.com>

* docs: Auto generate formats document from examples (#192)

* Auto generate formats document from examples

* fix lint issues

* refactor: Add tfconf.Options to load Module with (#193)

* Update Changelog

* Allow users to pass '--output-values'

Read the outputValuesPath from an env variable

Use an env var with a path for '--output-values'

Update Changelog

Use an env var with a path for '--output-values'

Update Changelog

properly write output values for evrythng but yaml

* Fix failing json+yaml tests

* Remove unneeded code block from output.go

* Remove unused import statement from output.go

* Fix some noob mistakes

* Create two flags to use for output value injection

* Fix bug vanilla commands+build test to fail

* Modify all tests and add new for outputvalues

* Modify to include many output types

* Optimize imports to appease checkfmt

* Create loadOutputValues function

* Fix linter issue

* Code review fixes. Hopefully the final commit!

* appease linter

* Not allow sensitive output values to be injected

* Remove trailing slash from tests

* Remove default values from `--output-values-from`

Co-authored-by: Martyn Ranyard <iMartyn@users.noreply.github.com>
Co-authored-by: Khosrow Moossavi <khos2ow@gmail.com>
2020-02-19 11:46:43 -05:00
Khosrow Moossavi
bf07706947 fix: Do not escape markdown table inside module header (#186) 2020-02-01 14:21:54 -05:00
Khosrow Moossavi
43f69d337f fix: Preserve asterisk list in header and fix escaping (#179) 2020-01-30 18:47:32 -05:00
Khosrow Moossavi
bf38a75fe3 fix: Add newline between code block and trailing lines (#184) 2020-01-30 18:09:45 -05:00
Khosrow Moossavi
6ff46a26b1 fix: Do not escape any characters of a URL (#170) 2020-01-17 13:45:48 -05:00
Khosrow Moossavi
82e87aa264 fix: Do not escape strings inside code blocks (#155) 2020-01-12 15:20:12 -05:00
Khosrow Moossavi
b3112d135a fix: Read leading module header from main.tf (#154)
Supported comment formats is:
- jsdoc, c or java-like multi-line comment `/** **/`

BREAKING CHANGE: - In the JSON format respone, module "Comment" has been renamed to module `header`.
2020-01-10 16:40:48 -05:00
Khosrow Moossavi
a6193849c4 fix: Read leading comment lines if description is not provided (#151)
Supported comment formats are:

- multi-lines start with `#` comment format
- multi-lines start with `//` comment format

Unsupported comments formats is:

- jsdoc, c or java-like multi-line comment `/** **/`
2020-01-07 21:49:56 -05:00
Khosrow Moossavi
ce32bf10a9 feat: Show 'providers' information (#140)
* Show 'providers' information

* Fix for unsorted providers list

BREAKING CHANGE: - With Terraform 0.12 the information about `providers` being used in the module will be generated by default. This will cause the first generation of documents with the latest release of `terraform-docs` binary be slightly different than before, now there will be `Providers` section in Markdown and `providers` block in JSON. You can ignore this by using new `--no-providers` flag if you choose to.

Originally-Authored-By: Thomas Alton <thomas.alton@gmail.com>
Original-Pull-Request: #113
2020-01-03 18:33:08 -05:00
Thomas Alton
b8da8c5020 feat: Support Terraform 0.12.x configuration (#113)
* Support 0.12 configuration

* Move code out of GOPATH for CircleCI

* cleanup

* Rename 'variables' back to 'input' just for now

* Normalizing 'print.s.Settings' usage

* Normalize settings continued

* Remove '--providers' functionality for now

* Adjust 'commands' based on moarta's changes

* Adjust 'pkg/doc' based on moarta's changes

* Adjust 'pkg/print/json' based on moarta's changes

* Fix json tests

* don't trim whitespaces from .tf files

* Adjust 'pkg/print/pretty' based on moarta's changes

* Fix pretty tests

* don't trim whitespaces from .golden files

* Show 'n/a' for empty description for 'pretty'

* Show 'any' if type of input variable is missing

* Adjust 'pkg/print/markdown/document' based on moarta's changes

* Fix document tests

* move back vendor files

* Adjust 'pkg/print/markdown/table' based on moarta's changes

* fix lint issue

* Fix table tests

* figure out input type based on default value if tpye not explicitly defined

* don't escape ( ) [ ] { }, as they don't cause any issue

Authored-by: Thomas Alton <thomas.alton@gmail.com>
Co-authored-by: Khosrow Moossavi <khos2ow@gmail.com>
2019-12-20 15:07:29 -05:00
Hugues Malphettes
ab42f0d097 Code blocks support for all formats. Single line break support (#123)
*  HTML-ize code blocks inside a markdown table. Single line break.

 Add support for embedding markdown code blocks inside markdown tables

 Add support for single-line breaks: when the line ends with 2 spaces, place
 a single <br>.

* Fix the testsuite, todo improve the escape code for document

* Add the WithIndent testdata
2019-12-11 14:48:49 -05:00
Khosrow Moossavi
f0a7d374a5 Enhance Makefile and add editorconfig (#115) 2019-09-23 20:27:11 +02:00
Khosrow Moossavi
9f63bdf484 Escape pipe character when generating Markdown (#114) 2019-06-28 19:19:08 +02:00
Martin Etmajer
18939caf6d Unify default values of inputs (#97) 2018-12-13 08:59:30 +01:00
Martin Etmajer
750d500622 Move Terraform test configuration to folder 'examples'. 2018-12-02 19:44:21 +01:00