Commit Graph

23 Commits

Author SHA1 Message Date
James Bardin
fb4a365d12 noop migrate copy, add -lock and -input
A couple commits got rebased together here, and it's easier to enumerate
them in a single commit.

Skip copying of states during migration if they are the same state. This
can happen when trying to reconfigure a backend's options, or if the
state was manually transferred. This can fail unexpectedly with locking
enabled.

Honor the `-input` flag for all confirmations (the new test hit some
more). Also unify where we reference the Meta.forceInitCopy and transfer
the value to the existing backendMigrateOpts.force field.
2017-04-04 14:54:48 -04:00
James Bardin
5eca913b14 add cli flags for -lock-timeout
Add the -lock-timeout flag to the appropriate commands.
Add the -lock flag to `init` and `import` which were missing it.
Set both stateLock and stateLockTimeout in Meta.flagsSet, and remove the
extra references for clarity.
2017-04-01 17:09:21 -04:00
James Bardin
54e536cfe0 add -force-copy option to init command
The `-force-copy` option will suppress confirmation for copying state
data.

Modify some tests to use the option, making sure to leave coverage of
the Input code path.
2017-03-22 08:47:26 -04:00
Mitchell Hashimoto
df8529719c
command/init: backend-config accepts key=value pairs
This augments backend-config to also accept key=value pairs.
This should make Terraform easier to script rather than having to
generate a JSON file.

You must still specify the backend type as a minimal amount in
configurations, example:

```
terraform { backend "consul" {} }
```

This is required because Terraform needs to be able to detect the
_absense_ of that value for unsetting, if that is necessary at some
point.
2017-03-16 23:27:05 -07:00
Mitchell Hashimoto
716132431a
command/init: initialize backend even if not set in the config
We need to initialize the backend even if the config has no backend set.
This allows `init` to work when unsetting a previously set backend.
Without this, there was no way to unset a backend.
2017-02-15 15:44:53 -08:00
Mitchell Hashimoto
ad7b063262
command: convert to use backends 2017-01-26 14:33:49 -08:00
James Bardin
f175497dd7 Fix vet issues
None were critical, but these will fail with the next version of vet.
2016-10-18 11:11:12 -04:00
James Nugent
681d94ae20 core: Allow lists and maps as variable overrides
Terraform 0.7 introduces lists and maps as first-class values for
variables, in addition to string values which were previously available.
However, there was previously no way to override the default value of a
list or map, and the functionality for overriding specific map keys was
broken.

Using the environment variable method for setting variable values, there
was previously no way to give a variable a value of a list or map. These
now support HCL for individual values - specifying:

    TF_VAR_test='["Hello", "World"]'

will set the variable `test` to a two-element list containing "Hello"
and "World". Specifying

    TF_VAR_test_map='{"Hello = "World", "Foo" = "bar"}'

will set the variable `test_map` to a two-element map with keys "Hello"
and "Foo", and values "World" and "bar" respectively.

The same logic is applied to `-var` flags, and the file parsed by
`-var-files` ("autoVariables").

Note that care must be taken to not run into shell expansion for `-var-`
flags and environment variables.

We also merge map keys where appropriate. The override syntax has
changed (to be noted in CHANGELOG as a breaking change), so several
tests needed their syntax updating from the old `amis.us-east-1 =
"newValue"` style to `amis = "{ "us-east-1" = "newValue"}"` style as
defined in TF-002.

In order to continue supporting the `-var "foo=bar"` type of variable
flag (which is not valid HCL), a special case error is checked after HCL
parsing fails, and the old code path runs instead.
2016-07-26 15:27:29 -05:00
David Glasser
50959a654c command: Remove second DefaultDataDirectory const (#7666) 2016-07-20 23:55:05 +01:00
Justin Nauman
61240b4250 Fixes #5011 - Backend downcased for init 2016-02-05 06:26:12 -06:00
Mitchell Hashimoto
6a972a7713 command/init: put remote state config at proper path [GH-2927] 2016-01-19 17:13:19 -08:00
Mitchell Hashimoto
344e7c26b5 fix a bunch of tests from go-getter import 2015-10-15 13:48:58 -07:00
Radek Simko
b7d41d2eed Add -no-color to help text 2015-06-22 13:14:01 +01:00
Mitchell Hashimoto
01cd761023 command: move remote configuration stuff 2015-03-04 16:17:30 -08:00
Mitchell Hashimoto
a655c1619a command: update help text 2015-02-23 15:13:56 -08:00
Mitchell Hashimoto
0299e60e83 command/init: -backend-config 2015-02-23 15:13:56 -08:00
Mitchell Hashimoto
622690583c command/init: remove dependency on remote package 2015-02-23 15:13:55 -08:00
Armon Dadgar
6a84be0686 command: updating for pluggable backends 2014-12-10 13:27:10 -08:00
Armon Dadgar
6e7cffd60b command/init: Only initialize a blank state with remote 2014-12-10 13:27:08 -08:00
Armon Dadgar
d332b8ad58 remote: implement refresh state 2014-12-10 13:27:07 -08:00
Armon Dadgar
29b3310a49 command/init: integrate remote state storage 2014-12-10 13:27:06 -08:00
Mitchell Hashimoto
f4cc2c066f command: init works at a basic level 2014-09-26 16:30:49 -07:00
Mitchell Hashimoto
615192a6c4 command: init command start 2014-09-26 16:04:10 -07:00