Commit Graph

58 Commits

Author SHA1 Message Date
Martin Atkins 618883596a command: remove "terraform push"
The remote API this talks to will be going away very soon, before our next
major release, and so we'll remove the command altogether in that release.

This also removes the "encodeHCL" function, which was used only for
adding a .tfvars-formatted file to the uploaded archive.
2018-10-16 18:24:47 -07:00
Oleg Butuzov 2ac15fdae4 command: Fix inconsistent spacing in "terraform push -help"
Fixes #18775
2018-09-04 18:47:46 -07:00
James Bardin 90a75422fb unlock state in console, import, graph, and push
The state locking improvements for the regular command had the side
effect of locking the state in the console, import, graph and push
commands. Those commands had been updated to get a state via the
Backend.Context method, which locks the state whenever possible, and now
need to call Unlock directly.

Add Unlock calls to all commands that call Context directly.
2018-03-21 12:13:40 -04:00
Martin Atkins 9a5c865040 command: validate config as part of loading it
Previously we required callers to separately call .Validate on the root
module to determine if there were any value errors, but we did that
inconsistently and would thus see crashes in some cases where later code
would try to use invalid configuration as if it were valid.

Now we run .Validate automatically after config loading, returning the
resulting diagnostics. Since we return a diagnostics here, it's possible
to return both warnings and errors.

We return the loaded module even if it's invalid, so callers are free to
ignore returned errors and try to work with the config anyway, though they
will need to be defensive against invalid configuration themselves in
that case.

As a result of this, all of the commands that load configuration now need
to use diagnostic printing to signal errors. For the moment this just
allows us to return potentially-multiple config errors/warnings in full
fidelity, but also sets us up for later when more subsystems are able
to produce rich diagnostics so we can show them all together.

Finally, this commit also removes some stale, commented-out code for the
"legacy" (pre-0.8) graph implementation, which has not been available
for some time.
2017-12-07 14:28:43 -08:00
James Bardin 36b8be43e8 use the new version package
Update all references to the version values to use the new package.
The VersionString function was left in the terraform package
specifically for the aws provider, which is vendored. We can remove that
last call once the provider is updated.
2017-10-19 21:48:08 -04:00
Robert Liebowitz 8d98fdecac Autoload only .auto.tfvars files 2017-07-05 17:24:17 -07:00
Robert Liebowitz 006744bfe0 Use all tfvars files in working directory
As a side effect, several commands that previously did not have a failure
state can now fail during meta-parameter processing.
2017-07-05 17:24:17 -07:00
Martin Atkins 31d556894f command: shallow UI-focused rename of "environment" to "workspace"
Feedback after 0.9 was that the term "environment" was confusing due to
it colliding with several other concepts, such as OS environment
variables, a non-aligned Terraform Enterprise concept, and differing ideas
of "environment" within various organizations.

This new term "workspace" is intended to ease some of that confusion. This
term is not used anywhere else in Terraform today, and we expect it to not
be used in a manner that would be confusing within user organizations.

This begins a deprecation cycle for the "terraform env" family of commands,
instead moving to an equivalent set of "terraform workspace" commands.

There are some remaining references to the old "environment" concept in
the code, which will be cleaned up in a separate change. This change is
instead focused on text visible in the UI and wording within code comments
for the benefit of human maintainers of the code.
2017-06-09 15:01:39 -07:00
James Bardin 718ede0636 have Meta.Backend use a Config rather than loading
Instead of providing the a path in BackendOpts, provide a loaded
*config.Config instead. This reduces the number of places where
configuration is loaded.
2017-06-09 14:03:59 -07:00
Mitchell Hashimoto 25312c8985
command/push: update copy for remote state error 2017-03-16 14:41:37 -07:00
Mitchell Hashimoto 8b208a597d
command/push: don't allow pushing with local backend 2017-03-16 10:47:48 -07:00
Mitchell Hashimoto ad7b063262
command: convert to use backends 2017-01-26 14:33:49 -08:00
Mitchell Hashimoto 9a8209cfbd
command/push: create the proper parent directory entries in tar 2016-08-24 10:39:50 -07:00
Mitchell Hashimoto 928fdff33e
command/push: only add module directory to tar if it exists 2016-08-23 23:19:02 -07:00
Mitchell Hashimoto a650455ed6
command/push: only explicitly include the state
modify the module include flag to flag whether we explicitly include or
exclude modules
2016-08-23 23:12:52 -07:00
Mitchell Hashimoto 3aecc52bf3
command/push: "Extra" value must be absolute 2016-08-23 22:58:58 -07:00
Mitchell Hashimoto e8267f4907
command/push: failing test for pushing with no modules 2016-08-23 22:49:00 -07:00
James Bardin 1322aaf473 Merge pull request #7989 from hashicorp/jbardin/tf_push
Override atlas variables even if they aren't local
2016-08-05 08:43:51 -04:00
James Bardin 67bd4f29e0 Override atlas variables even if they aren't local
Some Atlas usage patterns expect to be able to override a variable set
in Atlas, even if it's not seen in the local context. This allows
overwriting a variable that is returned from atlas, and sends it back.

