Commit Graph

111 Commits

Author SHA1 Message Date
Paul Hinze
05c0998d2d core: store deeply nested modules in a consistent order in the state
We were only comparing the last element of the module, which meant that
deeply nested modules with the same name but different ancestry had an
undefined sort order, which could cause inconsistencies in state
storage and potentially break remote state MD5 checksumming.
2015-10-20 14:35:57 -05:00
Paul Hinze
fca44bdec3 core: state metadata difference should bump serial
Remote state includes MD5-based checksumming to protect against State
conflicts. This can generate improper conflicts with states that differ
only in their Schema version.

We began to see this issue with
https://github.com/hashicorp/terraform/pull/3470 which changes the
"schema_version" of aws_key_pairs.
2015-10-20 12:28:12 -05:00
Anthony Scalisi
198e1a5186 remove various typos 2015-09-11 11:56:20 -07:00
Mitchell Hashimoto
955bbbba41 terraform: state module orphans should only return direct 2015-07-20 08:41:24 -07:00
Mitchell Hashimoto
edd05f2aa2 terraform: fix some test failures 2015-07-19 14:14:05 -07:00
Mitchell Hashimoto
96a04c16f6 terraform: state ModuleOrphans should return grandchild orphans 2015-07-19 13:41:57 -07:00
Matt Good
21b0a03d70 Support for multiple providers of the same type
Adds an "alias" field to the provider which allows creating multiple instances
of a provider under different names. This provides support for configurations
such as multiple AWS providers for different regions. In each resource, the
provider can be set with the "provider" field.

(thanks to Cisco Cloud for their support)
2015-04-20 14:14:34 -07:00
Paul Hinze
f2968b045c Merge pull request #1316 from hashicorp/b-empty-instancestate-state-migrate-crash
providers/aws: handle empty instancestate in state migration
2015-03-29 08:53:04 -05:00
Seth Vargo
1adb3fbfa0 command: when setting up state, only write back if local is newer 2015-03-26 17:16:54 -07:00
Paul Hinze
f51fb5e127 providers/aws: handle empty instancestate in state migration
fixes #1309
2015-03-26 13:07:04 -05:00
Mitchell Hashimoto
9c6e2cdc21 terraform: make sure our serial is always higher 2015-03-25 15:40:53 -07:00
Mitchell Hashimoto
0d4c7887c5 terraform: don't increment state if one is nil 2015-03-25 15:38:24 -07:00
Paul Hinze
3ba8ed536b helper/schema: record schema version on apply
We were previously only recording the schema version on refresh. This
caused the state to be incorrectly written after a `terraform apply`
causing subsequent commands to run the state through an unnecessary
migration.
2015-03-18 19:08:48 -05:00
Paul Hinze
3d4b55e557 helper/schema: schema versioning & migration
Providers get a per-resource SchemaVersion integer that they can bump
when a resource's schema changes format. Each InstanceState with an
older recorded SchemaVersion than the cureent one is yielded to a
`MigrateSchema` function to be transformed such that it can be addressed
by the current version of the resource's Schema.
2015-03-06 16:26:11 -06:00
Paul Hinze
6e13aacefa core: [refactor] DRY up EvalWriteState nodes
Also some final comment cleanup
2015-03-04 18:22:18 -06:00
Paul Hinze
6c93fbb85d core: [refactor] store Deposed resource instances as a list
Deposed instances need to be stored as a list for certain pathological
cases where destroys fail for some reason (e.g. upstream API failure,
Terraform interrupted mid-run). Terraform needs to be able to remember
all Deposed nodes so that it can clean them up properly in subsequent
runs.

Deposed instances will now never touch the Tainted list - they're fully
managed from within their own list.

