github.com/ezbercih/terraform@v0.1.1-0.20140729011846-3c33865e0839/website/source/docs/providers/consul/r/keys.html.markdown (about) 1 --- 2 layout: "consul" 3 page_title: "Consul: consul_keys" 4 sidebar_current: "docs-consul-resource-keys" 5 --- 6 7 # consul\_keys 8 9 Provides access to Key/Value data in Consul. This can be used 10 to both read keys from Consul, but also to set the value of keys 11 in Consul. This is a powerful way dynamically set values in templates, 12 and to expose infrastructure details to clients. 13 14 ## Example Usage 15 16 ``` 17 resource "consul_keys" "app" { 18 datacenter = "nyc1" 19 20 # Read the launch AMI from Consul 21 key { 22 name = "ami" 23 path = "service/app/launch_ami" 24 default = "ami-1234" 25 } 26 27 # Set the CNAME of our load balancer as a key 28 key { 29 name = "elb_cname" 30 path = "service/app/elb_address" 31 value = "${aws_elb.app.dns_name}" 32 } 33 } 34 35 # Start our instance with the dynamic ami value 36 resource "aws_instance" "app" { 37 ami = "${consul_keys.app.var.ami}" 38 ... 39 } 40 ``` 41 42 ## Argument Reference 43 44 The following arguments are supported: 45 46 * `datacenter` - (Optional) The datacenter to use. This overrides the 47 datacenter in the provider setup and the agent's default datacenter. 48 49 * `key` - (Required) Specifies a key in Consul to be read or written. 50 Supported values documented below. 51 52 The `key` block supports the following: 53 54 * `name` - (Required) This is the name of the key. This value of the 55 key is exposed as `var.<name>`. This is not the path of the key 56 in Consul. 57 58 * `path` - (Required) This is the path in Consul that should be read 59 or written to. 60 61 * `default` - (Optional) This is the default value to set for `var.<name>` 62 if the key does not exist in Consul. Defaults to the empty string. 63 64 * `value` - (Optional) If set, the key will be set to this value. 65 This allows a key to be written to. 66 67 * `delete` - (Optional) If true, then the key will be deleted when 68 the resource is destroyed. Otherwsie, it will be left in Consul. 69 Defaults to false. 70 71 ## Attributes Reference 72 73 The following attributes are exported: 74 75 * `datacenter` - The datacenter the keys are being read/written to. 76 * `var.<name>` - For each name given, the corresponding attribute 77 has the value of the key. 78