Files
opentf/command/jsonstate/expression.go
Kristin Laemmert 126e5f337f json output of terraform plan (#19687)
* command/show: adding functions to aid refactoring

The planfile -> statefile -> state logic path was getting hard to follow
with blurry human eyes. The getPlan... and getState... functions were
added to help streamline the logic flow. Continued refactoring may follow.

* command/show: use ctx.Config() instead of a config snapshot

As originally written, the jsonconfig marshaller was getting an error
when loading configs that included one or more modules. It's not clear
if that was an error in the function call or in the configloader itself,
  but as a simpler solution existed I did not dig too far.

* command/jsonplan: implement jsonplan.Marshal

Split the `config` portion into a discrete package to aid in naming
sanity (so we could have for example jsonconfig.Resource instead of
jsonplan.ConfigResource) and to enable marshaling the config on it's
own.
2018-12-19 11:08:25 -08:00

26 lines
1.1 KiB
Go

package jsonstate
import "encoding/json"
// expression represents any unparsed expression
type expression struct {
// "constant_value" is set only if the expression contains no references to
// other objects, in which case it gives the resulting constant value. This
// is mapped as for the individual values in the common value
// representation.
ConstantValue json.RawMessage `json:"constant_value,omitempty"`
// Alternatively, "references" will be set to a list of references in the
// expression. Multi-step references will be unwrapped and duplicated for
// each significant traversal step, allowing callers to more easily
// recognize the objects they care about without attempting to parse the
// expressions. Callers should only use string equality checks here, since
// the syntax may be extended in future releases.
References []string `json:"references,omitempty"`
// "source" is an object describing the source span of this expression in
// the configuration. Callers might use this, for example, to extract a raw
// source code snippet for display purposes.
Source source `json:"source"`
}