Commit Graph

24 Commits

Author SHA1 Message Date
Martin Atkins
c937c06a03 terraform: ugly huge change to weave in new HCL2-oriented types
Due to how deeply the configuration types go into Terraform Core, there
isn't a great way to switch out to HCL2 gradually. As a consequence, this
huge commit gets us from the old state to a _compilable_ new state, but
does not yet attempt to fix any tests and has a number of known missing
parts and bugs. We will continue to iterate on this in forthcoming
commits, heading back towards passing tests and making Terraform
fully-functional again.

The three main goals here are:
- Use the configuration models from the "configs" package instead of the
  older models in the "config" package, which is now deprecated and
  preserved only to help us write our migration tool.
- Do expression inspection and evaluation using the functionality of the
  new "lang" package, instead of the Interpolator type and related
  functionality in the main "terraform" package.
- Represent addresses of various objects using types in the addrs package,
  rather than hand-constructed strings. This is not critical to support
  the above, but was a big help during the implementation of these other
  points since it made it much more explicit what kind of address is
  expected in each context.

Since our new packages are built to accommodate some future planned
features that are not yet implemented (e.g. the "for_each" argument on
resources, "count"/"for_each" on modules), and since there's still a fair
amount of functionality still using old-style APIs, there is a moderate
amount of shimming here to connect new assumptions with old, hopefully in
a way that makes it easier to find and eliminate these shims later.

I apologize in advance to the person who inevitably just found this huge
commit while spelunking through the commit history.
2018-10-16 18:46:46 -07:00
James Bardin
705527e6fe Set proper Mode when moving a data source in state
ResourceAddr.Mode wasn't properly set when moving a module, so data
sources would lose the "data." prefix when their module was moved within
the State.
2016-11-21 18:26:29 -05:00
James Bardin
c908f3ceae convert TestStateAdd to subtests 2016-11-21 18:13:15 -05:00
James Bardin
0e6e206465 Add an InstanceState.Set method to set all fields
We con no longer copy an InstanceState via a simple
dereference+assignment because of the mutex which can't be copied. This
adds a set method to properly set all field from another InstanceState,
and take the appropriate locks while doing so.
2016-08-25 14:41:51 -04:00
James Bardin
2a47b32374 fix State.Add chart so it renders in godoc 2016-08-25 14:41:51 -04:00
Mitchell Hashimoto
8afbb0ee0e
terraform: state mv "foo" to "foo.0" with single count 2016-08-19 11:54:53 -04:00
Mitchell Hashimoto
88649ed010
terraform: StateAdd edge case test for multi-count to single index 2016-08-19 11:51:31 -04:00
Mitchell Hashimoto
a22f7e8257
terraform: State.Add works with multiple resources [GH-7797] 2016-08-19 11:46:52 -04:00
Mitchell Hashimoto
3b3f92cd9b
terraform: fix some test failures on state add with multiple modules 2016-08-18 17:39:07 -04:00
Mitchell Hashimoto
3892cc4e91
terraform: fix state add with multiple ModuleStates 2016-08-18 17:13:53 -04:00
Mitchell Hashimoto
a44c8b8760
terraform: state mv tests 2016-08-18 15:05:42 -04:00
Sander van Harmelen
5af1afd64e
Update newly added code to work with the updated taint semantics 2016-05-26 19:56:03 -05:00
Mitchell Hashimoto
59a9bcf3dc
terraform: fix compilation with new func call 2016-05-11 13:07:33 -07:00
Mitchell Hashimoto
163f19fd00
terraform: instance => module 2016-05-10 13:25:03 -07:00
Mitchell Hashimoto
4d268b6eca
terraform: instance => resource 2016-05-10 13:25:03 -07:00
Mitchell Hashimoto
e497c26517
terraform: resource => module 2016-05-10 13:25:03 -07:00
Mitchell Hashimoto
d3fcfcc027
terraform: moving resource to resource 2016-05-10 13:25:03 -07:00
Mitchell Hashimoto
e65a726936
terraform: copy deps and provider for resource state 2016-05-10 13:25:03 -07:00
Mitchell Hashimoto
cb060f9063
terraform: unify on init addr 2016-05-10 13:25:03 -07:00
Mitchell Hashimoto
c324062645
terraform: state add resource existing fails 2016-05-10 13:25:03 -07:00
Mitchell Hashimoto
21d7ffc3f3
terraform: add resource 2016-05-10 13:25:03 -07:00
Mitchell Hashimoto
af3c3e4c60
terraform: Module copy copies outputs and dependencies 2016-05-10 13:25:02 -07:00
Mitchell Hashimoto
30cf550fc5
terraform: can't move module to module that exists 2016-05-10 13:25:02 -07:00
Mitchell Hashimoto
25098f20c9
terraform: State.Add works for module to module (new) 2016-05-10 13:25:02 -07:00