This package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package print provides configuration, and a Generator.
Configuration¶
`print.Config` is the data structure representation for `.terraform-docs.yml`which will be read and extracted upon execution of terraform-docs cli. On theother hand it can be used directly if you are using terraform-docs as a library.
This will return an instance of `Config` with default values set:
config := print.DefaultConfig()
Alternatively this will return an empty instance of `Config`:
config := print.NewConfig()
Generator¶
`Generator` is an abstract implementation of `format.Type`. It doesn't implement`Generate(*terraform.Module) error` function. It is used directly by differentformat types, i.e. each format extends `Generator` and provides its implementationof `Generate` function.
Generator holds a reference to all the sections (e.g. header, footer, inputs, etc)and also it renders all of them, in a predefined order, in `Content()`.
It also provides `Render(string)` function to process and render the template to generatethe final output content. Following variables and functions are available:
• `{{ .Header }}`• `{{ .Footer }}`• `{{ .Inputs }}`• `{{ .Modules }}`• `{{ .Outputs }}`• `{{ .Providers }}`• `{{ .Requirements }}`• `{{ .Resources }}`• `{{ include "path/fo/file" }}`
Index¶
Constants¶
const (OutputModeInject = "inject"OutputModeReplace = "replace")
Output modes.
const (OutputBeginComment = "<!-- BEGIN_TF_DOCS -->"OutputContent = "{{ .Content }}"OutputEndComment = "<!-- END_TF_DOCS -->")
Output template.
const (SortName = "name"SortRequired = "required"SortType = "type")
Sort types.
Variables¶
var (OutputTemplate =fmt.Sprintf("%s\n%s\n%s",OutputBeginComment,OutputContent,OutputEndComment)OutputModes =strings.Join([]string{OutputModeInject,OutputModeReplace}, ", "))
Output to file template and modes.
var AllSections =strings.Join(allSections, ", ")
AllSections list.
var SortTypes =strings.Join(allSorts, ", ")
SortTypes list.
Functions¶
This section is empty.
Types¶
typeConfig¶added inv0.16.0
type Config struct {Filestring `mapstructure:"-"`Formatterstring `mapstructure:"formatter"`Versionstring `mapstructure:"version"`HeaderFromstring `mapstructure:"header-from"`FooterFromstring `mapstructure:"footer-from"`Recursive recursive `mapstructure:"recursive"`Contentstring `mapstructure:"content"`Sections sections `mapstructure:"sections"`Output output `mapstructure:"output"`OutputValues outputvalues `mapstructure:"output-values"`Sort sort `mapstructure:"sort"`Settings settings `mapstructure:"settings"`ModuleRootstring}
Config represents all the available config options that can be accessed andpassed through CLI.
funcDefaultConfig¶added inv0.16.0
func DefaultConfig() *Config
DefaultConfig returns new instance of Config with default values set.
funcNewConfig¶added inv0.16.0
func NewConfig() *Config
NewConfig returns neew instancee of Config with empty values.
funcReadConfig¶added inv0.16.0
ReadConfig reads config file in `rootDir` with given `filename` and returnsinstance of Config. It returns error if config file not found or there is aproblem with unmarshalling.