Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

website: docs for null_resource #3659

Merged
merged 1 commit into from
Oct 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions website/source/docs/provisioners/null_resource.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
layout: "docs"
page_title: "Provisioners: null_resource"
sidebar_current: "docs-provisioners-null-resource"
description: |-
The `null_resource` is a resource allows you to configure provisioners that
are not directly associated with a single exiting resource.
---

# null\_resource

The `null_resource` is a resource that allows you to configure provisioners
that are not directly associated with a single existing resource.

A `null_resource` behaves exactly like any other resource, so you configure
[provisioners](/docs/provisioners/index.html), [connection
details](/docs/provisioners/connection.html), and other meta-parameters in the
same way you would on any other resource.

This allows fine-grained control over when provisioners run in the dependency
graph.

## Example usage

```
# Bootstrap a cluster after all its instances are up
resource "aws_instance" "cluster" {
count = 3
// ...
}

resource "null_resource" "cluster" {
# Changes to any instance of the cluster requires re-provisioning
triggers {
cluster_instance_ids = "${join(",", aws_instance.cluster.*.id)}"
}

# Bootstrap script can run on any instance of the cluster
# So we just choose the first in this case
connection {
host = "${element(aws_instance.cluster.*.public_ip, 0)}"
}

provisioner "remote-exec" {
# Bootstrap script called with private_ip of each node in the clutser
inline = [
"bootstrap-cluster.sh ${join(" ", aws_instance.cluster.*.private_ip}"
]
}
}
```

## Argument Reference

In addition to all the resource configuration available, `null_resource` supports the following specific configuration options:

* `triggers` - A mapping of values which should trigger a rerun of this set of
provisioners. Values are meant to be interpolated references to variables or
attributes of other resources.

4 changes: 4 additions & 0 deletions website/source/layouts/docs.erb
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@
<li<%= sidebar_current("docs-provisioners-remote") %>>
<a href="/docs/provisioners/remote-exec.html">remote-exec</a>
</li>

<li<%= sidebar_current("docs-provisioners-null-resource") %>>
<a href="/docs/provisioners/null_resource.html">null_resource</a>
</li>
</ul>
</li>

Expand Down