Browse the Repo

file-type-icon.circleci
file-type-icon_ci
file-type-icon_docs
file-type-iconexamples
file-type-iconmodules
file-type-iconinstall-vault
file-type-iconprivate-tls-cert
file-type-iconrun-vault
file-type-iconupdate-certificate-store
file-type-iconvault-cluster
file-type-iconvault-elb
file-type-iconREADME.md
file-type-iconmain.tf
file-type-iconoutputs.tf
file-type-iconvariables.tf
file-type-iconvault-security-group-rules
file-type-icontest
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconCONTRIBUTING.md
file-type-iconLICENSE
file-type-iconNOTICE
file-type-iconREADME.md
file-type-iconmain.tf
file-type-iconoutputs.tf
file-type-iconvariables.tf

Browse the Repo

file-type-icon.circleci
file-type-icon_ci
file-type-icon_docs
file-type-iconexamples
file-type-iconmodules
file-type-iconinstall-vault
file-type-iconprivate-tls-cert
file-type-iconrun-vault
file-type-iconupdate-certificate-store
file-type-iconvault-cluster
file-type-iconvault-elb
file-type-iconREADME.md
file-type-iconmain.tf
file-type-iconoutputs.tf
file-type-iconvariables.tf
file-type-iconvault-security-group-rules
file-type-icontest
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconCONTRIBUTING.md
file-type-iconLICENSE
file-type-iconNOTICE
file-type-iconREADME.md
file-type-iconmain.tf
file-type-iconoutputs.tf
file-type-iconvariables.tf
HashiCorp Vault

HashiCorp Vault

Deploy a Vault cluster. Supports automatic bootstrapping, Consul and S3 backends, self-signed TLS certificates, and auto healing.

Code Preview

Preview the Code

mobile file icon

README.md

down

Vault Elastic Load Balancer

This folder contains a Terraform module that can be used to deploy an Elastic Load Balancer (ELB) in front of the Vault cluster from the vault-cluster module. This is useful if you need to access Vault from the public Internet. Note that for most users, we recommend NOT making Vault accessible from the public Internet and using DNS to access your Vault cluster instead (see the install-dnsmasq module or setup-systemd-resolved in the case of Ubuntu 18.04 for details).

How do you use this module?

This folder defines a Terraform module, which you can use in your code by adding a module configuration and setting its source parameter to URL of this folder:

module "vault_elb" {
  # Use version v0.0.1 of the vault-elb module
  source = "github.com/hashicorp/terraform-aws-vault//modules/vault-elb?ref=v0.0.1"

  vault_asg_name = "${module.vault_cluster.asg_name}"

  # ... See variables.tf for the other parameters you must define for the vault-cluster module
}

# Configure the Vault cluster to use the ELB
module "vault_cluster" {
  # Use version v0.0.1 of the vault-elb module
  source = "github.com/hashicorp/terraform-aws-vault//modules/vault-cluster?ref=v0.0.1"

  # ... (other params omitted) ...
}

Note the following parameters:

  • source: Use this parameter to specify the URL of the vault-elb module. The double slash (//) is intentional and required. Terraform uses it to specify subfolders within a Git repo (see module sources). The ref parameter specifies a specific Git tag in this repo. That way, instead of using the latest version of this module from the master branch, which will change every time you run Terraform, you're using a fixed version of the repo.

  • vault_asg_name: Setting this parameter to the name of the Autoscaling group created by the vault-cluster module tells it to register each server with the ELB when it is booting.

You can find the other parameters in variables.tf.

Check out the root example for working sample code.

How is the ELB configured?

The ELB in this module is configured as follows:

  1. TCP Passthrough: The ELB does NOT attempt to terminate SSL, as your Vault servers should do that themselves. This ensures that all Vault information is encrypted end-to-end, with no middle man (including AWS) able to read the contents. It also allows your Vault servers to do mutual TLS authentication so that Vault clients verify the server's certificate and the Vault server verifies the client's certificate.

  2. Listeners: The ELB only listens on one port (default: 443) and forwards the requests to Vault's API port (default: 8200).

  3. Health Check: The ELB uses the /sys/health endpoint on your Vault servers, with the standbyok flag set to true, as a health check endpoint. This way, the ELB will see any primary or standby Vault node that is unsealed as healthy and route traffic to it.

  4. DNS: If you set the create_dns_entry variable to true, this module will create a DNS A Record in Route 53 that points your specified domain_name at the ELB. This allows you to use this domain name to access the ELB. Note that the TLS certificate you use with Vault should be configured with this same domain name!

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?