2014-07-27 02:42:25 +02:00
---
layout: "consul"
page_title: "Provider: Consul"
sidebar_current: "docs-consul-index"
2014-10-22 05:21:56 +02:00
description: |-
Consul is a tool for service discovery, configuration and orchestration. The Consul provider exposes resources used to interact with a Consul cluster. Configuration of the provider is optional, as it provides defaults for all arguments.
2014-07-27 02:42:25 +02:00
---
# Consul Provider
2015-01-03 19:31:53 +01:00
[Consul ](https://www.consul.io ) is a tool for service discovery, configuration
2014-07-29 02:04:06 +02:00
and orchestration. The Consul provider exposes resources used to interact with a
2014-07-29 02:17:26 +02:00
Consul cluster. Configuration of the provider is optional, as it provides
defaults for all arguments.
2014-07-27 02:42:25 +02:00
Use the navigation to the left to read about the available resources.
## Example Usage
```
# Configure the Consul provider
provider "consul" {
2017-02-18 23:48:50 +01:00
address = "demo.consul.io:80"
datacenter = "nyc1"
2014-07-27 02:42:25 +02:00
}
# Access a key in Consul
resource "consul_keys" "app" {
2017-02-18 23:48:50 +01:00
key {
name = "ami"
path = "service/app/launch_ami"
default = "ami-1234"
}
2014-07-27 02:42:25 +02:00
}
# Use our variable from Consul
resource "aws_instance" "app" {
2017-02-18 23:48:50 +01:00
ami = "${consul_keys.app.var.ami}"
2014-07-27 02:42:25 +02:00
}
```
## Argument Reference
The following arguments are supported:
2015-05-07 01:12:32 +02:00
* `address` - (Optional) The HTTP(S) API address of the agent to use. Defaults to "127.0.0.1:8500".
* `scheme` - (Optional) The URL scheme of the agent to use ("http" or "https"). Defaults to "http".
2014-07-27 02:42:25 +02:00
* `datacenter` - (Optional) The datacenter to use. Defaults to that of the agent.
2016-08-12 04:22:41 +02:00
* `token` - (Optional) The ACL token to use by default when making requests to the agent.
* `ca_file` - (Optional) A path to a PEM-encoded certificate authority used to verify the remote agent's certificate.
* `cert_file` - (Optional) A path to a PEM-encoded certificate provided to the remote agent; requires use of `key_file` .
* `key_file` - (Optional) A path to a PEM-encoded private key, required if `cert_file` is specified.
2014-07-27 02:42:25 +02:00