Commit Graph

95 Commits

Author SHA1 Message Date
James Nugent b4048dfc1d core: Add -json flag to `terraform output`
This commit removes the ability to index into complex output types using
`terraform output a_list 1` (for example), and adds a `-json` flag to
the `terraform output` command, such that the output can be piped
through a post-processor such as jq or json. This removes the need to
allow arbitrary traversal of nested structures.

It also adds tests of human readable ("normal") output with nested lists
and maps, and of the new JSON output.
2016-07-13 10:42:55 -06:00
Paul Hinze b0485db5f4
website: Remove `-backup` from `plan` docs
Refs #7087
2016-06-10 18:06:26 -05:00
Devon Harvey 689cfc97c1 Fix typo in show command docs (#6784) 2016-05-20 09:07:17 +01:00
Mitchell Hashimoto 54df833406
website: add import command docs 2016-05-18 12:57:03 -06:00
Mitchell Hashimoto 9ddf73ad81
website: update docs 2016-05-10 13:25:43 -07:00
Mitchell Hashimoto 04598baa25
website: document state mv 2016-05-10 13:25:42 -07:00
Mitchell Hashimoto 473a58a672 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:49:14 -04:00
Mitchell Hashimoto e133452663 command/state: pattern => address 2016-05-10 14:14:48 -04:00
Mitchell Hashimoto 5737c0a13b website: update docs for state show 2016-05-10 14:14:48 -04:00
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
Dan Carley 64c1280951 command/fmt: Improve documentation for -diff and defaults (#6398)
* command/fmt: Document -diff doesn't disable -write

As noted in hashicorp/terraform#6343, this description misleadingly
suggested that the `-diff` option disables the `-write` option.

This isn't the case and because of the default options (described in
c753390) the behaviour of `terraform fmt -diff` is actually the same as
`terraform fmt -write -list -diff`.

Replace the "instead of rewriting" description to clarify that.

Documentation in hcl/fmtcmd is corrected in hashicorp/hcl#117 but it's not
really necessary to bump the dependency version.

* command/fmt: Show flag defaults in help text

These were documented on the website but not in the `-help` text. This
should help to clarify that you need to pass `-list=false -write=false
-diff` if you only want to see diffs.

Accordingly I've replaced the word "disabled" with "always false" in the
STDIN special cases so that it matches the terminology used in the defaults
and better indicates that it is overridden.

NB: The 3x duplicated defaults and documentation makes me feel uneasy once
again. I'm not sure how to solve that, though.
2016-04-29 00:39:53 +01:00
Martin Atkins fa703db8a6 Merge #4955: "terraform fmt" command 2016-04-04 01:07:32 -07:00
Paul Hinze c7f5450a96 command: Add `terraform untaint`
- [x] Docs
 - [x] Command Unit Tests
 - [x] State Unit Tests

Closes #4820
2016-03-11 12:38:57 -06:00
Dan Carley 79e2753e41 command/fmt: Disable list/write when using STDIN
These options don't make sense when passing STDIN. `-write` will raise an
error because there is no file to write to. `-list` will always say
`<standard input>`. So disable whenever using STDIN, making the command
much simpler:

    cat main.tf | terraform fmt -
2016-03-07 15:07:15 +00:00
Dan Carley e9128769b5 command/fmt: Accept input from STDIN
So that you can do automatic formatting from an editor. You probably want to
disable the `-write` and `-list` options so that you just get the
re-formatted content, e.g.

    cat main.tf | terraform fmt -write=false -list=false -

I've added a non-exported field called `input` so that we can override this
for the tests. If not specified, like in `commands.go`, then it will default
to `os.Stdin` which works on the command line.
2016-03-07 15:07:15 +00:00
Dan Carley 1b967e612f command/fmt: Accept optional directory argument
So that you can operate on files in a directory other than your current
working directory.
2016-03-07 15:07:14 +00:00
Dan Carley c753390399 command/fmt: Default write and list to true
The most common usage usage will be enabling the `-write` and `-list`
options so that files are updated in place and a list of any modified files
is printed. This matches the default behaviour of `go fmt` (not `gofmt`). So
enable these options by default.

This does mean that you will have to explicitly disable these if you want to
generate valid patches, e.g. `terraform fmt -diff -write=false -list=false`
2016-03-07 15:07:14 +00:00
Dan Carley cc41c7cfa0 command/fmt: Add new fmt command
This uses the `fmtcmd` package which has recently been merged into HCL. Per
the usage text, this rewrites Terraform config files to their canonical
formatting and style.

Some notes about the implementation for this initial commit:

- all of the fmtcmd options are exposed as CLI flags
- it operates on all files that have a `.tf` suffix
- it currently only operates on the working directory and doesn't accept a
  directory argument, but I'll extend this in subsequent commits
- output is proxied through `cli.UiWriter` so that we write in the same way
  as other commands and we can capture the output during tests
- the test uses a very simple fixture just to ensure that it is working
  correctly end-to-end; the fmtcmd package has more exhaustive tests
- we have to write the fixture to a file in a temporary directory because it
  will be modified and for this reason it was easier to define the fixture
  contents as a raw string
2016-03-07 15:07:04 +00:00
gamename 3bc09db7e0 docs(variables): redundant wording 2016-03-01 17:13:05 -06:00
gamename c6b350b98e docs(variables): describe order of evaluation with files 2016-03-01 17:08:57 -06:00
Radek Simko 7fed07a0a2 docs: Clarify use cases in docs for the validate cmd 2016-02-08 12:36:30 +00:00
Soren Mathiasen db69a2959b Added verify command 2016-02-08 12:48:14 +01: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
Radek Simko f2ffff33eb docs: Create new section for remote state backends 2016-01-18 08:08:19 +00:00
Seth Vargo ef30df002a Fix broken link 2016-01-14 17:13:14 -05:00
Seth Vargo 8dbc43639d Use HTTPS + www. for links 2016-01-14 16:03:26 -05:00
John E. Vincent 0e664c8c20 making note of artifactory env vars that are supported 2016-01-13 07:48:50 -05:00
Sander van Harmelen 9b27db6fea Add the option to specify a custom (AWS compatible) S3 endpoint
Same fix/option as I added in Vault not too long ago:
https://github.com/hashicorp/vault/pull/750
2016-01-11 14:28:52 +01:00
James Nugent 562b7dfab7 Add documentation for Artifactory remote state 2015-12-21 17:46:55 -05:00
Paul Hinze 1a19f43ee1 core: support HTTP basic auth in consul remote state
Closes #1663
2015-12-04 07:15:18 -06:00
Chad Thompson d309f8b82b Update remote-config.html.markdown
Replace "shared storaged" with "shared storage".  (Very minor change.)
2015-11-11 13:09:26 -06:00
Martin Atkins 484d6f8765 Merge pull request #3487 from nathan7/etcd
Etcd remote state backend
2015-10-19 18:42:29 -07:00
David Adams 3021069207 Update init and remote config command docs
* Update init docs to be correct, and provide an example.
* Update remote config docs to provide more details about the Consul
  backend and to provide another example.
2015-10-18 18:23:13 -05:00
Nathan Zadoks 362a2035c0 Document the etcd remote state backend 2015-10-18 23:24:56 +02:00
Julian C. Dunn 3143d1703d Graphviz Workspace appears to be dead, so remove it from the docs. 2015-10-09 01:19:14 -04:00
Paul Hinze 374070d066 website: docs for parallelism setting
/cc @stack72 @knuckolls @mitchellh
2015-10-05 17:21:29 -05:00
Radek Simko 4f7f20ba23 remote/s3: Add some docs for supported parameters 2015-09-14 10:40:53 +01:00
Anthony Scalisi 198e1a5186 remove various typos 2015-09-11 11:56:20 -07:00
Radek Simko 3f7c3a92c3 docs: Fix typo (hyphen -> underscore) in remote-config 2015-08-29 11:30:11 +01:00
Radek Simko 5560f8a8d2 Merge pull request #3057 from jszwedko/patch-1
Fix remote state AWS configuration key names
2015-08-29 11:19:39 +01:00
Mark Turner c9ec10d71a Altered Consul variable from 'access-token' to 'access_token' so it's the same as in the codebase 2015-08-28 17:18:35 +01:00
Jesse Szwedko 43e6a14290 Fix remote state AWS configuration key names 2015-08-21 21:03:20 -07:00
Mitchell Hashimoto 3cc5252b9d website: update copy 2015-06-29 13:59:25 -07:00
Mitchell Hashimoto 9d9bcc2f6e command/push: update flag to -overwrite, update docs 2015-06-29 13:53:05 -07:00
Mitchell Hashimoto 82028a7667 website: update push docs 2015-06-29 13:45:35 -07:00
Paul Hinze a75095aa69 docs: clarify wording around destroy/apply args
inspired by #2360 with clarification on args vs flags

/cc @catsby
2015-06-17 10:10:23 -05:00
Kirill Shirinkin b945d1ee0b Update docs 2015-05-27 17:11:31 +02:00
Paul Hinze d30d88e327 Merge pull request #1655 from hashicorp/f-build-graph-during-plan
core: validate on verbose graph to detect some cycles earlier
2015-04-30 16:08:33 -05:00
Martin Atkins 53e93d6f63 S3 remote stage storage backend, against the new remote state API.
Stores state in a particular key in a given S3 bucket.
2015-04-30 09:21:49 -07:00
Paul Hinze ce49dd6080 core: graph command gets -verbose and -draw-cycles
When you specify `-verbose` you'll get the whole graph of operations,
which gives a better idea of the operations terraform performs and in
what order.

The DOT graph is now generated with a small internal library instead of
simple string building. This allows us to ensure the graph generation is
as consistent as possible, among other benefits.

We set `newrank = true` in the graph, which I've found does just as good
a job organizing things visually as manually attempting to rank the nodes
based on depth.

This also fixes `-module-depth`, which was broken post-AST refector.
Modules are now expanded into subgraphs with labels and borders. We
have yet to regain the plan graphing functionality, so I removed that
from the docs for now.

Finally, if `-draw-cycles` is added, extra colored edges will be drawn
to indicate the path of any cycles detected in the graph.

A notable implementation change included here is that
{Reverse,}DepthFirstWalk has been made deterministic. (Before it was
dependent on `map` ordering.) This turned out to be unnecessary to gain
determinism in the final DOT-level implementation, but it seemed
a desirable enough of a property that I left it in.
2015-04-27 09:23:47 -05:00