Also use a unique sential value in the context where we have variables
from atlas. This way atals variables aren't combined with the local
variables, and we don't do something like inadvertantly change the type,
double encode/escape, etc.
2016-08-04 17:26:41 -04:00
James Bardin bf83b435e1 numeric variables aren't always interpreted as str
If we have a number value in our config variables, format it as a
string, and send it with the HCL=true flag just in case.

Also use %g for for float encoding, as the output is a generally a
little friendlier.
2016-08-04 11:19:26 -04:00
James Bardin 0c714592f0 Fix variable handling on subsequent pushes
The handling of remote variables was completely disabled for push.
We still need to fetch variables from atlas for push, because if the
variable is only set remotely the Input walk will still prompt the user
for a value. We add the missing remote variables to the context
to disable input.

We now only handle remote variables as atlas.TFVar and explicitly pass
around that type rather than an `interface{}`.

Shorten the text fixture slightly to make the output a little more
readable on failures.
2016-07-28 15:06:53 -04:00
James Bardin de87267697 Add tf_vars to the variables sent in push
Add tf_vars to the data structures sent in terraform push.

This takes any value of type []interface{} or map[string]interface{} and
marshals it as a string representation of the equivalent HCL. This
prevents ambiguity in atlas between a string that looks like a json
structure, and an actual json structure.

For the time being we will need a way to serialize data as HCL, so the
command package has an internal encodeHCL function to do so. We can
remove this if we get complete package for marshaling HCL.
2016-07-26 20:38:50 -04:00
James Bardin 885935962c Add a terraform version header to all atlas calls
Using the DefaultHeader added to the atlas.Client
2016-07-21 11:04:27 -04:00
James Nugent 3735140286 core: Don't set variables for Atlas until lib is updated 2016-07-18 13:10:33 -05:00
James Nugent 5d18f41f04 core: Convert context vars to map[string]interface{}
This is the first step in allowing overrides of map and list variables.
We convert Context.variables to map[string]interface{} from
map[string]string and fix up all the call sites.
2016-07-18 13:02:54 -05:00
Anthony Scalisi 198e1a5186 remove various typos 2015-09-11 11:56:20 -07:00
Mitchell Hashimoto 1f92dd5b40 command/push: update output 2015-06-29 13:58:54 -07:00
Mitchell Hashimoto c5d3c585c6 command/push: update var name 2015-06-29 13:57:58 -07:00
Mitchell Hashimoto 9d9bcc2f6e command/push: update flag to -overwrite, update docs 2015-06-29 13:53:05 -07:00
Mitchell Hashimoto 8ee3281858 command/push: UX 2015-06-29 13:41:07 -07:00
Mitchell Hashimoto dc40f044f0 command/push: prefer Atlas over local, add -set flag 2015-06-29 12:24:13 -07:00
Radek Simko b7d41d2eed Add -no-color to help text 2015-06-22 13:14:01 +01:00
Mitchell Hashimoto 77a61157fb command/push: var/var-file supported, note in help [GH-1950] 2015-05-13 20:18:40 -07:00
Paul Hinze 8ce3e1d5b4 command/push: local vars override remote ones
Otherwise once you push a variable it becomes very difficult to change.
2015-05-08 18:54:38 -05:00
Mitchell Hashimoto 000d28c489 command/push: read terraform.tfvars 2015-04-07 15:34:06 -07:00
Mitchell Hashimoto 280635d2b0 command/push: add -atlas-address 2015-03-24 17:45:19 -07:00
Mitchell Hashimoto 51614b6365 command/push: upload-modules 2015-03-24 17:42:40 -07:00
Mitchell Hashimoto 8d47f26bb7 command/push: address PR comments 2015-03-24 17:41:26 -07:00
Mitchell Hashimoto 0229852e48 command/push: change wording on error message 2015-03-24 17:39:37 -07:00
Mitchell Hashimoto 395dd04861 command/push: accept -vcs 2015-03-24 17:03:59 -07:00
Mitchell Hashimoto 86f92119e2 command/push: no version on GET should be okay 2015-03-24 13:59:13 -07:00
Mitchell Hashimoto 19c1771438 command/push: integrate atlas push client 2015-03-24 13:42:48 -07:00
Mitchell Hashimoto 1c0ffbd7bf command/push: output the name/version of the pushed configuration 2015-03-24 13:30:23 -07:00
Mitchell Hashimoto ee1ad49829 command/push: rename -module-lock to -module-upload 2015-03-24 13:30:23 -07:00
Mitchell Hashimoto da46e16f4f command/push: can set the name on the CLI 2015-03-24 13:30:23 -07:00
Mitchell Hashimoto 5e27bfc040 command/push: read name from the config 2015-03-24 13:30:23 -07:00
Mitchell Hashimoto eebd7b8aa3 command/push: ask for only variables that are unset 2015-03-24 13:30:23 -07:00
Mitchell Hashimoto bf14143369 command/push: test that input is asked 2015-03-24 13:30:22 -07:00
Mitchell Hashimoto d37d9ea6ef command/push: send the context variables up 2015-03-24 13:30:22 -07:00
Mitchell Hashimoto a1b424d53f command/push: properly copy the data directory no matter what 2015-03-24 13:30:22 -07:00