terraform/states
Martin Atkins c39905e1a8 command: Fix various issues in the "terraform state ..." subcommands
In earlier refactoring we updated these commands to support the new
address and state types, but attempted to partially retain the old-style
"StateFilter" abstraction that originally lived in the Terraform package,
even though that was no longer being used for any other functionality.

Unfortunately the adaptation of the existing filtering to the new types
wasn't exact and so these commands ended up having a few bugs that were
not covered by the existing tests.

Since the old StateFilter behavior was the source of various misbehavior
anyway, here it's removed altogether and replaced with some simpler
functions in the state_meta.go file that are tailored to the use-cases of
these sub-commands.

As well as just generally behaving more consistently with the other
parts of Terraform that use the new resource address types, this commit
fixes the following bugs:

- A resource address of aws_instance.foo would previously match an
  resource of that type and name in any module, which disagreed with the
  expected interpretation elsewhere of meaning a single resource in the
  root module.

- The "terraform state mv" command was not supporting moves from a single
  resource address to an indexed address and vice-versa, because the old
  logic didn't need to make that distinction while they are two separate
  address types in the new logic. Now we allow resources that do not have
  count/for_each to be treated as if they are instances for the purposes
  of this command, which is a better match for likely user intent and for
  the old behavior.

Finally, we also clean up a little some of the usage output from these
commands, which hasn't been updated for some time and so had both some
stale information and some inaccurate terminology.
2019-03-18 09:19:55 -07:00
..
statefile Fix wildcard dependencies when upgrading states 2018-11-15 13:17:15 +01:00
statemgr Update doc.go, fix typo (#20529) 2019-03-01 08:59:01 -08:00
doc.go
eachmode_string.go
instance_generation.go
instance_object.go core: Reinstaint instance tainting, but without mutating objects 2018-10-16 19:14:11 -07:00
instance_object_src.go core: Automatically upgrade resource instance states on read 2018-11-30 11:22:39 -08:00
module.go command: Un-stub and reimplement "terraform state rm" 2018-10-16 19:14:11 -07:00
objectstatus_string.go build: Take protoc out of the "go generate" path 2018-10-18 10:39:20 -07:00
output_value.go
resource.go core: Be more explicit in how we handle create_before_destroy 2018-10-16 19:14:11 -07:00
resource_test.go states: Fix TestResourceInstanceDeposeCurrentObject 2018-10-16 19:14:11 -07:00
state.go command: Allow tests to run to completion without panics or hangs 2018-10-16 19:14:11 -07:00
state_deepcopy.go states: DeepCopy for ResourceInstanceObject 2018-10-16 19:14:11 -07:00
state_equal.go
state_string.go add missing key-value from test 2018-11-19 18:58:29 -05:00
state_test.go terraform: Ugly huge change to weave in new State and Plan types 2018-10-16 19:11:09 -07:00
sync.go ResourceInstanceObject needs to return a copy 2018-12-17 16:37:18 -05:00