diff --git a/website/source/docs/providers/consul/index.html.markdown b/website/source/docs/providers/consul/index.html.markdown new file mode 100644 index 000000000..372c51138 --- /dev/null +++ b/website/source/docs/providers/consul/index.html.markdown @@ -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. + diff --git a/website/source/docs/providers/consul/r/keys.html.markdown b/website/source/docs/providers/consul/r/keys.html.markdown new file mode 100644 index 000000000..49a6785cd --- /dev/null +++ b/website/source/docs/providers/consul/r/keys.html.markdown @@ -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.`. 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.` + 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.` - For each name given, the corresponding attribute + has the value of the key. + diff --git a/website/source/layouts/consul.erb b/website/source/layouts/consul.erb new file mode 100644 index 000000000..9c6acdc0f --- /dev/null +++ b/website/source/layouts/consul.erb @@ -0,0 +1,26 @@ +<% wrap_layout :inner do %> + <% content_for :sidebar do %> + + <% end %> + + <%= yield %> + <% end %> diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index 03e934f00..78b2e2a0b 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -82,6 +82,10 @@ > CloudFlare + + + > + Consul > diff --git a/website/source/stylesheets/_docs.less b/website/source/stylesheets/_docs.less index 34d962cb5..72e9f6c8e 100755 --- a/website/source/stylesheets/_docs.less +++ b/website/source/stylesheets/_docs.less @@ -6,6 +6,7 @@ body.page-sub{ background-color: @light-black; } +body.layout-consul, body.layout-dnsimple, body.layout-cloudflare, body.layout-heroku, diff --git a/website/source/stylesheets/main.css b/website/source/stylesheets/main.css index dde1579b8..03e626a4b 100644 --- a/website/source/stylesheets/main.css +++ b/website/source/stylesheets/main.css @@ -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,