github.com/bengesoff/terraform@v0.3.1-0.20141018223233-b25a53629922/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      token = "abcd"
    20  
    21      # Read the launch AMI from Consul
    22      key {
    23          name = "ami"
    24          path = "service/app/launch_ami"
    25          default = "ami-1234"
    26      }
    27  
    28      # Set the CNAME of our load balancer as a key
    29      key {
    30          name = "elb_cname"
    31          path = "service/app/elb_address"
    32          value = "${aws_elb.app.dns_name}"
    33      }
    34  }
    35  
    36  # Start our instance with the dynamic ami value
    37  resource "aws_instance" "app" {
    38      ami = "${consul_keys.app.var.ami}"
    39      ...
    40  }
    41  ```
    42  
    43  ## Argument Reference
    44  
    45  The following arguments are supported:
    46  
    47  * `datacenter` - (Optional) The datacenter to use. This overrides the
    48    datacenter in the provider setup and the agent's default datacenter.
    49  
    50  * `token` - (Optional) The ACL token to use. This overrides the
    51    token that the agent provides by default.
    52  
    53  * `key` - (Required) Specifies a key in Consul to be read or written.
    54    Supported values documented below.
    55  
    56  The `key` block supports the following:
    57  
    58  * `name` - (Required) This is the name of the key. This value of the
    59    key is exposed as `var.<name>`. This is not the path of the key
    60    in Consul.
    61  
    62  * `path` - (Required) This is the path in Consul that should be read
    63    or written to.
    64  
    65  * `default` - (Optional) This is the default value to set for `var.<name>`
    66    if the key does not exist in Consul. Defaults to the empty string.
    67  
    68  * `value` - (Optional) If set, the key will be set to this value.
    69    This allows a key to be written to.
    70  
    71  * `delete` - (Optional) If true, then the key will be deleted when
    72    the resource is destroyed. Otherwise, it will be left in Consul.
    73    Defaults to false.
    74  
    75  ## Attributes Reference
    76  
    77  The following attributes are exported:
    78  
    79  * `datacenter` - The datacenter the keys are being read/written to.
    80  * `var.<name>` - For each name given, the corresponding attribute
    81    has the value of the key.
    82