Commit Graph

23 Commits

Author SHA1 Message Date
Paul Hinze 84bbbfbe18
command: Fixup comment typo
Hat tip to @Ninir :)
2016-08-16 09:48:21 -05:00
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
Mitchell Hashimoto 35c87836b4 core: Add terraform_version to state
This adds a field terraform_version to the state that represents the
Terraform version that wrote that state. If Terraform encounters a state
written by a future version, it will error. You must use at least the
version that wrote that state.

Internally we have fields to override this behavior (StateFutureAllowed),
but I chose not to expose them as CLI flags, since the user can just
modify the state directly. This is tricky, but should be tricky to
represent the horrible disaster that can happen by enabling it.

We didn't have to bump the state format version since the absense of the
field means it was written by version "0.0.0" which will always be
older. In effect though this change will always apply to version 2 of
the state since it appears in 0.7 which bumped the version for other
purposes.
2016-05-10 14:40:11 -04:00
James Nugent a5e51f6dad command/refresh: Fix import formats to prevent flapping 2015-11-27 15:10:42 +00:00
James Nugent 890e214c00 Add failing test replicating #4013 2015-11-23 10:32:46 +02:00
Anthony Scalisi 198e1a5186 remove various typos 2015-09-11 11:56:20 -07:00
Paul Hinze ad680b1832 core: show outputs after `terraform refresh`
closes #25
2015-06-15 10:41:42 -05:00
Mitchell Hashimoto 82e92e7024 command: fmt 2014-09-21 09:42:48 -07:00
Mitchell Hashimoto 91eb3c73fc command: fix failing tests 2014-09-18 18:16:09 -06:00
Mitchell Hashimoto 15564b04a5 command: tests pass 2014-09-18 10:40:35 -07:00
Mitchell Hashimoto cdad3036ae command: closer to compiling 2014-09-17 11:15:07 -07:00
Mitchell Hashimoto 642fed0356 command: terraform.tfvars loaded by default if it exists 2014-08-05 09:32:01 -07:00
Armon Dadgar 16ef3f5733 command: Testing the -backup feature 2014-07-27 23:38:41 -04:00
Armon Dadgar f26f432f4c command/refresh: Testing backup option 2014-07-27 22:58:12 -04:00
Mitchell Hashimoto 7b4119027a command: -var-file works 2014-07-18 14:00:40 -07:00
Mitchell Hashimoto 3534470ca3 command: -var flag works 2014-07-18 11:37:27 -07:00
Mitchell Hashimoto 3a851bece0 command: convert all to use the new Meta thing 2014-07-12 20:37:30 -07:00
Mitchell Hashimoto ff75d15f51 command/refresh: better error message if bad state 2014-07-11 22:00:55 -07:00
Mitchell Hashimoto 9a6f1e594b command/refresh: default state path, optional args 2014-07-11 21:56:43 -07:00
Mitchell Hashimoto d3d45ca064 command: fix some issues with refresh, tests passing 2014-07-07 21:12:12 -07:00
Mitchell Hashimoto a6ae7230d1 command: use new API 2014-07-03 11:46:40 -07:00
Mitchell Hashimoto 36ccb3408d command/refresh: test the -out flag 2014-06-27 11:12:45 -07:00
Mitchell Hashimoto 1819b6fb34 command/refresh 2014-06-27 11:09:01 -07:00