--- title: "markdown table" description: "Generate Markdown tables of inputs and outputs" menu: docs: parent: "markdown" weight: 957 toc: true --- ## Synopsis Generate Markdown tables of inputs and outputs. ```console terraform-docs markdown table [PATH] [flags] ``` ## Options ```console -h, --help help for table ``` ## Inherited Options ```console --anchor create anchor links (default true) -c, --config string config file name (default ".terraform-docs.yml") --default show Default column or section (default true) --escape escape special characters (default true) --footer-from string relative path of a file to read footer from (default "") --header-from string relative path of a file to read header from (default "main.tf") --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --hide-empty hide empty sections (default false) --html use HTML tags in genereted output (default true) --indent int indention level of Markdown sections [1, 2, 3, 4, 5] (default 2) --lockfile read .terraform.lock.hcl if exist (default true) --output-check check if content of output file is up to date (default false) --output-file string file path to insert output into (default "") --output-mode string output to file method [inject, replace] (default "inject") --output-template string output template (default "\n{{ .Content }}\n") --output-values inject output values into outputs (default false) --output-values-from string inject output values from file into outputs (default "") --read-comments use comments as description when description is empty (default true) --recursive update submodules recursively (default false) --recursive-include-main include the main module (default true) --recursive-path string submodules path to recursively update (default "modules") --required show Required column or section (default true) --sensitive show Sensitive column or section (default true) --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] --sort sort items (default true) --sort-by string sort items by criteria [name, required, type] (default "name") --type show Type column or section (default true) ``` ## Example Given the [`examples`][examples] module: ```shell terraform-docs markdown table --footer-from footer.md ./examples/ ``` generates the following output: Usage: Example of 'foo\_bar' module in `foo_bar.tf`. - list item 1 - list item 2 Even inline **formatting** in _here_ is possible. and some [link](https://domain.com/) * list item 3 * list item 4 ```hcl module "foo_bar" { source = "github.com/foo/bar" id = "1234567890" name = "baz" zones = ["us-east-1", "us-west-1"] tags = { Name = "baz" Created-By = "first.last@email.com" Date-Created = "20180101" } } ``` Here is some trailing text after code block, followed by another line of text. | Name | Description | |------|-----------------| | Foo | Foo description | | Bar | Bar description | ## Requirements | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.12 | | [aws](#requirement\_aws) | >= 2.15.0 | | [foo](#requirement\_foo) | >= 1.0 | | [random](#requirement\_random) | >= 2.2.0 | ## Providers | Name | Version | |------|---------| | [aws](#provider\_aws) | >= 2.15.0 | | [aws.ident](#provider\_aws.ident) | >= 2.15.0 | | [foo](#provider\_foo) | >= 1.0 | | [null](#provider\_null) | n/a | | [tls](#provider\_tls) | n/a | ## Modules | Name | Source | Version | |------|--------|---------| | [bar](#module\_bar) | baz | 4.5.6 | | [baz](#module\_baz) | baz | 4.5.6 | | [foo](#module\_foo) | bar | 1.2.3 | | [foobar](#module\_foobar) | git@github.com:module/path | v7.8.9 | ## Resources | Name | Type | |------|------| | foo_resource.baz | resource | | [null_resource.foo](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [tls_private_key.baz](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | | [aws_caller_identity.ident](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | ## Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [bool-1](#input\_bool-1) | It's bool number one. | `bool` | `true` | no | | [bool-2](#input\_bool-2) | It's bool number two. | `bool` | `false` | no | | [bool-3](#input\_bool-3) | n/a | `bool` | `true` | no | | [bool\_default\_false](#input\_bool\_default\_false) | n/a | `bool` | `false` | no | | [input-with-code-block](#input\_input-with-code-block) | This is a complicated one. We need a newline.
And an example in a code block
default     = [
"machine rack01:neptune"
]
| `list` |
[
"name rack:location"
]
| no | | [input-with-pipe](#input\_input-with-pipe) | It includes v1 \| v2 \| v3 | `string` | `"v1"` | no | | [input\_with\_underscores](#input\_input\_with\_underscores) | A variable with underscores. | `any` | n/a | yes | | [list-1](#input\_list-1) | It's list number one. | `list` |
[
"a",
"b",
"c"
]
| no | | [list-2](#input\_list-2) | It's list number two. | `list` | n/a | yes | | [list-3](#input\_list-3) | n/a | `list` | `[]` | no | | [list\_default\_empty](#input\_list\_default\_empty) | n/a | `list(string)` | `[]` | no | | [long\_type](#input\_long\_type) | This description is itself markdown.

It spans over multiple lines. |
object({
name = string,
foo = object({ foo = string, bar = string }),
bar = object({ foo = string, bar = string }),
fizz = list(string),
buzz = list(string)
})
|
{
"bar": {
"bar": "bar",
"foo": "bar"
},
"buzz": [
"fizz",
"buzz"
],
"fizz": [],
"foo": {
"bar": "foo",
"foo": "foo"
},
"name": "hello"
}
| no | | [map-1](#input\_map-1) | It's map number one. | `map` |
{
"a": 1,
"b": 2,
"c": 3
}
| no | | [map-2](#input\_map-2) | It's map number two. | `map` | n/a | yes | | [map-3](#input\_map-3) | n/a | `map` | `{}` | no | | [no-escape-default-value](#input\_no-escape-default-value) | The description contains `something_with_underscore`. Defaults to 'VALUE\_WITH\_UNDERSCORE'. | `string` | `"VALUE_WITH_UNDERSCORE"` | no | | [number-1](#input\_number-1) | It's number number one. | `number` | `42` | no | | [number-2](#input\_number-2) | It's number number two. | `number` | n/a | yes | | [number-3](#input\_number-3) | n/a | `number` | `"19"` | no | | [number-4](#input\_number-4) | n/a | `number` | `15.75` | no | | [number\_default\_zero](#input\_number\_default\_zero) | n/a | `number` | `0` | no | | [object\_default\_empty](#input\_object\_default\_empty) | n/a | `object({})` | `{}` | no | | [string-1](#input\_string-1) | It's string number one. | `string` | `"bar"` | no | | [string-2](#input\_string-2) | It's string number two. | `string` | n/a | yes | | [string-3](#input\_string-3) | n/a | `string` | `""` | no | | [string-special-chars](#input\_string-special-chars) | n/a | `string` | `"\\.<>[]{}_-"` | no | | [string\_default\_empty](#input\_string\_default\_empty) | n/a | `string` | `""` | no | | [string\_default\_null](#input\_string\_default\_null) | n/a | `string` | `null` | no | | [string\_no\_default](#input\_string\_no\_default) | n/a | `string` | n/a | yes | | [unquoted](#input\_unquoted) | n/a | `any` | n/a | yes | | [with-url](#input\_with-url) | The description contains url. https://www.domain.com/foo/bar_baz.html | `string` | `""` | no | ## Outputs | Name | Description | |------|-------------| | [output-0.12](#output\_output-0.12) | terraform 0.12 only | | [output-1](#output\_output-1) | It's output number one. | | [output-2](#output\_output-2) | It's output number two. | | [unquoted](#output\_unquoted) | It's unquoted output. | ## This is an example of a footer It looks exactly like a header, but is placed at the end of the document [examples]: https://github.com/terraform-docs/terraform-docs/tree/master/examples