github.com/pdecat/terraform@v0.11.9-beta1/website/docs/provisioners/null_resource.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Provisioners: null_resource" 4 sidebar_current: "docs-provisioners-null-resource" 5 description: |- 6 The `null_resource` is a resource allows you to configure provisioners that 7 are not directly associated with a single exiting resource. 8 --- 9 10 # null\_resource 11 12 The `null_resource` is a resource that allows you to configure provisioners 13 that are not directly associated with a single existing resource. 14 15 A `null_resource` behaves exactly like any other resource, so you configure 16 [provisioners](/docs/provisioners/index.html), [connection 17 details](/docs/provisioners/connection.html), and other meta-parameters in the 18 same way you would on any other resource. 19 20 This allows fine-grained control over when provisioners run in the dependency 21 graph. 22 23 ## Example usage 24 25 ```hcl 26 resource "aws_instance" "cluster" { 27 count = 3 28 29 # ... 30 } 31 32 resource "null_resource" "cluster" { 33 # Changes to any instance of the cluster requires re-provisioning 34 triggers { 35 cluster_instance_ids = "${join(",", aws_instance.cluster.*.id)}" 36 } 37 38 # Bootstrap script can run on any instance of the cluster 39 # So we just choose the first in this case 40 connection { 41 host = "${element(aws_instance.cluster.*.public_ip, 0)}" 42 } 43 44 provisioner "remote-exec" { 45 # Bootstrap script called with private_ip of each node in the clutser 46 inline = [ 47 "bootstrap-cluster.sh ${join(" ", aws_instance.cluster.*.private_ip)}", 48 ] 49 } 50 } 51 ``` 52 53 ## Argument Reference 54 55 In addition to all the resource configuration available, `null_resource` supports the following specific configuration options: 56 57 * `triggers` - A mapping of values which should trigger a rerun of this set of 58 provisioners. Values are meant to be interpolated references to variables or 59 attributes of other resources.