Commit Graph

55 Commits

Author SHA1 Message Date
Mitchell Hashimoto d1b46e99bd Add `terraform state list` command
This introduces the terraform state list command to list the resources
within a state. This is the first of many state management commands to
come into 0.7.

This is the first command of many to come that is considered a
"plumbing" command within Terraform (see "plumbing vs porcelain":
http://git.661346.n2.nabble.com/what-are-plumbing-and-porcelain-td2190639.html).
As such, this PR also introduces a bunch of groundwork to support
plumbing commands.

The main changes:

- Main command output is changed to split "common" and "uncommon"
  commands.

- mitchellh/cli is updated to support nested subcommands, since
  terraform state list is a nested subcommand.

- terraform.StateFilter is introduced as a way in core to filter/search
  the state files. This is very basic currently but I expect to make it
  more advanced as time goes on.

- terraform state list command is introduced to list resources in a
  state. This can take a series of arguments to filter this down.

Known issues, or things that aren't done in this PR on purpose:

- Unit tests for terraform state list are on the way. Unit tests for the
  core changes are all there.
2016-05-10 14:14:47 -04: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
Mitchell Hashimoto 344e7c26b5 fix a bunch of tests from go-getter import 2015-10-15 13:48:58 -07:00
Kevin Nuckolls f59c71b35a works for apply, no tests yet 2015-09-29 22:41:26 -07:00
Anthony Scalisi 198e1a5186 remove various typos 2015-09-11 11:56:20 -07:00
Mitchell Hashimoto 96b53cc06c command: ask for input even if tfvars is set [GH-2161] 2015-06-25 15:29:46 -07:00
Radek Simko cdcd11419e Add -no-color option for subcommands 2015-06-21 21:52:11 +01: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
Paul Hinze 5f1ea7fccc command: add env var equivalent to -input arg
Setting TF_INPUT has the equivalent effect of setting the flag.
I got sick of specifying this when iterating on TF config locally.
2015-04-30 09:59:14 -05:00
Paul Hinze 97acccd3ed core: targeted operations
Add `-target=resource` flag to core operations, allowing users to
target specific resources in their infrastructure. When `-target` is
used, the operation will only apply to that resource and its
dependencies.

The calculated dependencies are different depending on whether we're
running a normal operation or a `terraform destroy`.

Generally, "dependencies" refers to ancestors: resources falling
_before_ the target in the graph, because their changes are required to
accurately act on the target.

For destroys, "dependencies" are descendents: those resources which fall
_after_ the target. These resources depend on our target, which is going
to be destroyed, so they should also be destroyed.
2015-03-31 14:49:38 -05:00
Mitchell Hashimoto eebd7b8aa3 command/push: ask for only variables that are unset 2015-03-24 13:30:23 -07:00
Mitchell Hashimoto c4dc9af120 command: add DataDir 2015-03-24 13:30:21 -07:00
Paul Hinze 4fc5ebf47e command: warnings should not exit
also properly colorize error/warnings

depends on https://github.com/mitchellh/cli/pull/15
2015-03-05 14:22:34 -06:00
Mitchell Hashimoto 71315076c3 command: autoload terraform.tfvars.json as well [GH-1030] 2015-03-02 09:22:28 -08:00
Mitchell Hashimoto 2c2b560d7f command/remote: no more remote package 2015-02-23 15:13:55 -08:00
Mitchell Hashimoto 3550f7ac3a command: FlagVar => FlagKV 2015-02-23 15:13:54 -08:00
Mitchell Hashimoto 4f91b98a3e command: default path should be the local path 2015-02-23 15:13:54 -08:00
Mitchell Hashimoto f81110c2fe command: backup stuff works better 2015-02-23 15:13:54 -08:00
Mitchell Hashimoto 4ec63bc2ef command: deal with plan states 2015-02-23 15:13:54 -08:00
Mitchell Hashimoto 579f102f37 command: start migrating to new state package 2015-02-23 15:13:54 -08:00
Armon Dadgar b69239e7f8 command/meta: Adding additional nil guards 2015-01-07 13:28:15 -08:00
Armon Dadgar 408ae62306 command/apply: Handle remote state in a plan file 2015-01-07 13:08:32 -08:00
Armon Dadgar ba01e27026 command: Refresh remote state when loading 2014-12-10 13:27:09 -08:00
Armon Dadgar 0fb87e499d command: Meta provides the state output path 2014-12-10 13:27:09 -08:00
Armon Dadgar 53704db4ee command: Enable reading remote-enabled state 2014-12-10 13:27:09 -08:00
Armon Dadgar bf10111745 command/apply: Move state persistence to Meta 2014-12-10 13:27:09 -08:00
Mitchell Hashimoto 5f6fe1f931 command: put the modules in ".terraform/modules"
This also fixes a case where tests wre leaking files
2014-10-13 12:05:28 -07:00
Mitchell Hashimoto 16b023bd2b command: ask for the proper level of input 2014-10-08 10:29:54 -07:00
Mitchell Hashimoto 817f0d9f30 command: don't ask for input if terraform.tfvars file given [GH-346] 2014-10-01 08:37:57 -07:00
Mitchell Hashimoto 245c1ce05a command: enable destroy 2014-09-30 22:01:11 -07:00
Mitchell Hashimoto 901c1448b4 command: make the UI a look nicer 2014-09-29 13:12:06 -07:00
Mitchell Hashimoto af548c9b53 command/plan: ask for input 2014-09-29 11:24:16 -07:00
Mitchell Hashimoto 5b0859b3f5 command: Input tells us whether we should ask for input or not 2014-09-29 11:11:35 -07:00
Mitchell Hashimoto 672bf58337 command: compiles, tests don't pass yet 2014-09-24 14:37:24 -07:00
Mitchell Hashimoto 1b8426f7ff command: Get works 2014-09-22 11:15:27 -07:00
Mitchell Hashimoto ed538a9594 command: Get command, not functional yet. Converted to use modules. 2014-09-22 10:56:50 -07:00
Mitchell Hashimoto b5daa2f41e command: make the default var-file flag easier 2014-09-08 20:57:08 -07:00
Mitchell Hashimoto 546865e1ee command: make sure errors from flag go to UI [GH-269] 2014-09-08 20:56:30 -07:00
Mitchell Hashimoto 69294b1ba3 command: adhere to -no-color, fix test [GH-250] 2014-09-08 20:41:10 -07:00
Mitchell Hashimoto 2caf33f97f command/apply: keep track of default variables separately [GH-153] 2014-08-24 21:40:58 -07:00
Mitchell Hashimoto bc1947124e command: fix data race on Ui 2014-08-19 10:22:26 -07:00
Mitchell Hashimoto 642fed0356 command: terraform.tfvars loaded by default if it exists 2014-08-05 09:32:01 -07:00
Mitchell Hashimoto b172f45b94 command: make state unexported on Meta 2014-07-27 22:58:35 -07:00
Armon Dadgar 54cc66367d command: Adding backup of state file 2014-07-27 18:09:04 -04:00
Mitchell Hashimoto ef6fba754d command: refactor so Context never plans 2014-07-26 17:51:15 -07:00
Mitchell Hashimoto 82e7d58250 command/apply: -init is gone
/cc @pearkes - hurray!
2014-07-26 14:44:05 -07:00
Mitchell Hashimoto 79033f240f command: error if variables present when creating context from plan 2014-07-26 14:32:09 -07:00
Mitchell Hashimoto 1d3e28d7ee command: remove println 2014-07-24 08:49:49 -07:00
Mitchell Hashimoto 3534470ca3 command: -var flag works 2014-07-18 11:37:27 -07:00
Mitchell Hashimoto ba4435f99c command/apply: show add/remove/change count for apply 2014-07-17 15:14:45 -07:00