terraform/state/remote
James Bardin cdb80f68a8 Ensure better state normalization
Fix checksum issue with remote state

If we read a state file with "null" objects in a module and they become
initialized to an empty map the state file may be written out with empty
objects rather than "null", changing the checksum. If we can detect
this, increment the serial number to prevent a conflict in atlas.

Our fakeAtlas test server now needs to decode the state directly rather
than using the ReadState function, so as to be able to read the state
unaltered.

The terraform.State data structures have initialization spread out
throughout the package. More thoroughly initialize State during
ReadState, and add a call to init() during WriteState as another
normalization safeguard.

Expose State.init through an exported Init() method, so that a new State
can be completely realized outside of the terraform package.
Additionally, the internal init now completely walks all internal state
structures ensuring that all maps and slices are initialized.  While it
was mentioned before that the `init()` methods are problematic with too
many call sites, expanding this out better exposes the entry points that
will need to be refactored later for improved concurrency handling.

The State structures had a mix of `omitempty` fields. Remove omitempty
for all maps and slices as part of this normalization process. Make
Lineage mandatory, which is now explicitly set in some tests.
2016-08-12 11:09:50 -04:00
..
artifactory.go add artifactory remote state storage 2015-10-29 09:33:09 -04:00
artifactory_test.go add artifactory remote state storage 2015-10-29 09:33:09 -04:00
atlas.go Don't retry the atlas requests with the wrong cert 2016-08-10 13:45:30 -04:00
atlas_test.go Ensure better state normalization 2016-08-12 11:09:50 -04:00
azure.go provider/azurerm: Bump azure-sdk-for-go to 3.0.0-beta (#7420) 2016-06-30 15:36:08 +01:00
azure_test.go remote: Rename mas to azure (#7114) 2016-06-10 20:04:40 +02:00
client_inmem.go state: a bunch of state stuff 2015-02-23 15:13:53 -08:00
consul.go Support setting datacenter when using consul remote state (#8102) 2016-08-11 22:58:20 +12:00
consul_test.go tests: allow opt-out of remote tests via env var 2016-01-21 15:44:18 -06:00
etcd.go Use cleanhttp for new http clients 2015-10-22 14:23:59 -04:00
etcd_test.go Etcd remote state backend 2015-10-18 23:24:55 +02:00
file.go state/remote: add undocumented file backend for remote state 2015-03-05 13:15:14 -08:00
file_test.go state/remote: add undocumented file backend for remote state 2015-03-05 13:15:14 -08:00
gcs.go remote state: Add GCS provider for remote state 2016-05-31 13:42:57 -05:00
gcs_test.go remote state: Add GCS provider for remote state 2016-05-31 13:42:57 -05:00
http.go Moving octet-stream to json for remote http backend 2016-03-07 18:39:41 -08:00
http_test.go Use cleanhttp for new http clients 2015-10-22 14:23:59 -04:00
remote.go remote: Rename mas to azure (#7114) 2016-06-10 20:04:40 +02:00
remote_test.go Add remote state init test 2016-07-07 16:24:38 -04:00
s3.go Skip IAM/STS validation and metadata check (#7874) 2016-08-10 15:10:34 +01:00
s3_test.go provider/aws: Update source to comply with upstream breaking change 2015-07-28 15:29:46 -05:00
state.go Revert #7464 and allow an empty state 2016-07-07 16:19:58 -04:00
state_test.go state/remote: increment serial properly 2015-02-23 21:30:59 -08:00
swift.go fmt 2015-06-23 22:31:24 -07:00
swift_test.go fmt 2015-06-23 22:31:24 -07:00