1--- 2title: "asciidoc table" 3description: "Generate AsciiDoc tables of inputs and outputs" 4menu: 5 docs: 6 parent: "asciidoc" 7weight: 953 8toc: true 9--- 10 11## Synopsis 12 13Generate AsciiDoc tables of inputs and outputs. 14 15```console 16terraform-docs asciidoc table [PATH] [flags] 17``` 18 19## Options 20 21```console 22 -h, --help help for table 23``` 24 25## Inherited Options 26 27```console 28 --anchor create anchor links (default true) 29 -c, --config string config file name (default ".terraform-docs.yml") 30 --default show Default column or section (default true) 31 --footer-from string relative path of a file to read footer from (default "") 32 --header-from string relative path of a file to read header from (default "main.tf") 33 --hide strings hide section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] 34 --hide-empty hide empty sections (default false) 35 --indent int indention level of AsciiDoc sections [1, 2, 3, 4, 5] (default 2) 36 --lockfile read .terraform.lock.hcl if exist (default true) 37 --output-check check if content of output file is up to date (default false) 38 --output-file string file path to insert output into (default "") 39 --output-mode string output to file method [inject, replace] (default "inject") 40 --output-template string output template (default "<!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->") 41 --output-values inject output values into outputs (default false) 42 --output-values-from string inject output values from file into outputs (default "") 43 --read-comments use comments as description when description is empty (default true) 44 --recursive update submodules recursively (default false) 45 --recursive-path string submodules path to recursively update (default "modules") 46 --required show Required column or section (default true) 47 --sensitive show Sensitive column or section (default true) 48 --show strings show section [all, data-sources, footer, header, inputs, modules, outputs, providers, requirements, resources] 49 --sort sort items (default true) 50 --sort-by string sort items by criteria [name, required, type] (default "name") 51 --type show Type column or section (default true) 52``` 53 54## Example 55 56Given the [`examples`][examples] module: 57 58```shell 59terraform-docs asciidoc table --footer-from footer.md ./examples/ 60``` 61 62generates the following output: 63 64 Usage: 65 66 Example of 'foo_bar' module in `foo_bar.tf`. 67 68 - list item 1 69 - list item 2 70 71 Even inline **formatting** in _here_ is possible. 72 and some [link](https://domain.com/) 73 74 * list item 3 75 * list item 4 76 77 ```hcl 78 module "foo_bar" { 79 source = "github.com/foo/bar" 80 81 id = "1234567890" 82 name = "baz" 83 84 zones = ["us-east-1", "us-west-1"] 85 86 tags = { 87 Name = "baz" 88 Created-By = "first.last@email.com" 89 Date-Created = "20180101" 90 } 91 } 92 ``` 93 94 Here is some trailing text after code block, 95 followed by another line of text. 96 97 | Name | Description | 98 |------|-----------------| 99 | Foo | Foo description | 100 | Bar | Bar description | 101 102 == Requirements 103 104 [cols="a,a",options="header,autowidth"] 105 |=== 106 |Name |Version 107 |[[requirement_terraform]] <<requirement_terraform,terraform>> |>= 0.12 108 |[[requirement_aws]] <<requirement_aws,aws>> |>= 2.15.0 109 |[[requirement_foo]] <<requirement_foo,foo>> |>= 1.0 110 |[[requirement_random]] <<requirement_random,random>> |>= 2.2.0 111 |=== 112 113 == Providers 114 115 [cols="a,a",options="header,autowidth"] 116 |=== 117 |Name |Version 118 |[[provider_aws]] <<provider_aws,aws>> |>= 2.15.0 119 |[[provider_aws.ident]] <<provider_aws.ident,aws.ident>> |>= 2.15.0 120 |[[provider_foo]] <<provider_foo,foo>> |>= 1.0 121 |[[provider_null]] <<provider_null,null>> |n/a 122 |[[provider_tls]] <<provider_tls,tls>> |n/a 123 |=== 124 125 == Modules 126 127 [cols="a,a,a",options="header,autowidth"] 128 |=== 129 |Name |Source |Version 130 |[[module_bar]] <<module_bar,bar>> |baz |4.5.6 131 |[[module_baz]] <<module_baz,baz>> |baz |4.5.6 132 |[[module_foo]] <<module_foo,foo>> |bar |1.2.3 133 |[[module_foobar]] <<module_foobar,foobar>> |git@github.com:module/path |v7.8.9 134 |=== 135 136 == Resources 137 138 [cols="a,a",options="header,autowidth"] 139 |=== 140 |Name |Type 141 |foo_resource.baz |resource 142 |https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.foo] |resource 143 |https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key[tls_private_key.baz] |resource 144 |https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity[aws_caller_identity.current] |data source 145 |https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity[aws_caller_identity.ident] |data source 146 |=== 147 148 == Inputs 149 150 [cols="a,a,a,a,a",options="header,autowidth"] 151 |=== 152 |Name |Description |Type |Default |Required 153 |[[input_bool-1]] <<input_bool-1,bool-1>> 154 |It's bool number one. 155 |`bool` 156 |`true` 157 |no 158 159 |[[input_bool-2]] <<input_bool-2,bool-2>> 160 |It's bool number two. 161 |`bool` 162 |`false` 163 |no 164 165 |[[input_bool-3]] <<input_bool-3,bool-3>> 166 |n/a 167 |`bool` 168 |`true` 169 |no 170 171 |[[input_bool_default_false]] <<input_bool_default_false,bool_default_false>> 172 |n/a 173 |`bool` 174 |`false` 175 |no 176 177 |[[input_input-with-code-block]] <<input_input-with-code-block,input-with-code-block>> 178 |This is a complicated one. We need a newline. 179 And an example in a code block 180 [source] 181 ---- 182 default = [ 183 "machine rack01:neptune" 184 ] 185 ---- 186 187 |`list` 188 | 189 190 [source] 191 ---- 192 [ 193 "name rack:location" 194 ] 195 ---- 196 197 |no 198 199 |[[input_input-with-pipe]] <<input_input-with-pipe,input-with-pipe>> 200 |It includes v1 \| v2 \| v3 201 |`string` 202 |`"v1"` 203 |no 204 205 |[[input_input_with_underscores]] <<input_input_with_underscores,input_with_underscores>> 206 |A variable with underscores. 207 |`any` 208 |n/a 209 |yes 210 211 |[[input_list-1]] <<input_list-1,list-1>> 212 |It's list number one. 213 |`list` 214 | 215 216 [source] 217 ---- 218 [ 219 "a", 220 "b", 221 "c" 222 ] 223 ---- 224 225 |no 226 227 |[[input_list-2]] <<input_list-2,list-2>> 228 |It's list number two. 229 |`list` 230 |n/a 231 |yes 232 233 |[[input_list-3]] <<input_list-3,list-3>> 234 |n/a 235 |`list` 236 |`[]` 237 |no 238 239 |[[input_list_default_empty]] <<input_list_default_empty,list_default_empty>> 240 |n/a 241 |`list(string)` 242 |`[]` 243 |no 244 245 |[[input_long_type]] <<input_long_type,long_type>> 246 |This description is itself markdown. 247 248 It spans over multiple lines. 249 250 | 251 252 [source] 253 ---- 254 object({ 255 name = string, 256 foo = object({ foo = string, bar = string }), 257 bar = object({ foo = string, bar = string }), 258 fizz = list(string), 259 buzz = list(string) 260 }) 261 ---- 262 263 | 264 265 [source] 266 ---- 267 { 268 "bar": { 269 "bar": "bar", 270 "foo": "bar" 271 }, 272 "buzz": [ 273 "fizz", 274 "buzz" 275 ], 276 "fizz": [], 277 "foo": { 278 "bar": "foo", 279 "foo": "foo" 280 }, 281 "name": "hello" 282 } 283 ---- 284 285 |no 286 287 |[[input_map-1]] <<input_map-1,map-1>> 288 |It's map number one. 289 |`map` 290 | 291 292 [source] 293 ---- 294 { 295 "a": 1, 296 "b": 2, 297 "c": 3 298 } 299 ---- 300 301 |no 302 303 |[[input_map-2]] <<input_map-2,map-2>> 304 |It's map number two. 305 |`map` 306 |n/a 307 |yes 308 309 |[[input_map-3]] <<input_map-3,map-3>> 310 |n/a 311 |`map` 312 |`{}` 313 |no 314 315 |[[input_no-escape-default-value]] <<input_no-escape-default-value,no-escape-default-value>> 316 |The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. 317 |`string` 318 |`"VALUE_WITH_UNDERSCORE"` 319 |no 320 321 |[[input_number-1]] <<input_number-1,number-1>> 322 |It's number number one. 323 |`number` 324 |`42` 325 |no 326 327 |[[input_number-2]] <<input_number-2,number-2>> 328 |It's number number two. 329 |`number` 330 |n/a 331 |yes 332 333 |[[input_number-3]] <<input_number-3,number-3>> 334 |n/a 335 |`number` 336 |`"19"` 337 |no 338 339 |[[input_number-4]] <<input_number-4,number-4>> 340 |n/a 341 |`number` 342 |`15.75` 343 |no 344 345 |[[input_number_default_zero]] <<input_number_default_zero,number_default_zero>> 346 |n/a 347 |`number` 348 |`0` 349 |no 350 351 |[[input_object_default_empty]] <<input_object_default_empty,object_default_empty>> 352 |n/a 353 |`object({})` 354 |`{}` 355 |no 356 357 |[[input_string-1]] <<input_string-1,string-1>> 358 |It's string number one. 359 |`string` 360 |`"bar"` 361 |no 362 363 |[[input_string-2]] <<input_string-2,string-2>> 364 |It's string number two. 365 |`string` 366 |n/a 367 |yes 368 369 |[[input_string-3]] <<input_string-3,string-3>> 370 |n/a 371 |`string` 372 |`""` 373 |no 374 375 |[[input_string-special-chars]] <<input_string-special-chars,string-special-chars>> 376 |n/a 377 |`string` 378 |`"\\.<>[]{}_-"` 379 |no 380 381 |[[input_string_default_empty]] <<input_string_default_empty,string_default_empty>> 382 |n/a 383 |`string` 384 |`""` 385 |no 386 387 |[[input_string_default_null]] <<input_string_default_null,string_default_null>> 388 |n/a 389 |`string` 390 |`null` 391 |no 392 393 |[[input_string_no_default]] <<input_string_no_default,string_no_default>> 394 |n/a 395 |`string` 396 |n/a 397 |yes 398 399 |[[input_unquoted]] <<input_unquoted,unquoted>> 400 |n/a 401 |`any` 402 |n/a 403 |yes 404 405 |[[input_with-url]] <<input_with-url,with-url>> 406 |The description contains url. https://www.domain.com/foo/bar_baz.html 407 |`string` 408 |`""` 409 |no 410 411 |=== 412 413 == Outputs 414 415 [cols="a,a",options="header,autowidth"] 416 |=== 417 |Name |Description 418 |[[output_output-0.12]] <<output_output-0.12,output-0.12>> |terraform 0.12 only 419 |[[output_output-1]] <<output_output-1,output-1>> |It's output number one. 420 |[[output_output-2]] <<output_output-2,output-2>> |It's output number two. 421 |[[output_unquoted]] <<output_unquoted,unquoted>> |It's unquoted output. 422 |=== 423 424 ## This is an example of a footer 425 426 It looks exactly like a header, but is placed at the end of the document 427 428[examples]: https://github.com/terraform-docs/terraform-docs/tree/master/examples 429