Commit Graph

489 Commits

Author SHA1 Message Date
Mitchell Hashimoto 57c0cadc79 Merge pull request #9666 from hashicorp/jbardin/debug
preliminary debug output
2016-11-04 09:03:58 -07:00
Mitchell Hashimoto f6dacab0ba Merge pull request #9794 from hashicorp/b-partial-input
command/meta: always ask for unset variable input
2016-11-04 08:48:05 -07:00
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
Mitchell Hashimoto d429e82661
command: show shadow errors to the user 2016-11-03 18:14:07 -07:00
Mitchell Hashimoto 6c801d0386
command/apply: add additional nil check to loading state for outputs 2016-11-02 22:33:49 -07:00
Mitchell Hashimoto 1248b147ac
command/meta: always ask for unset variable input
Fixes #7975

This changes the InputMode for the CLI to always be:

    InputModeProvider | InputModeVar | InputModeVarUnset

Which means:

  * Ask for provider variables
  * Ask for user variables _that are not already set_

The change is the latter point. Before, we'd only ask for variables if
zero were given. This forces the user to either have no variables set
via the CLI, env vars, tfvars or ALL variables, but no in between. As
reported in #7975, this isn't expected behavior.

The new change makes is so that unset variables are always asked for.
Users can retain the previous behavior by setting `-input=false`. This
would ensure that variables set by external sources cover all cases.
2016-11-01 19:16:43 -07:00
Mitchell Hashimoto ab0b7e2d89 Merge pull request #9660 from hashicorp/b-validate-help
command/validate: respond to --help
2016-10-31 13:24:58 -07:00
Mitchell Hashimoto 314a8ed134 Merge pull request #9706 from hashicorp/b-apply-plan
command/apply: apply from plan respects -backup and -state-out
2016-10-31 13:24:24 -07:00
Calle Pettersson 51ff5cba38 Align the help string of output with documentation (#9735) 2016-10-31 11:34:56 +00:00
Mitchell Hashimoto 2019a44f04
command/apply: apply from plan respects -backup and -state-out
Fixes #5409

I didn't expect this to be such a rabbit hole!

Based on git history, it appears that for "historical reasons"(tm),
setting up the various `state.State` structures for a plan were
_completely different logic_ than a normal `terraform apply`. This meant
that it was skipping things like disabling backups with `-backup="-"`.

This PR unifies loading from a plan to the normal state setup mechanism.
A few tests that were failing prior to this PR were added, no existing
tests were changed.
2016-10-28 20:51:05 -04:00
Mitchell Hashimoto b2950bc205
command/validate: respond to --help
Fixes #5072

This is very simple: we need to process CLI flags on validate in order
to catch and respond to `--help`.
2016-10-27 13:43:01 -04:00
Mitchell Hashimoto 69b32223b8 Merge pull request #9633 from hashicorp/f-experiment
helper/experiment: a helper for setting, making experiments
2016-10-27 11:22:07 -04:00
Mitchell Hashimoto 9c2014d5b6 Merge pull request #9642 from hashicorp/b-var-bool
command: FlagTypedKV parses bool as string
2016-10-27 11:17:16 -04:00
Mitchell Hashimoto f9b0207304
command: FlagTypedKV parses bool as string
When passing a bool type to a variable such as `-var foo=true`, the CLI
would parse this as a `bool` type which Terraform core cannot handle.
It would then error with an invalid type error.

This changes the handling to convert the bool to its literally string
value given on the command-line.
2016-10-26 21:45:39 -04:00
James Bardin 43f860ddfd Fix panic during "terraform show" with empty state
It's possible to have > 1 result from the StateFilter, and not have any
instances to show.
2016-10-26 17:18:36 -04:00
Mitchell Hashimoto af82be19ea
helper/experiment: a helper for setting, making experiments
This creates a standard package and interface for defining, querying,
setting experiments (`-X` flags).

I expect we'll want to continue to introduce various features behind
experimental flags. I want to make doing this as easy as possible and I
want to make _removing_ experiments as easy as possible as well.

The goal with this packge has been to rely on the compiler enforcing our
experiment references as much as possible. This means that every
experiment is a global variable that must be referenced directly, so
when it is removed you'll get compiler errors where the experiment is
referenced.

This also unifies and makes it easy to grab CLI flags to enable/disable
experiments as well as env vars! This way defining an experiment is just
a couple lines of code (documented on the package).
2016-10-26 15:47:58 -04:00
Mitchell Hashimoto aed23a0a31 Merge pull request #9527 from hashicorp/f-destroy-builder2
terraform: destroy graph builder based on state
2016-10-26 12:53:20 -04:00
Alexander Hellbom d02067a75e Add PagerDuty provider 2016-10-24 14:19:55 +02:00
Mitchell Hashimoto 1a418c1452
command/apply: -Xnew-destroy 2016-10-22 12:36:47 -07:00
Mitchell Hashimoto ae4f79e3b6
command/meta: add -shadow flag to disable shadow graph
Since it is still very much possible for this to cause problems, this
can be used to disable the shadow graph. We'll purposely not document
this since the goal is to remove this flag as we become more confident
with it.
2016-10-21 14:25:05 -07:00
Mitchell Hashimoto e8516f259d
command/apply: Xnew-apply 2016-10-19 13:39:28 -07:00
Mitchell Hashimoto ec15783f24
-Xnew-apply to enable the new apply graph 2016-10-19 13:39:28 -07:00
James Bardin f175497dd7 Fix vet issues
None were critical, but these will fail with the next version of vet.
2016-10-18 11:11:12 -04:00
James Bardin 54d50c90b1 Make TestApply_parallelism more reliable
Wait for our expected number of goroutines to be staged and ready, then
allow Run() to complete. Use a high-water-mark counter to ensure we
never exceeded the max expected concurrent goroutines at any point
during the run.
2016-10-17 18:26:16 -04:00
James Bardin 4f91507d05 Merge pull request #9268 from hashicorp/jbardin/hcl-maps
Get rid of the list when parsing HCL maps for vars
2016-10-13 14:18:29 -04:00
James Bardin 9fc50a76c3 Get rid of the list when parsing HCL maps for vars
When we parse a map from HCL, it's decoded into a list of maps because
HCL allows declaring a key multiple times to implicitly add it to a
list.  Since there's no terraform variable configuration that supports
this structure, we can always flatten a []map[string]interface{} value
to a map[string]interface{} and remove any type rrors trying to apply
that value.
2016-10-06 19:44:19 -04:00
James Bardin 286fea571f Fix push test to use something that is HCL
Fix the tfvars push test which was mistakingly using a single number to
trigger the HCL behavior.
2016-10-06 16:37:28 -04:00
James Bardin cf1cfccf06 Don't parse a TestFlagTypedKV value as a number
Don't try to parse a varibale as HCL if the value can be parse as a
single number. HCL will always attempt to convert the value to a number,
even if we later find the configured variable's type to be a string.
2016-10-06 16:27:33 -04:00
stack72 a2970e631c
Merge branch 'cwood/bitbucket-provider' of https://github.com/cwood/terraform into cwood-cwood/bitbucket-provider 2016-09-21 19:35:58 +01:00
Mitchell Hashimoto 609219fc65 command/meta: validate config immediately
* config: test for validating multi-vars (passes)

* command/plan: test invalid run

* command/meta: validate module on load
2016-09-03 15:26:49 -07:00
Mitchell Hashimoto fad1ce9915 Merge pull request #8620 from hashicorp/b-var-input
command: more resilient HCL check for inputs
2016-09-02 10:02:23 -07:00
Mitchell Hashimoto c84f699158
update HCL vendor 2016-09-02 09:58:05 -07:00
Paul Stack 05994cef31 Merge pull request #7694 from jtopjian/provider-rabbitmq
RabbitMQ Provider
2016-09-02 08:08:18 +01:00
Mitchell Hashimoto 0a2b5de67f
command: more resilient HCL check for inputs 2016-09-01 20:14:10 -07:00
Joe Topjian c2469c95f4 provider/rabbitmq: Initial Commit of RabbitMQ Provider
Contains provider configuration, a rabbitmq_vhost resource, and
acceptance test.
2016-09-01 03:19:16 +00:00
Mitchell Hashimoto 475d8750bb
command/push: make test more resilient 2016-08-26 13:38:02 -07:00
Radek Simko 8494cad8c4 Output 'destroy complete' when it's destroy (was: apply) (#8453) 2016-08-25 22:26:40 +01:00
Mitchell Hashimoto 2f8baa4580
command/push: fix tests to be vcs=false GH-8478 2016-08-25 14:09:34 -07: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 92b15de080
command/push: remove the old test fixture for the new one 2016-08-23 23:16:30 -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 f0de3c3e91
command/push: removed all the git stuff, turns out it doesn't matter 2016-08-23 22:51:37 -07:00
Mitchell Hashimoto e8267f4907
command/push: failing test for pushing with no modules 2016-08-23 22:49:00 -07:00
Mitchell Hashimoto 70cc108614
Revert "command/push: test that -upload-modules=false works"
This reverts commit edda576452.
2016-08-23 22:00:02 -07:00
Mitchell Hashimoto edda576452
command/push: test that -upload-modules=false works 2016-08-23 17:40:40 -07:00
Mitchell Hashimoto 2ac142abc3
command: use bufio.ReadString instead of scanning to get spaces
[GH-2628]
2016-08-22 12:59:48 -07:00
Mitchell Hashimoto d3792e4aef
command: correct outdated comment 2016-08-19 23:56:27 -04:00
Mitchell Hashimoto 43cfd3d1c9
command: fix regressions for state mv with count resource 2016-08-19 12:09:19 -04:00