Commit Graph

16 Commits

Author SHA1 Message Date
Mitchell Hashimoto bdde7d845a Merge pull request #12347 from hashicorp/b-env-migrate
command: migrating envs when changing backends
2017-03-01 12:58:40 -08:00
Mitchell Hashimoto 549d525487 Merge pull request #12320 from hashicorp/b-legacy-state
command: fix loading legacy remote state + migration guide
2017-03-01 12:39:17 -08:00
Mitchell Hashimoto 1d8b76c89d
command: initial work on migrating envs, basic cases first 2017-03-01 10:59:17 -08:00
Mitchell Hashimoto 2c19aa69d9
command: legacy remote state should load from backendinit 2017-02-28 19:29:19 -08:00
James Bardin b53704ed87 Thread the environment through all commands
Add Env and SetEnv methods to command.Meta to retrieve the current
environment name inside any command.

Make sure all calls to Backend.State contain an environment name, and
make the package compile against the update backend package.
2017-02-28 16:35:46 -05:00
James Bardin 1ea9413c07 Remove state path handling from commands
The Local backend is now responsible for handling the paths to the local
state files, since they are dependent on the current environment.
2017-02-28 16:06:14 -05:00
Mitchell Hashimoto 3cedfa00f4
command: use backend.CLIIinit
I made this interface way back with the original backend work and I
guess I forgot to hook it up! This is becoming an issue as I'm working
on our 2nd enhanced backend that requires this information and I
realized it was hardcoded before.

This propertly uses the CLIInit interface allowing any backend to gain
access to this data.
2017-02-28 10:58:29 -08:00
Mitchell Hashimoto 478a7dbfe7
command: convert to using backend/init 2017-02-22 11:17:27 -08:00
James Bardin 5095d7c6a7 Add complete unlock test
Test actual unlock failure and success through the the unlock command.
2017-02-20 14:50:31 -05:00
James Bardin f5ed8cd288 Use NewLockInfo to get a pre-populated value
Using NewLockInfo ensure we start with all required fields filled.
2017-02-15 14:41:55 -05:00
James Bardin 4f0c465187 make command tests pass with new state.Locker 2017-02-15 14:41:55 -05:00
Mitchell Hashimoto 90f3d40c1f
command: use new state lock/unlock helpers for better UX 2017-02-14 11:33:55 -08:00
George Hartzell e39f4e1993 Typo: determien -> determine (#11888) 2017-02-12 19:46:32 +00:00
James Bardin 0c1b138719 Add state locking during backend init
During backend initialization, especially during a migration, there is a
chance that an existing state could be overwritten.

Attempt to get a locks when writing the new state. It would be nice to
always have a lock when reading the states, but the recursive structure
of the Meta.Backend config functions makes that quite complex.
2017-02-09 15:47:27 -05:00
James Bardin 5c2e945b3c Fix format string and typos 2017-02-09 10:27:42 -05:00
Mitchell Hashimoto 9654387771
command: meta.Backend is used for initializing the backend
This is a complex function that handles all the potential cases that can
happen with legacy remote state, new configurations, etc.
2017-01-26 14:33:49 -08:00