2 个版本

0.1.5 2019年3月22日
0.1.4 2019年3月21日

#1942 in 开发工具

Apache-2.0

16KB
334 代码行

tfdoc

该项目旨在生成 Terraform 模块的文档。

用法

tfdoc 将解析模块目录内的所有文件,并生成相应的 README.tf 文件

# Title: The name of the module
# Top comment prefixed by "Title: " and the following lines
# will be at the top of the Markdown file

variable "environment" {
  description = "Variable descriptions will be parsed"
}

# tfdoc keeps comments right on top of resource, variable
# and output blocks. All variables and outputs are kept.
# Only resources with comments on top are.
resource "aws_instance" "this" {
  # stuff
}

resource "aws_instance" "no_comment_here" {
  # stuff
}

##
## tfdoc discards other "orphaned" comments
##

# We can have both comments on top
output "name" {
  description = "and within outputs and variables"
}

# Data blocks are ignored
data "aws_ami" "node" {}
$ tfdoc $PATH_TO_MODULE
# The name of the module

Top comment prefixed by "Title: " and the following lines will be at the top of the Markdown file

## Resources

* `aws_instance.this`: tfdoc keeps comments right on top of resource, variable and output blocks. All variables and outputs are kept. Only resources with comments on top are.

## Inputs

* `environment`: Variable descriptions will be parsed

## Outputs

* `name`: We can have both comments on top and within outputs and variables

原始想法来自:https://github.com/jyrivallan

无运行时依赖