From 7f800f34982599b58944fcf3e3e3e573eff5e765 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Tue, 27 Oct 2015 15:28:37 -0500 Subject: [PATCH] website: docs for null_resource --- .../provisioners/null_resource.html.markdown | 60 +++++++++++++++++++ website/source/layouts/docs.erb | 4 ++ 2 files changed, 64 insertions(+) create mode 100644 website/source/docs/provisioners/null_resource.html.markdown diff --git a/website/source/docs/provisioners/null_resource.html.markdown b/website/source/docs/provisioners/null_resource.html.markdown new file mode 100644 index 000000000000..51a409042ac0 --- /dev/null +++ b/website/source/docs/provisioners/null_resource.html.markdown @@ -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. + diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index 937c120de4b6..8dfffb70ab9e 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -217,6 +217,10 @@ > remote-exec + + > + null_resource +