mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
b975ada8db
Our previous state models in the "terraform" package had a few limitations that are addressed here: - Instance attributes were stored as map[string]string with dot-separated keys representing traversals through a data structure. Now that we have a full type system, it's preferable to store it as a real data structure. - The existing state structures skipped over the "resource" concept and went straight to resource instance, requiring heuristics to decide whether a particular resource should appear as a single object or as a list of objects when used in configuration expressions. - Related to the previous point, the state models also used incorrect terminology where "ResourceState" was really a resource instance state and "InstanceState" was really the state of a particular remote object associated with an instance. These new models use the correct names for each of these, introducing the idea of a "ResourceInstanceObject" as the local record of a remote object associated with an instance. This is a first pass at fleshing out a new model for state. Undoubtedly there will be further iterations of this as we work on integrating these new models into the "terraform" package. These new model types no longer serve double-duty as a description of the JSON state file format, since they are for in-memory use only. A subsequent commit will introduce a separate package that deals with persisting state to files and reloading those files later.
27 lines
494 B
Go
27 lines
494 B
Go
// Code generated by "stringer -type EachMode"; DO NOT EDIT.
|
|
|
|
package states
|
|
|
|
import "strconv"
|
|
|
|
const (
|
|
_EachMode_name_0 = "NoEach"
|
|
_EachMode_name_1 = "EachListEachMap"
|
|
)
|
|
|
|
var (
|
|
_EachMode_index_1 = [...]uint8{0, 8, 15}
|
|
)
|
|
|
|
func (i EachMode) String() string {
|
|
switch {
|
|
case i == 0:
|
|
return _EachMode_name_0
|
|
case 76 <= i && i <= 77:
|
|
i -= 76
|
|
return _EachMode_name_1[_EachMode_index_1[i]:_EachMode_index_1[i+1]]
|
|
default:
|
|
return "EachMode(" + strconv.FormatInt(int64(i), 10) + ")"
|
|
}
|
|
}
|