Documentation
¶
Overview ¶
Package jsonstate implements methods for outputting a state in a machine-readable json format
Index ¶
- Constants
- func Marshal(sf *statefile.File, schemas *tofu.Schemas) ([]byte, error)
- func MarshalOutputs(outputs map[string]*states.OutputValue) (map[string]Output, error)
- func SensitiveAsBool(val cty.Value) cty.Value
- func SensitiveAsBoolWithPathValueMarks(val cty.Value, pvms []cty.PathValueMarks) cty.Value
- type AttributeValues
- type Module
- type Output
- type Resource
- type State
- type StateValues
Constants ¶
const ( // FormatVersion represents the version of the json format and will be // incremented for any change to this format that requires changes to a // consuming parser. FormatVersion = "1.0" ManagedResourceMode = "managed" DataResourceMode = "data" )
Variables ¶
This section is empty.
Functions ¶
func MarshalOutputs ¶
MarshalOutputs translates a map of states.OutputValue to a map of jsonstate.Output, which are defined for json encoding.
Types ¶
type AttributeValues ¶
type AttributeValues map[string]json.RawMessage
AttributeValues is the JSON representation of the attribute values of the resource, whose structure depends on the resource type schema.
type Module ¶
type Module struct {
// Resources are sorted in a user-friendly order that is undefined at this
// time, but consistent.
Resources []Resource `json:"resources,omitempty"`
// Address is the absolute module address, omitted for the root module
Address string `json:"address,omitempty"`
// Each module object can optionally have its own nested "child_modules",
// recursively describing the full module tree.
ChildModules []Module `json:"child_modules,omitempty"`
}
Module is the representation of a module in state. This can be the root module or a child module
type Output ¶
type Output struct {
Sensitive bool `json:"sensitive"`
Value json.RawMessage `json:"value,omitempty"`
Type json.RawMessage `json:"type,omitempty"`
}
type Resource ¶
type Resource struct {
// Address is the absolute resource address
Address string `json:"address,omitempty"`
// Mode can be "managed" or "data"
Mode string `json:"mode,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
// Index is omitted for a resource not using `count` or `for_each`.
Index json.RawMessage `json:"index,omitempty"`
// ProviderName allows the property "type" to be interpreted unambiguously
// in the unusual situation where a provider offers a resource type whose
// name does not start with its own name, such as the "googlebeta" provider
// offering "google_compute_instance".
ProviderName string `json:"provider_name"`
// SchemaVersion indicates which version of the resource type schema the
// "values" property conforms to.
SchemaVersion uint64 `json:"schema_version"`
// AttributeValues is the JSON representation of the attribute values of the
// resource, whose structure depends on the resource type schema. Any
// unknown values are omitted or set to null, making them indistinguishable
// from absent values.
AttributeValues AttributeValues `json:"values,omitempty"`
// SensitiveValues is similar to AttributeValues, but with all sensitive
// values replaced with true, and all non-sensitive leaf values omitted.
SensitiveValues json.RawMessage `json:"sensitive_values,omitempty"`
// DependsOn contains a list of the resource's dependencies. The entries are
// addresses relative to the containing module.
DependsOn []string `json:"depends_on,omitempty"`
// Tainted is true if the resource is tainted in tofu state.
Tainted bool `json:"tainted,omitempty"`
// Deposed is set if the resource is deposed in tofu state.
DeposedKey string `json:"deposed_key,omitempty"`
}
Resource is the representation of a resource in the state.
type State ¶
type State struct {
FormatVersion string `json:"format_version,omitempty"`
TerraformVersion string `json:"terraform_version,omitempty"`
Values *StateValues `json:"values,omitempty"`
Checks json.RawMessage `json:"checks,omitempty"`
}
State is the top-level representation of the json format of a tofu state.
type StateValues ¶
type StateValues struct {
Outputs map[string]Output `json:"outputs,omitempty"`
RootModule Module `json:"root_module,omitempty"`
}
StateValues is the common representation of resolved values for both the prior state (which is always complete) and the planned new state.