website: Document consul provider

This commit is contained in:
Armon Dadgar 2014-07-26 20:42:25 -04:00
parent dc0de63a72
commit 615d724aaa
6 changed files with 158 additions and 1 deletions

View File

@ -0,0 +1,45 @@
---
layout: "consul"
page_title: "Provider: Consul"
sidebar_current: "docs-consul-index"
---
# Consul Provider
The Consul provider exposes resources used to interact with
the Consul catalog. The provider optionally must can be configured with
to change default behavior.
Use the navigation to the left to read about the available resources.
## Example Usage
```
# Configure the Consul provider
provider "consul" {
address = "demo.consul.io:80"
datacenter = "nyc1"
}
# Access a key in Consul
resource "consul_keys" "app" {
key {
name = "ami"
path = "service/app/launch_ami"
default = "ami-1234"
}
}
# Use our variable from Consul
resource "aws_instance" "app" {
ami = "${consul_keys.app.var.ami}"
}
```
## Argument Reference
The following arguments are supported:
* `address` - (Optional) The HTP API address of the agent to use. Defaults to "127.0.0.1:8500".
* `datacenter` - (Optional) The datacenter to use. Defaults to that of the agent.

View File

@ -0,0 +1,78 @@
---
layout: "consul"
page_title: "Consul: consul_keys"
sidebar_current: "docs-consul-resource-keys"
---
# consul\_keys
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.
## Example Usage
```
resource "consul_keys" "app" {
datacenter = "nyc1"
# Read the launch AMI from Consul
key {
name = "ami"
path = "service/app/launch_ami"
default = "ami-1234"
}
# Set the CNAME of our load balancer as a key
key {
name = "elb_cname"
path = "service/app/elb_address"
value = "${aws_elb.app.dns_name}"
}
}
# Start our instance with the dynamic ami value
resource "aws_instance" "app" {
ami = "${consul_keys.app.var.ami}"
...
}
```
## Argument Reference
The following arguments are supported:
* `datacenter` - (Optional) The datacenter to use. This overrides the
datacenter in the provider setup and the agent's default datacenter.
* `key` - (Required) Specifies a key in Consul to be read or written.
Supported values documented below.
The `key` block supports the following:
* `name` - (Required) This is the name of the key. This value of the
key is exposed as `var.<name>`. This is not the path of the key
in Consul.
* `path` - (Required) This is the path in Consul that should be read
or written to.
* `default` - (Optional) This is the default value to set for `var.<name>`
if the key does not exist in Consul. Defaults to the empty string.
* `value` - (Optional) If set, the key will be set to this value.
This allows a key to be written to.
* `delete` - (Optional) If true, then the key will be deleted when
the resource is destroyed. Otherwsie, it will be left in Consul.
Defaults to false.
## Attributes Reference
The following attributes are exported:
* `datacenter` - The datacenter the keys are being read/written to.
* `var.<name>` - For each name given, the corresponding attribute
has the value of the key.

View File

@ -0,0 +1,26 @@
<% wrap_layout :inner do %>
<% content_for :sidebar do %>
<div class="docs-sidebar hidden-print affix-top" role="complementary">
<ul class="nav docs-sidenav">
<li<%= sidebar_current("docs-home") %>>
<a href="/docs/index.html">&laquo; Documentation Home</a>
</li>
<li<%= sidebar_current("docs-consul-index") %>>
<a href="/docs/providers/consul/index.html">Consul Provider</a>
</li>
<li<%= sidebar_current("docs-consul-resource") %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-consul-resource-keys") %>>
<a href="/docs/providers/consul/r/keys.html">consul_keys</a>
</li>
</ul>
</li>
</ul>
</div>
<% end %>
<%= yield %>
<% end %>

View File

@ -84,6 +84,10 @@
<a href="/docs/providers/cloudflare/index.html">CloudFlare</a>
</li>
<li<%= sidebar_current("docs-providers-consul") %>>
<a href="/docs/providers/consul/index.html">Consul</a>
</li>
<li<%= sidebar_current("docs-providers-do") %>>
<a href="/docs/providers/do/index.html">DigitalOcean</a>
</li>

View File

@ -6,6 +6,7 @@ body.page-sub{
background-color: @light-black;
}
body.layout-consul,
body.layout-dnsimple,
body.layout-cloudflare,
body.layout-heroku,

View File

@ -1,6 +1,6 @@
.rls-l {
font-family: 'Lato', "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: 100;
font-weight: 200;
}
.rls-sb {
font-family: 'Lato', "Helvetica Neue", Helvetica, Arial, sans-serif;
@ -1277,6 +1277,7 @@ body.page-home #footer {
body.page-sub {
background-color: #242424;
}
body.layout-consul,
body.layout-dnsimple,
body.layout-cloudflare,
body.layout-heroku,
@ -1287,6 +1288,7 @@ body.layout-inner,
body.layout-intro {
background: #242424 url('../images/sidebar-wire.png') left 62px no-repeat;
}
body.layout-consul > .container .col-md-8[role=main],
body.layout-dnsimple > .container .col-md-8[role=main],
body.layout-cloudflare > .container .col-md-8[role=main],
body.layout-heroku > .container .col-md-8[role=main],
@ -1298,6 +1300,7 @@ body.layout-intro > .container .col-md-8[role=main] {
min-height: 800px;
background-color: white;
}
body.layout-consul > .container .col-md-8[role=main] > div,
body.layout-dnsimple > .container .col-md-8[role=main] > div,
body.layout-cloudflare > .container .col-md-8[role=main] > div,
body.layout-heroku > .container .col-md-8[role=main] > div,