* '''Terraform Configuration Files''': The `.tf` files containing the infrastructure as code definitions. * '''terraform-docs Binary''': The executable tool that reads Terraform configurations and generates documentation.
* '''Auto-Generated Documentation''': Extracts and formats information from Terraform modules without manual intervention. * '''Support for Multiple Formats''': Outputs documentation in formats such as Markdown, JSON, YAML, HTML, and AsciiDoc. * '''Customizable Output''': Allows customization of the generated documentation to meet specific needs. * '''Module-Level Documentation''': Focuses on documenting individual modules, including their inputs, outputs, and dependencies.
```bash go install github.com/terraform-docs/terraform-docs@latest ```
```bash terraform-docs markdown ./ ```
```bash terraform-docs json ./ ```
```bash terraform-docs markdown ./ > README.md ```
```markdown ## Providers
]] | [[ Name ]] | [[ Version ]] | [[ ]] | [[------]] | [[---------]] | [[ ]] | [[ aws ]] | [[ >= 2.0 ]] | [[
## Inputs
]] | [[ Name ]] | [[ Description ]] | [[ Type ]] | [[ Default ]] | [[ Required ]] | [[ ]] | [[---------------]] | [[---------------------------------------]] | [[----------]] | [[---------]] | [[:--------:]] | [[ ]] | [[ instance_type ]] | [[ The type of instance to use ]] | [[ `string` ]] | [[ `t2.micro` ]] | [[ yes ]] | [[ ]] | [[ ami_id ]] | [[ The AMI ID for the instance ]] | [[ `string` ]] | [[ n/a ]] | [[ yes ]] | [[
## Outputs
]] | [[ Name ]] | [[ Description ]] | [[ ]] | [[--------------]] | [[-------------------------]] | [[ ]] | [[ instance_id ]] | [[ The ID of the instance ]] | [[ ]] | [[ instance_ip ]] | [[ The IP address of the instance ]] | [[ ```