statefile: New package for loading and saving state files
Whereas the parent directory "states" contains the models that represent
state in memory, this package's responsibility is in serializing a subset
of that data to a JSON-based file format and then reloading that data
back into memory later.
For reading, this package supports state file formats going back to
version 1, using lightly-adapted versions of the migration code previously
used in the "terraform" package. State data is upgraded to the latest
version step by step and then transformed into the in-memory state
representation, which is distinct from any of the file format structs in
this package to enable these to evolve separately.
For writing, only the latest version (4) is supported, which is a new
format that is a slightly-flattened version of the new in-memory state
models introduced in the prior commit. This format retains the outputs
from only the root module and it flattens out the module and instance
parts of the hierarchy by including the identifiers for these inside
the child object. The loader then reconstructs the multi-layer structure
we use for more convenient access in memory.
For now, the only testing in this package is of round-tripping different
versions of state through a read and a write, ensuring the output is
as desired. This exercises all of the reading, upgrading, and writing
functions but should be augmented in later commits to improve coverage
and introduce more focused tests for specific parts of the functionality.
2018-06-08 02:35:55 +02:00
|
|
|
{
|
|
|
|
"version": 4,
|
|
|
|
"serial": 0,
|
|
|
|
"lineage": "f2968801-fa14-41ab-a044-224f3a4adf04",
|
|
|
|
"terraform_version": "0.7.13",
|
|
|
|
"outputs": {
|
|
|
|
"numbers": {
|
|
|
|
"type": "string",
|
|
|
|
"value": "0,1"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"resources": [
|
|
|
|
{
|
|
|
|
"mode": "managed",
|
|
|
|
"type": "null_resource",
|
|
|
|
"name": "bar",
|
|
|
|
"provider": "provider.null",
|
|
|
|
"instances": [
|
|
|
|
{
|
|
|
|
"schema_version": 0,
|
|
|
|
"attributes_flat": {
|
|
|
|
"id": "5388490630832483079",
|
|
|
|
"triggers.%": "1",
|
|
|
|
"triggers.whaaat": "0,1"
|
|
|
|
},
|
2018-11-15 13:17:15 +01:00
|
|
|
"depends_on": [
|
|
|
|
"null_resource.foo",
|
2019-04-30 20:34:01 +02:00
|
|
|
"null_resource.foobar",
|
|
|
|
"null_resource.foobar[1]"
|
2018-11-15 13:17:15 +01:00
|
|
|
]
|
statefile: New package for loading and saving state files
Whereas the parent directory "states" contains the models that represent
state in memory, this package's responsibility is in serializing a subset
of that data to a JSON-based file format and then reloading that data
back into memory later.
For reading, this package supports state file formats going back to
version 1, using lightly-adapted versions of the migration code previously
used in the "terraform" package. State data is upgraded to the latest
version step by step and then transformed into the in-memory state
representation, which is distinct from any of the file format structs in
this package to enable these to evolve separately.
For writing, only the latest version (4) is supported, which is a new
format that is a slightly-flattened version of the new in-memory state
models introduced in the prior commit. This format retains the outputs
from only the root module and it flattens out the module and instance
parts of the hierarchy by including the identifiers for these inside
the child object. The loader then reconstructs the multi-layer structure
we use for more convenient access in memory.
For now, the only testing in this package is of round-tripping different
versions of state through a read and a write, ensuring the output is
as desired. This exercises all of the reading, upgrading, and writing
functions but should be augmented in later commits to improve coverage
and introduce more focused tests for specific parts of the functionality.
2018-06-08 02:35:55 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"mode": "managed",
|
|
|
|
"type": "null_resource",
|
|
|
|
"name": "foo",
|
|
|
|
"provider": "provider.null",
|
|
|
|
"each": "list",
|
|
|
|
"instances": [
|
|
|
|
{
|
|
|
|
"index_key": 0,
|
|
|
|
"schema_version": 0,
|
|
|
|
"attributes_flat": {
|
|
|
|
"id": "8212585058302700791",
|
|
|
|
"triggers.%": "1",
|
|
|
|
"triggers.what": "0"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"index_key": 1,
|
|
|
|
"schema_version": 0,
|
|
|
|
"attributes_flat": {
|
|
|
|
"id": "1523897709610803586",
|
|
|
|
"triggers.%": "1",
|
|
|
|
"triggers.what": "0"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2018-11-15 13:17:15 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"mode": "managed",
|
|
|
|
"type": "null_resource",
|
|
|
|
"name": "foobar",
|
|
|
|
"provider": "provider.null",
|
|
|
|
"instances": [
|
|
|
|
{
|
|
|
|
"schema_version": 0,
|
|
|
|
"attributes_flat": {
|
|
|
|
"id": "7388490630832483079",
|
|
|
|
"triggers.%": "1",
|
|
|
|
"triggers.whaaat": "0,1"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
statefile: New package for loading and saving state files
Whereas the parent directory "states" contains the models that represent
state in memory, this package's responsibility is in serializing a subset
of that data to a JSON-based file format and then reloading that data
back into memory later.
For reading, this package supports state file formats going back to
version 1, using lightly-adapted versions of the migration code previously
used in the "terraform" package. State data is upgraded to the latest
version step by step and then transformed into the in-memory state
representation, which is distinct from any of the file format structs in
this package to enable these to evolve separately.
For writing, only the latest version (4) is supported, which is a new
format that is a slightly-flattened version of the new in-memory state
models introduced in the prior commit. This format retains the outputs
from only the root module and it flattens out the module and instance
parts of the hierarchy by including the identifiers for these inside
the child object. The loader then reconstructs the multi-layer structure
we use for more convenient access in memory.
For now, the only testing in this package is of round-tripping different
versions of state through a read and a write, ensuring the output is
as desired. This exercises all of the reading, upgrading, and writing
functions but should be augmented in later commits to improve coverage
and introduce more focused tests for specific parts of the functionality.
2018-06-08 02:35:55 +02:00
|
|
|
}
|
|
|
|
]
|
2019-04-30 20:34:01 +02:00
|
|
|
}
|