github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/consul/d/keys.html.markdown (about)

     1  ---
     2  layout: "consul"
     3  page_title: "Consul: consul_keys"
     4  sidebar_current: "docs-consul-data-source-keys"
     5  description: |-
     6    Reads values from the Consul key/value store.
     7  ---
     8  
     9  # consul_keys
    10  
    11  The `consul_keys` resource reads values from the Consul key/value store.
    12  This is a powerful way dynamically set values in templates.
    13  
    14  ## Example Usage
    15  
    16  ```hcl
    17  data "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  
    29  # Start our instance with the dynamic ami value
    30  resource "aws_instance" "app" {
    31    ami = "${data.consul_keys.app.var.ami}"
    32  
    33    # ...
    34  }
    35  ```
    36  
    37  ## Argument Reference
    38  
    39  The following arguments are supported:
    40  
    41  * `datacenter` - (Optional) The datacenter to use. This overrides the
    42    datacenter in the provider setup and the agent's default datacenter.
    43  
    44  * `token` - (Optional) The ACL token to use. This overrides the
    45    token that the agent provides by default.
    46  
    47  * `key` - (Required) Specifies a key in Consul to be read or written.
    48    Supported values documented below.
    49  
    50  The `key` block supports the following:
    51  
    52  * `name` - (Required) This is the name of the key. This value of the
    53    key is exposed as `var.<name>`. This is not the path of the key
    54    in Consul.
    55  
    56  * `path` - (Required) This is the path in Consul that should be read
    57    or written to.
    58  
    59  * `default` - (Optional) This is the default value to set for `var.<name>`
    60    if the key does not exist in Consul. Defaults to an empty string.
    61  
    62  ## Attributes Reference
    63  
    64  The following attributes are exported:
    65  
    66  * `datacenter` - The datacenter the keys are being read from to.
    67  * `var.<name>` - For each name given, the corresponding attribute
    68    has the value of the key.