Commit Graph

19 Commits

Author SHA1 Message Date
Martin Atkins ebafa51723 command: Various updates for the new backend package API
This is a rather-messy, complex change to get the "command" package
building again against the new backend API that was updated for
the new configuration loader.

A lot of this is mechanical rewriting to the new API, but
meta_config.go and meta_backend.go in particular saw some major
changes to interface with the new loader APIs and to deal with
the change in order of steps in the backend API.
2018-10-16 18:44:26 -07:00
Martin Atkins 3ea159297c command/format: improve consistency of plan results
Previously the rendered plan output was constructed directly from the
core plan and then annotated with counts derived from the count hook.
At various places we applied little adjustments to deal with the fact that
the user-facing diff model is not identical to the internal diff model,
including the special handling of data source reads and destroys. Since
this logic was just muddled into the rendering code, it behaved
inconsistently with the tally of adds, updates and deletes.

This change reworks the plan formatter so that it happens in two stages:
- First, we produce a specialized Plan object that is tailored for use
  in the UI. This applies all the relevant logic to transform the
  physical model into the user model.
- Second, we do a straightforward visual rendering of the display-oriented
  plan object.

For the moment this is slightly overkill since there's only one rendering
path, but it does give us the benefit of letting the counts be derived
from the same data as the full detailed diff, ensuring that they'll stay
consistent.

Later we may choose to have other UIs for plans, such as a
machine-readable output intended to drive a web UI. In that case, we'd
want the web UI to consume a serialization of the _display-oriented_ plan
so that it doesn't need to re-implement all of these UI special cases.

This introduces to core a new diff action type for "refresh". Currently
this is used _only_ in the UI layer, to represent data source reads.
Later it would be good to use this type for the core diff as well, to
improve consistency, but that is left for another day to keep this change
focused on the UI.
2017-09-01 17:55:05 -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 418a8a8bc9 command + backend: rename various API objects to "Workspace" terminology
We're shifting terminology from "environment" to "workspace". This takes
care of some of the main internal API surface that was using the old
terminology, though is not intended to be entirely comprehensive and is
mainly just to minimize the amount of confusion for maintainers as we
continue moving towards eliminating the old terminology.
2017-06-09 16:26:25 -07: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
Mitchell Hashimoto ad7b063262
command: convert to use backends 2017-01-26 14:33:49 -08:00
Paul Hinze e67fc0fe9b command: Change module-depth default to -1
This means that terraform commands like `plan`, `apply`, `show`, and
`graph` will expand all modules by default.

While modules-as-black-boxes is still very true in the conceptual design
of modules, feedback on this behavior has consistently suggested that
users would prefer to see more verbose output by default.

The `-module-depth` flag and env var are retained to allow output to be
optionally limited / summarized by these commands.
2016-01-20 13:58:02 -06:00
Paul Hinze cb5c2567b3 core: fix `terraform show` with remote state
fixes #1810
2015-06-16 12:26:04 -05:00
Paul Hinze 29d34cd5a4 command: allow module depth to be set via env var
Another convienence env var here with TF_MODULE_DEPTH.

Works like you'd expect it to!
2015-04-30 16:19:43 -05:00
Mitchell Hashimoto 579f102f37 command: start migrating to new state package 2015-02-23 15:13:54 -08:00
Armon Dadgar cce881aadd command/show: enable printing of remote state 2014-12-10 13:27:11 -08:00
Mitchell Hashimoto dac5f0e3df command/show: update help 2014-10-11 12:57:47 -07:00
Mitchell Hashimoto 069f758efb command/show: show default state with no args [GH-349] 2014-10-11 12:56:55 -07:00
Mitchell Hashimoto e5e51d7b17 command: state output is well formatted for modules 2014-09-25 19:25:10 -07:00
Mitchell Hashimoto 8c17062638 command: plan shows module-level, can control depth 2014-09-24 22:54:51 -07:00
Mitchell Hashimoto 642fed0356 command: terraform.tfvars loaded by default if it exists 2014-08-05 09:32:01 -07:00
Mitchell Hashimoto 687c5cd35c command/show: remove unused fields in struct 2014-07-13 09:21:44 -07:00
Mitchell Hashimoto 6c736bd3c4 command: introduce Meta and "-no-color" option 2014-07-12 20:21:46 -07:00
Mitchell Hashimoto dbc1c63d79 command/show 2014-07-12 19:47:31 -07:00