Documentation ¶
Overview ¶
Package format contains helpers for formatting various Terraform structures for human-readabout output.
This package is used by the official Terraform CLI in formatting any output and is exported to encourage non-official frontends to mimic the output formatting as much as possible so that text formats of Terraform structures have a consistent look and feel.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diagnostic ¶ added in v0.10.8
func Diagnostic(diag tfdiags.Diagnostic, color *colorstring.Colorize, width int) string
Diagnostic formats a single diagnostic message.
The width argument specifies at what column the diagnostic messages will be wrapped. If set to zero, messages will not be wrapped by this function at all. Although the long-form text parts of the message are wrapped, not all aspects of the message are guaranteed to fit within the specified terminal width.
func DiffActionSymbol ¶ added in v0.10.4
func DiffActionSymbol(action terraform.DiffChangeType) string
DiffActionSymbol returns a string that, once passed through a colorstring.Colorize, will produce a result that can be written to a terminal to produce a symbol made of three printable characters, possibly interspersed with VT100 color codes.
Types ¶
type AttributeDiff ¶ added in v0.10.4
type AttributeDiff struct { // Path is a dot-delimited traversal through possibly many levels of list and map structure, // intended for display purposes only. Path string Action terraform.DiffChangeType OldValue string NewValue string NewComputed bool Sensitive bool ForcesNew bool }
AttributeDiff is a representation of an attribute diff optimized for display, in conjunction with DisplayInstanceDiff.
type InstanceDiff ¶ added in v0.10.4
type InstanceDiff struct { Addr *terraform.ResourceAddress Action terraform.DiffChangeType // Attributes describes changes to the attributes of the instance. // // For destroy diffs this is always nil. Attributes []*AttributeDiff Tainted bool Deposed bool }
InstanceDiff is a representation of an instance diff optimized for display, in conjunction with DisplayPlan.
type Plan ¶
type Plan struct {
Resources []*InstanceDiff
}
Plan is a representation of a plan optimized for display to an end-user, as opposed to terraform.Plan which is for internal use.
DisplayPlan excludes implementation details that may otherwise appear in the main plan, such as destroy actions on data sources (which are there only to clean up the state).
func (*Plan) ActionCounts ¶ added in v0.10.4
func (p *Plan) ActionCounts() map[terraform.DiffChangeType]int
ActionCounts returns the number of diffs for each action type
func (*Plan) Empty ¶ added in v0.10.4
Empty returns true if there is at least one resource diff in the receiving plan.
type PlanStats ¶ added in v0.10.4
type PlanStats struct {
ToAdd, ToChange, ToDestroy int
}
PlanStats gives summary counts for a Plan.
type StateOpts ¶
type StateOpts struct { // State is the state to format. This is required. State *terraform.State // Color is the colorizer. This is optional. Color *colorstring.Colorize // ModuleDepth is the depth of the modules to expand. By default this // is zero which will not expand modules at all. ModuleDepth int }
StateOpts are the options for formatting a state.