Documentation
¶
Index ¶
- Constants
- func ComputedOnly(a attributeChange) bool
- func IgnoreComputed(a attributeChange) bool
- func IgnoreNoOp(a attributeChange) bool
- func IgnoreSensitive(a attributeChange) bool
- func IsArrayAttributeChangeLine(line string) bool
- func IsArrayAttributeTerminator(line string) bool
- func IsAttributeChangeArrayItem(line string) bool
- func IsAttributeChangeLine(line string) bool
- func IsHeredocAttributeChangeLine(line string) bool
- func IsHeredocAttributeTerminator(line string) bool
- func IsJSONEncodeAttributeChangeLine(line string) bool
- func IsJSONEncodeAttributeTerminator(line string) bool
- func IsMapAttributeChangeLine(line string) bool
- func IsMapAttributeTerminator(line string) bool
- func IsOneLineEmptyArrayAttribute(line string) bool
- func IsOneLineEmptyMapAttribute(line string) bool
- func IsResourceChangeLine(line string) bool
- func IsResourceCommentLine(line string) bool
- func IsResourceTerminator(line string) bool
- type ArrayAttributeChange
- func (a *ArrayAttributeChange) GetAfter(opts ...GetBeforeAfterOptions) interface{}
- func (a *ArrayAttributeChange) GetBefore(opts ...GetBeforeAfterOptions) interface{}
- func (a *ArrayAttributeChange) GetName() string
- func (a *ArrayAttributeChange) GetUpdateType() UpdateType
- func (a *ArrayAttributeChange) IsComputed() bool
- func (a *ArrayAttributeChange) IsNoOp() bool
- func (a *ArrayAttributeChange) IsSensitive() bool
- type AttributeChange
- func (a *AttributeChange) GetAfter(opts ...GetBeforeAfterOptions) interface{}
- func (a *AttributeChange) GetBefore(opts ...GetBeforeAfterOptions) interface{}
- func (a *AttributeChange) GetName() string
- func (a *AttributeChange) GetUpdateType() UpdateType
- func (a *AttributeChange) IsComputed() bool
- func (a *AttributeChange) IsNoOp() bool
- func (a *AttributeChange) IsSensitive() bool
- type GetBeforeAfterOptions
- type HeredocAttributeChange
- func (h *HeredocAttributeChange) AddLineToContent(line string)
- func (h *HeredocAttributeChange) GetAfter(opts ...GetBeforeAfterOptions) interface{}
- func (h *HeredocAttributeChange) GetBefore(opts ...GetBeforeAfterOptions) interface{}
- func (h *HeredocAttributeChange) GetName() string
- func (h *HeredocAttributeChange) GetUpdateType() UpdateType
- func (h *HeredocAttributeChange) IsComputed() bool
- func (h *HeredocAttributeChange) IsNoOp() bool
- func (h *HeredocAttributeChange) IsSensitive() bool
- type JSONEncodeAttributeChange
- func (j *JSONEncodeAttributeChange) GetAfter(opts ...GetBeforeAfterOptions) interface{}
- func (j *JSONEncodeAttributeChange) GetBefore(opts ...GetBeforeAfterOptions) interface{}
- func (j *JSONEncodeAttributeChange) GetName() string
- func (j *JSONEncodeAttributeChange) GetUpdateType() UpdateType
- func (j *JSONEncodeAttributeChange) IsComputed() bool
- func (j *JSONEncodeAttributeChange) IsNoOp() bool
- func (j *JSONEncodeAttributeChange) IsSensitive() bool
- type MapAttributeChange
- func (m *MapAttributeChange) GetAfter(opts ...GetBeforeAfterOptions) interface{}
- func (m *MapAttributeChange) GetBefore(opts ...GetBeforeAfterOptions) interface{}
- func (m *MapAttributeChange) GetName() string
- func (m *MapAttributeChange) GetUpdateType() UpdateType
- func (m *MapAttributeChange) IsComputed() bool
- func (m *MapAttributeChange) IsNoOp() bool
- func (m *MapAttributeChange) IsSensitive() bool
- type ResourceChange
- type UpdateType
Constants ¶
const ( ATTRIBUTE_CHANGE_DELIMITER = " -> " ATTRIBUTE_DEFINITON_DELIMITER = " = " SENSITIVE_VALUE = "(sensitive value)" COMPUTED_VALUE = "(known after apply)" )
const ( NO_CHANGES_STRING = "No changes. Infrastructure is up-to-date." CHANGES_START_STRING = "Terraform will perform the following actions:" CHANGES_END_STRING = "Plan: " ERROR_STRING = "Error: " )
const ( RESOURCE_CREATED = " will be created" RESOURCE_READ = " will be read during apply" RESOURCE_READ_VALUES_NOT_YET_KNOWN = " (config refers to values not yet known)" RESOURCE_UPDATED_IN_PLACE = " will be updated in-place" RESOURCE_TAINTED = " is tainted, so must be replaced" RESOURCE_REPLACED = " must be replaced" RESOURCE_DESTROYED = " will be destroyed" )
Variables ¶
This section is empty.
Functions ¶
func ComputedOnly ¶
func ComputedOnly(a attributeChange) bool
func IgnoreComputed ¶
func IgnoreComputed(a attributeChange) bool
func IgnoreNoOp ¶ added in v0.0.9
func IgnoreNoOp(a attributeChange) bool
func IgnoreSensitive ¶
func IgnoreSensitive(a attributeChange) bool
func IsArrayAttributeChangeLine ¶ added in v0.0.6
IsArrayAttributeChangeLine returns true if the line is a valid attribute change This requires the line to start with "+", "-" or "~", not be followed with "resource" or "data", and ends with "[".
func IsArrayAttributeTerminator ¶ added in v0.0.6
IsArrayAttributeTerminator returns true if the line is "]" or "] -> null"
func IsAttributeChangeArrayItem ¶ added in v0.0.6
IsAttributeChangeArrayItem returns true if the line is a valid attribute change in an array
func IsAttributeChangeLine ¶
IsAttributeChangeLine returns true if the line is a valid attribute change This requires the line to start with "+", "-" or "~", and not be followed with "resource"
func IsHeredocAttributeChangeLine ¶ added in v0.0.6
IsHeredocAttributeChangeLine returns true if the line is a valid attribute change This requires the line to start with "+", "-" or "~", delimited with a space, and the value to start with "<<".
func IsHeredocAttributeTerminator ¶ added in v0.0.6
IsHeredocAttributeTerminator returns true if the line is "EOT" EOT is the only possible terminator for the heredoc Ref: https://github.com/hashicorp/terraform/blob/6a126df0c601ab23689171506bfc1386fea4c96c/command/format/diff.go#L880
func IsJSONEncodeAttributeChangeLine ¶ added in v0.0.14
IsJSONEncodeAttributeChangeLine returns true if the line is a valid attribute change This requires the line to start with "+", "-" or "~", delimited with a space, and the value to start with "jsonencode(".
func IsJSONEncodeAttributeTerminator ¶ added in v0.0.14
IsJSONEncodeAttributeTerminator returns true if the line is ")" TODO: verify this
func IsMapAttributeChangeLine ¶
IsMapAttributeChangeLine returns true if the line is a valid attribute change This requires the line to start with "+", "-" or "~", not be followed with "resource" or "data", and ends with "{".
func IsMapAttributeTerminator ¶
IsMapAttributeTerminator returns true if the line is a "}" or "},"
func IsOneLineEmptyArrayAttribute ¶ added in v0.0.6
IsOneLineEmptyArrayAttribute returns true if the line ends with a "[]"
func IsOneLineEmptyMapAttribute ¶ added in v0.0.6
IsOneLineEmptyMapAttribute returns true if the line ends with a "{}"
func IsResourceChangeLine ¶
IsResourceChangeLine returns true if the line is a valid resource change line A valid line starts with the change type, then "resource" or "data", and then the type and name, followed by a { Example: + resource "type" "name" {
func IsResourceCommentLine ¶
IsResourceCommentLine returns true if the line is a valid resource comment line A valid line starts with a "#" and has a suffix describing the change Example: # module.type.item will be created
func IsResourceTerminator ¶ added in v0.0.7
IsResourceTerminator returns true if the line is a "}"
Types ¶
type ArrayAttributeChange ¶ added in v0.0.6
type ArrayAttributeChange struct { Name string AttributeChanges []attributeChange UpdateType UpdateType }
TODO: array attributes can be any attribute change, an array of arrays, or array of maps Type of the attribute can vary, but they're all the same Should use an interface
func NewArrayAttributeChangeFromLine ¶ added in v0.0.6
func NewArrayAttributeChangeFromLine(line string) (*ArrayAttributeChange, error)
NewArrayAttributeChangeFromLine initializes an ArrayAttributeChange from a line containing an array attribute change It expects a line that passes the IsArrayAttributeChangeLine check
func (*ArrayAttributeChange) GetAfter ¶ added in v0.0.9
func (a *ArrayAttributeChange) GetAfter(opts ...GetBeforeAfterOptions) interface{}
func (*ArrayAttributeChange) GetBefore ¶ added in v0.0.9
func (a *ArrayAttributeChange) GetBefore(opts ...GetBeforeAfterOptions) interface{}
func (*ArrayAttributeChange) GetName ¶ added in v0.0.9
func (a *ArrayAttributeChange) GetName() string
GetName returns the name of the attribute
func (*ArrayAttributeChange) GetUpdateType ¶ added in v0.0.9
func (a *ArrayAttributeChange) GetUpdateType() UpdateType
GetUpdateType returns the UpdateType of the attribute
func (*ArrayAttributeChange) IsComputed ¶ added in v0.0.9
func (a *ArrayAttributeChange) IsComputed() bool
IsComputed returns true if the attribute contains a computed value
func (*ArrayAttributeChange) IsNoOp ¶ added in v0.0.9
func (a *ArrayAttributeChange) IsNoOp() bool
IsNoOp returns true if the attribute has not changed
func (*ArrayAttributeChange) IsSensitive ¶ added in v0.0.9
func (a *ArrayAttributeChange) IsSensitive() bool
IsSensitive returns true if the attribute contains a sensitive value
type AttributeChange ¶
type AttributeChange struct { Name string OldValue interface{} NewValue interface{} UpdateType UpdateType }
func NewAttributeChangeFromArray ¶ added in v0.0.6
func NewAttributeChangeFromArray(line string) (*AttributeChange, error)
NewAttributeChangeFromLine initializes an AttributeChange from a line within an Array attribute In an array resource, the attribute change does not have a name
func NewAttributeChangeFromLine ¶
func NewAttributeChangeFromLine(line string) (*AttributeChange, error)
NewAttributeChangeFromLine initializes an AttributeChange from a line containing an attribute change It expects a line that passes the IsAttributeChangeLine check
func (*AttributeChange) GetAfter ¶ added in v0.0.9
func (a *AttributeChange) GetAfter(opts ...GetBeforeAfterOptions) interface{}
GetAfter returns the planned value of the attribute
func (*AttributeChange) GetBefore ¶ added in v0.0.9
func (a *AttributeChange) GetBefore(opts ...GetBeforeAfterOptions) interface{}
GetBefore returns the initial value of the attribute
func (*AttributeChange) GetName ¶ added in v0.0.9
func (a *AttributeChange) GetName() string
GetName returns the name of the attribute
func (*AttributeChange) GetUpdateType ¶ added in v0.0.9
func (a *AttributeChange) GetUpdateType() UpdateType
GetUpdateType returns the UpdateType of the attribute
func (*AttributeChange) IsComputed ¶
func (a *AttributeChange) IsComputed() bool
IsComputed returns true if the attribute contains a computed value
func (*AttributeChange) IsNoOp ¶ added in v0.0.9
func (a *AttributeChange) IsNoOp() bool
IsNoOp returns true if the attribute has not changed
func (*AttributeChange) IsSensitive ¶
func (a *AttributeChange) IsSensitive() bool
IsSensitive returns true if the attribute contains a sensitive value
type GetBeforeAfterOptions ¶
type GetBeforeAfterOptions func(a attributeChange) bool
type HeredocAttributeChange ¶ added in v0.0.6
type HeredocAttributeChange struct { Name string Before []string After []string UpdateType UpdateType }
func NewHeredocAttributeChangeFromLine ¶ added in v0.0.6
func NewHeredocAttributeChangeFromLine(line string) (*HeredocAttributeChange, error)
NewHeredocAttributeChangeFromLine initializes a HeredocAttributeChange from a line containing a heredoc change It expects a line that passes the IsHeredocAttributeChangeLine check
func (*HeredocAttributeChange) AddLineToContent ¶ added in v0.0.6
func (h *HeredocAttributeChange) AddLineToContent(line string)
func (*HeredocAttributeChange) GetAfter ¶ added in v0.0.9
func (h *HeredocAttributeChange) GetAfter(opts ...GetBeforeAfterOptions) interface{}
func (*HeredocAttributeChange) GetBefore ¶ added in v0.0.9
func (h *HeredocAttributeChange) GetBefore(opts ...GetBeforeAfterOptions) interface{}
func (*HeredocAttributeChange) GetName ¶ added in v0.0.9
func (h *HeredocAttributeChange) GetName() string
GetName returns the name of the attribute
func (*HeredocAttributeChange) GetUpdateType ¶ added in v0.0.9
func (h *HeredocAttributeChange) GetUpdateType() UpdateType
GetUpdateType returns the UpdateType of the attribute
func (*HeredocAttributeChange) IsComputed ¶ added in v0.0.9
func (h *HeredocAttributeChange) IsComputed() bool
IsComputed returns true if the attribute contains a computed value
func (*HeredocAttributeChange) IsNoOp ¶ added in v0.0.9
func (h *HeredocAttributeChange) IsNoOp() bool
IsNoOp returns true if the attribute has not changed
func (*HeredocAttributeChange) IsSensitive ¶ added in v0.0.9
func (h *HeredocAttributeChange) IsSensitive() bool
IsSensitive returns true if the attribute contains a sensitive value
type JSONEncodeAttributeChange ¶ added in v0.0.14
type JSONEncodeAttributeChange struct { Name string AttributeChanges []attributeChange UpdateType UpdateType }
func NewJSONEncodeAttributeChangeFromLine ¶ added in v0.0.14
func NewJSONEncodeAttributeChangeFromLine(line string) (*JSONEncodeAttributeChange, error)
NewJSONEncodeAttributeChangeFromLine initializes a JSONEncodeAttributeChange from a line containing a JSONEncode change It expects a line that passes the IsJSONEncodeAttributeChangeLine check
func (*JSONEncodeAttributeChange) GetAfter ¶ added in v0.0.14
func (j *JSONEncodeAttributeChange) GetAfter(opts ...GetBeforeAfterOptions) interface{}
func (*JSONEncodeAttributeChange) GetBefore ¶ added in v0.0.14
func (j *JSONEncodeAttributeChange) GetBefore(opts ...GetBeforeAfterOptions) interface{}
func (*JSONEncodeAttributeChange) GetName ¶ added in v0.0.14
func (j *JSONEncodeAttributeChange) GetName() string
GetName returns the name of the attribute
func (*JSONEncodeAttributeChange) GetUpdateType ¶ added in v0.0.14
func (j *JSONEncodeAttributeChange) GetUpdateType() UpdateType
GetUpdateType returns the UpdateType of the attribute
func (*JSONEncodeAttributeChange) IsComputed ¶ added in v0.0.14
func (j *JSONEncodeAttributeChange) IsComputed() bool
IsComputed returns true if the attribute contains a computed value
func (*JSONEncodeAttributeChange) IsNoOp ¶ added in v0.0.14
func (j *JSONEncodeAttributeChange) IsNoOp() bool
IsNoOp returns true if the attribute has not changed
func (*JSONEncodeAttributeChange) IsSensitive ¶ added in v0.0.14
func (j *JSONEncodeAttributeChange) IsSensitive() bool
IsSensitive returns true if the attribute contains a sensitive value
type MapAttributeChange ¶
type MapAttributeChange struct { Name string AttributeChanges []attributeChange UpdateType UpdateType }
func NewMapAttributeChangeFromLine ¶
func NewMapAttributeChangeFromLine(line string) (*MapAttributeChange, error)
NewMapAttributeChangeFromLine initializes an AttributeChange from a line containing an attribute change It expects a line that passes the IsAttributeChangeLine check
func (*MapAttributeChange) GetAfter ¶ added in v0.0.9
func (m *MapAttributeChange) GetAfter(opts ...GetBeforeAfterOptions) interface{}
func (*MapAttributeChange) GetBefore ¶ added in v0.0.9
func (m *MapAttributeChange) GetBefore(opts ...GetBeforeAfterOptions) interface{}
func (*MapAttributeChange) GetName ¶ added in v0.0.9
func (m *MapAttributeChange) GetName() string
GetName returns the name of the attribute
func (*MapAttributeChange) GetUpdateType ¶ added in v0.0.9
func (m *MapAttributeChange) GetUpdateType() UpdateType
GetUpdateType returns the UpdateType of the attribute
func (*MapAttributeChange) IsComputed ¶ added in v0.0.9
func (m *MapAttributeChange) IsComputed() bool
IsComputed returns true if the attribute contains a computed value
func (*MapAttributeChange) IsNoOp ¶ added in v0.0.9
func (m *MapAttributeChange) IsNoOp() bool
IsNoOp returns true if the attribute has not changed
func (*MapAttributeChange) IsSensitive ¶ added in v0.0.9
func (m *MapAttributeChange) IsSensitive() bool
IsSensitive returns true if the attribute contains a sensitive value
type ResourceChange ¶
type ResourceChange struct { // Address contains the absolute resource address Address string // ModuleAddress contains the module portion of the absolute address, if any ModuleAddress string // The type of the resource // Example: gcp_instance.foo -> "gcp_instance" Type string // The name of the resource // Example: gcp_instance.foo -> "foo" Name string // The index key for resources created with "count" or "for_each" // "count" resources will be an int index, and "for_each" will be a string Index interface{} // UpdateType contains the type of update // Refer to updatetype.go for possible values UpdateType UpdateType // Tainted indicates whether the resource is tainted or not Tainted bool // AttributeChanges contains all the planned attribute changes AttributeChanges []attributeChange }
func NewResourceChangeFromComment ¶
func NewResourceChangeFromComment(comment string) (*ResourceChange, error)
NewResourceChangeFromComment creates a ResourceChange from a valid resource comment line
func ParseFromFile ¶
func ParseFromFile(filepath string) ([]*ResourceChange, error)
func (*ResourceChange) GetAfterResource ¶
func (rc *ResourceChange) GetAfterResource(opts ...GetBeforeAfterOptions) map[string]interface{}
func (*ResourceChange) GetBeforeResource ¶
func (rc *ResourceChange) GetBeforeResource(opts ...GetBeforeAfterOptions) map[string]interface{}
type UpdateType ¶
type UpdateType string
const ( NoOpResource UpdateType = "no-op" NewResource UpdateType = "created" UpdateInPlaceResource UpdateType = "updateInPlace" ForceReplaceResource UpdateType = "forceReplace" DestroyResource UpdateType = "destroyed" ReadResource UpdateType = "read" )