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