Skip to content

Commit 9f026b2

Browse files
Ivan De Marinodetro
authored andcommitted
Updating README with explicit call-out to the usages
This is a quick-and-dirty way to show the command line options, that were otherwise undocumented.
1 parent 6339051 commit 9f026b2

File tree

1 file changed

+66
-8
lines changed

1 file changed

+66
-8
lines changed

README.md

Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,62 @@
11
# terraform-plugin-docs
22

3-
This repository contains tools and packages for creating Terraform plugin docs (currently only provider plugins). The primary way users will interact with this is the **tfplugindocs** CLI tool to generate and validate plugin documentation.
3+
This repository contains tools and packages for creating Terraform plugin docs (currently only provider plugins).
4+
The primary way users will interact with this is the `tfplugindocs` CLI tool to generate and validate plugin documentation.
45

5-
## tfplugindocs
6+
## `tfplugindocs`
67

7-
The **tfplugindocs** CLI has two main commands, `validate` and `generate` (`generate` is the default). This tool will let you generate documentation for your provider from live example .tf files and markdown templates. It will also export schema information from the provider (using `terraform providers schema -json`), and sync the schema with the reference documents. If your documentation only consists of simple examples and schema information, the tool can also generate missing template files to make website creation extremely simple for most providers.
8+
The `tfplugindocs` CLI has two main commands, `validate` and `generate` (`generate` is the default).
9+
This tool will let you generate documentation for your provider from live example `.tf` files and markdown templates.
10+
It will also export schema information from the provider (using `terraform providers schema -json`),
11+
and sync the schema with the reference documents.
12+
13+
If your documentation only consists of simple examples and schema information,
14+
the tool can also generate missing template files to make website creation extremely simple for most providers.
15+
16+
### Installation
17+
18+
You can install a copy of the binary manually from the [releases](https://github.com/hashicorp/terraform-plugin-docs/releases),
19+
or you can optionally use the [tools.go model](https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md)
20+
for tool installation.
21+
22+
### Usage
23+
24+
```shell
25+
$ tfplugindocs --help
26+
Usage: tfplugindocs [--version] [--help] <command> [<args>]
27+
28+
Available commands are:
29+
the generate command is run by default
30+
generate generates a plugin website from code, templates, and examples for the current directory
31+
validate validates a plugin website for the current directory
32+
33+
```
34+
35+
`generate` command:
36+
37+
```shell
38+
$ tfplugindocs generate --help
39+
40+
Usage: tfplugindocs generate [<args>]
41+
42+
--examples-dir <ARG> examples directory (default: "examples")
43+
--ignore-deprecated <ARG> don't generate documentation for deprecated resources and data-sources (default: "false")
44+
--legacy-sidebar <ARG> generate the legacy .erb sidebar file (default: "false")
45+
--provider-name <ARG> provider name, as used in Terraform configurations
46+
--rendered-provider-name <ARG> provider name, as generated in documentation (ex. page titles, ...)
47+
--rendered-website-dir <ARG> output directory (default: "docs")
48+
--tf-version <ARG> terraform binary version to download
49+
--website-source-dir <ARG> templates directory (default: "templates")
50+
--website-temp-dir <ARG> temporary directory (used during generation)
51+
```
52+
53+
`validate` command:
54+
55+
```shell
56+
$ tfplugindocs validate --help
57+
58+
Usage: tfplugindocs validate [<args>]
59+
```
860
961
### How it Works
1062
@@ -19,7 +71,12 @@ When you run `tfplugindocs` from root directory of the provider the tool takes t
1971
* Copy all non-template files to the output website directory
2072
* Process all the remaining templates to generate files for the output website directory
2173
22-
You can see an example of the templates and output in [paultyng/terraform-provider-unifi](https://github.com/paultyng/terraform-provider-unifi) and browse the generated docs in the [Terraform Registry](https://registry.terraform.io/providers/paultyng/unifi/latest/docs).
74+
For inspiration, you can look at the templates and output of the
75+
[`terraform-provider-random`](https://github.com/hashicorp/terraform-provider-random)
76+
and [`terraform-provider-tls`](https://github.com/hashicorp/terraform-provider-tls).
77+
And you can browser their respective docs on the Terraform Registry,
78+
[here](https://registry.terraform.io/providers/hashicorp/random/latest/docs)
79+
and [here](https://registry.terraform.io/providers/hashicorp/tls/latest/docs).
2380
2481
#### About the `id` attribute
2582
@@ -87,10 +144,11 @@ TBD
87144
| `plainmarkdown` | Render Markdown content as plaintext |
88145
| `split` | Split string into sub-strings, eg. `split .Name "_"` |
89146

90-
### Installation
91-
92-
You can install a copy of the binary manually from the releases, or you can optionally use the [tools.go model](https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md) for tool installation.
93147

94148
## Disclaimer
95149

96-
This experimental repository contains software which is still being developed and in the alpha testing stage. It is not ready for production use.
150+
This is still under development: while it's being used for production-ready providers, you might still find bugs
151+
and limitations. In those cases, please report [issues](https://github.com/hashicorp/terraform-plugin-docs/issues)
152+
or, if you can, submit a [pull-request](https://github.com/hashicorp/terraform-plugin-docs/pulls).
153+
154+
Your help and patience is truly appreciated.

0 commit comments

Comments
 (0)