Commit Graph

80 Commits

Author SHA1 Message Date
James Bardin 797a1b339d DebugInfo and DebugGraph
Implement debugInfo and the DebugGraph

DebugInfo will be a global variable through which graph debug
information can we written to a compressed archive. The DebugInfo
methods are all safe for concurrent use, and noop with a nil receiver.
The API outside of the terraform package will be to call SetDebugInfo
to create the archive, and CloseDebugInfo() to properly close the file.
Each write to the archive will be flushed and sync'ed individually, so
in the event of a crash or a missing call to Close, the archive can
still be recovered.

The DebugGraph is a representation of a terraform Graph to be written to
the debug archive, currently in dot format. The DebugGraph also contains
an internal buffer with Printf and Write methods to add to this buffer.
The buffer will be written to an accompanying file in the debug archive
along with the graph.

This also adds a GraphNodeDebugger interface. Any node implementing
`NodeDebug() string` can output information to annotate the debug graph
node, and add the data to the log. This interface may change or be
removed to provide richer options for debugging graph nodes.

The new graph builders all delegate the build to the BasicGraphBuilder.
Having a Name field lets us differentiate the actual builder
implementation in the debug graphs.
2016-11-04 11:30:51 -04:00
James Bardin 6b7a079bff Add a way to avoid panicwrap when debugging
When trying to use a debugger, you don't want the terraform to run in a
new child process. Setting TF_FORK=0 will skip panicwrap and continue
running the program in the current process. This will also give direct
access to log output, and stdout.
2016-09-21 14:13:05 -04:00
Mitchell Hashimoto b8036095d4
Logs contain CLI args 2016-08-17 07:50:18 -07:00
Chris Bednarski 3c774af9c2 Warn when an internal plugin is overridden
Also added documentation explaining what happened and how to fix it
2016-05-10 14:49:13 -04:00
Chris Bednarski e942a74def Set a log prefix for each plugin and remove go-dynect global log prefix (#6336) 2016-05-10 14:49:13 -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
James Nugent 8e4da4e2a1 deps: Vendor github.com/hashicorp/go-plugin 2016-05-10 14:14:47 -04:00
James Nugent c77144bd5b core: Fix console colors on Windows
This brings in the go-colorable library when running on Windows in order
to output console colors correctly instead of leaving the codes in place
as is currently the case.
2016-03-18 17:10:20 +00:00
Paul Hinze 4bd4e18def core: use same logging setup for acctests
We weren't doing any log setup for acceptance tests, which made it
difficult to wrangle log output in CI.

This moves the log setup functions we use in `main` over into a helper
package so we can use them for acceptance tests as well.

This means that acceptance tests will by default be a _lot_ quieter,
only printing out actual test output. Setting `TF_LOG=trace` will
restore the full prior noise level.

Only minor behavior change is to make `ioutil.Discard` the default
return value rather than a `nil` that needs to be checked for.
2015-12-08 17:50:36 -06:00
Sander van Harmelen a465c6f4cc Remove duplicate code
Seems to be a refactoring leftover of some kind as on lines 146-148
these calls are done again…
2015-06-16 17:40:59 +02:00
Mitchell Hashimoto c84af741de Log the version info for easier debugging 2014-10-20 22:32:00 -07:00
Mitchell Hashimoto 70191d22a6 Add checkpoint 2014-10-13 14:05:43 -07:00
Mitchell Hashimoto 1510f12efc output errors to the proper location in main.go [GH-288] 2014-10-11 13:03:11 -07:00
Mitchell Hashimoto 238ec05f2f Fix issue where output could be truncated 2014-10-03 13:02:16 -07:00
Mitchell Hashimoto 4fd3dff829 main: auto-discover plugins [GH-190]
/cc @pearkes @armon - exe dir and pwd
2014-08-28 17:27:15 -07:00
Mitchell Hashimoto 2e2f6bf0f4 main: clean up the code surrounding config file loading 2014-08-19 10:58:23 -07:00
Camilo Aguilar fd361c1eb6 Clarifies that what failed loading is the CLI configuration as opposed to Terraform TF files 2014-08-14 12:50:19 -04:00
Camilo Aguilar d3a609ac52 Ports Packer code to load CLI configuration and external plugins 2014-08-14 12:45:58 -04:00
Mitchell Hashimoto 3a8606c117 Recognize -version 2014-07-13 10:37:25 -07:00
Armon Dadgar 1c4321a503 Setup provisioners for CLI 2014-07-10 11:38:57 -07:00
Mitchell Hashimoto 0e88867052 Compile 2014-07-03 12:01:20 -07:00
Mitchell Hashimoto ae6b85e11b terraform: diff hooks 2014-06-26 17:17:10 -07:00
Mitchell Hashimoto 01319e1dc9 Ui hook 2014-06-26 17:05:21 -07:00
Mitchell Hashimoto 92e1e09a69 main: fix the help output to show up 2014-06-26 10:24:51 -07:00
Mitchell Hashimoto 743c3684c5 comments 2014-06-10 10:32:59 -07:00
Mitchell Hashimoto f9e830705d Prefixed IO to make sure stdout/stderr match up 2014-06-10 10:28:47 -07:00
Mitchell Hashimoto 582229969e main: instantiate the config and set it up 2014-06-09 21:57:37 -07:00
Mitchell Hashimoto 61f4684931 Create resource provider factories and cleanup clients in main 2014-06-09 21:44:13 -07:00
Mitchell Hashimoto 7b64c2597b Setup panicwrap 2014-05-30 16:07:26 -07:00
Mitchell Hashimoto a4a4e3784d Implement CLI, version command 2014-05-24 12:04:43 -07:00