Skip to content

Commit

Permalink
website: docs for parallelism setting
Browse files Browse the repository at this point in the history
  • Loading branch information
phinze committed Oct 5, 2015
1 parent 27eb6a1 commit 374070d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
3 changes: 3 additions & 0 deletions command/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ Options:
-no-color If specified, output won't contain any color.
-parallelism=n Limit the number of concurrent operations.
Defaults to 10.
-refresh=true Update state prior to checking for differences. This
has no effect if a plan file is given to apply.
Expand Down
2 changes: 1 addition & 1 deletion command/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Options:
-out=path Write a plan file to the given path. This can be used as
input to the "apply" command.
-parallelism=# Limit the number of concurrent operations. Defaults to 10.
-parallelism=n Limit the number of concurrent operations. Defaults to 10.
-refresh=true Update state prior to checking for differences.
Expand Down
3 changes: 3 additions & 0 deletions website/source/docs/commands/apply.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ The command-line flags are all optional. The list of available flags are:

* `-no-color` - Disables output with coloring.

* `-parallelism=n` - Limit the number of concurrent operation as Terraform
[walks the graph](/docs/internals/graph.html#walking-the-graph).

* `-refresh=true` - Update the state for each resource prior to planning
and applying. This has no effect if a plan file is given directly to
apply.
Expand Down
3 changes: 3 additions & 0 deletions website/source/docs/commands/plan.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ The command-line flags are all optional. The list of available flags are:
changes shown in this plan are applied. Read the warning on saved
plans below.

* `-parallelism=n` - Limit the number of concurrent operation as Terraform
[walks the graph](/docs/internals/graph.html#walking-the-graph).

* `-refresh=true` - Update the state prior to checking for differences.

* `-state=path` - Path to the state file. Defaults to "terraform.tfstate".
Expand Down
21 changes: 19 additions & 2 deletions website/source/docs/internals/graph.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,24 @@ Building the graph is done in a series of sequential steps:
1. Validate the graph has no cycles and has a single root.

## Walking the Graph
<a id="walking-the-graph"></a>

To walk the graph, a standard depth-first traversal is done. Graph
walking is done with as much parallelism as possible: a node is walked
as soon as all of its dependencies are walked.
walking is done in parallel: a node is walked as soon as all of its
dependencies are walked.

The amount of parallelism is limited using a semaphore to prevent too many
concurrent operations from overwhelming the resources of the machine running
Terraform. By default, up to 10 nodes in the graph will be processed
concurrently. This number can be set using the `-parallelism` flag on the
[plan](/docs/commands/plan.html), [apply](/docs/commands/apply.html), and
[destroy](/docs/commands/destroy.html) commands.

Setting `-parallelism` is considered an advanced operation and should not be
necessary for normal usage of Terraform. It may be helpful in certain special
use cases or to help debug Terraform issues.

Note that some providers (AWS, for example), handle API rate limiting issues at
a lower level by implementing graceful backoff/retry in their respective API
clients. For this reason, Terraform does not use this `parallelism` feature to
address API rate limits directly.

1 comment on commit 374070d

@stack72
Copy link
Contributor

@stack72 stack72 commented on 374070d Oct 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @phinze :) This is really useful

Please sign in to comment.