Added a "multiDepose" test case that walks through a scenario to
exercise this.
2015-03-04 12:25:59 -06:00
Paul Hinze
596e891b80 core: [refactor] pull Deposed out of Tainted list 2015-03-04 12:25:47 -06:00
Mitchell Hashimoto
4ec31ecb95 command/taint: new command 2015-02-26 10:29:23 -08:00
Mitchell Hashimoto
b3cd1bd5bc terraform: add ResourceState.Taint 2015-02-26 09:58:56 -08:00
Mitchell Hashimoto
57f7507ebd terraform: more state tests, fix a bug 2015-02-23 21:43:54 -08:00
Mitchell Hashimoto
f3af221866 terraform: make DeepCopy public 2015-02-23 21:32:27 -08:00
Mitchell Hashimoto
c2bf600603 state: only change serial if changed 2015-02-23 21:26:33 -08:00
Mitchell Hashimoto
330364f668 terraform: State.IsEmpty 2015-02-23 15:13:54 -08:00
Mitchell Hashimoto
6cd5c894e8 terraform: State.IsRemote 2015-02-23 15:13:54 -08:00
Mitchell Hashimoto
022967acdb terraform: module inputs/vars can be non-strings [GH-819] 2015-02-23 13:50:53 -08:00
Mitchell Hashimoto
b041f48e56 terraform: State.Equal 2015-02-20 13:39:49 -08:00
Mitchell Hashimoto
c8091aa338 terraform: fix more create-before-destroy state juggling 2015-02-19 12:08:07 -08:00
Mitchell Hashimoto
93f3050dbd terraform: make things more linear 2015-02-19 12:08:04 -08:00
Mitchell Hashimoto
cbbe9cb588 terraform: state prune prunes computed variables 2015-02-19 12:08:03 -08:00
Mitchell Hashimoto
e45308fa6d terraform: module orphans are properly expanded and planned for destroy 2015-02-19 12:08:01 -08:00
Mitchell Hashimoto
e08dc05f54 terraform: State.ModuleOrphans 2015-02-19 12:07:52 -08:00
Mitchell Hashimoto
c2f3f0594d terraform: sort dependencies of resource state [GH-928] 2015-02-17 11:47:53 -08:00
Armon Dadgar
d821f7aaa6 terraform: Make RemoteState more flexible 2014-12-10 13:27:09 -08:00
Armon Dadgar
b83b4a923f terraform: expose the state version 2014-12-10 13:27:06 -08:00
Armon Dadgar
6ce957d4b1 terraform: State helpers 2014-12-10 13:27:06 -08:00
Armon Dadgar
1ec0602cab terraform: Add new remote storage fields to state 2014-12-10 13:27:06 -08:00
Armon Dadgar
a5d444b8e3 terraform: fix module output handling. Fixes #474 2014-11-24 19:18:52 -08:00
Armon Dadgar
9707eb3fc8 terraform: Add dependencies field to modules 2014-11-21 15:34:23 -08:00
Mitchell Hashimoto
edf85de411 terraform: output state in human-readable format
/cc @armon - Didn't need to save the bits here, plus it makes it easier
for someone to go in and modify this stuff
2014-10-12 22:56:34 -07:00
Mitchell Hashimoto
d2e836275b terraform: sort the modules in the state [GH-318] 2014-10-11 12:47:06 -07:00
Mitchell Hashimoto
101ac636a2 config: add Config method 2014-10-02 11:34:08 -07:00
Mitchell Hashimoto
fb1c224e12 terraform: expand resource nodes at walk time 2014-10-02 10:42:58 -07:00
Mitchell Hashimoto
3941dbac5d fmt 2014-09-28 11:51:49 -07:00
Mitchell Hashimoto
e5e51d7b17 command: state output is well formatted for modules 2014-09-25 19:25:10 -07:00
Mitchell Hashimoto
6b2781d77c terraform: module orphans 2014-09-23 14:57:17 -07:00
Mitchell Hashimoto
d443202b31 terraform: fix copying dependencies 2014-09-23 14:20:26 -07:00
Mitchell Hashimoto
b1a583e3de terraform: plan with modules work 2014-09-23 14:15:40 -07:00
Mitchell Hashimoto
a6f792b3aa terraform: update graph to build subgraphs for modules 2014-09-22 16:48:18 -07:00
Mitchell Hashimoto
46c1209c92 terraform: State.String outputs multiple modules 2014-09-22 15:53:18 -07:00
Mitchell Hashimoto
ca875f5457 terraform: fix missing arg to Printf 2014-09-21 22:36:34 -07:00