consul_keys (Data Source)

The consul_keys datasource reads values from the Consul key/value store. This is a powerful way to dynamically set values in templates.

Example Usage

data "consul_keys" "app" {
  datacenter = "nyc1"

  # Read the launch AMI from Consul
  key {
    name    = "ami"
    path    = "service/app/launch_ami"
    default = "ami-1234"
  }
}

# Start our instance with the dynamic ami value
resource "aws_instance" "app" {
  ami = data.consul_keys.app.var.ami

  # ...
}

Schema

Optional

Read-Only

Nested Schema for key

Required:

Optional: