From bbeb18ddbbee8e6fc1739054f637ce7d84278411 Mon Sep 17 00:00:00 2001 From: Charlie Voiselle <464492+angrycub@users.noreply.github.com> Date: Fri, 30 Aug 2019 11:24:34 -0400 Subject: [PATCH] Added vault PKI example with separate cert files --- .../docs/job-specification/template.html.md | 68 +++++++++++++++++-- 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/website/source/docs/job-specification/template.html.md b/website/source/docs/job-specification/template.html.md index 2edb4a0a9..6c86a93bf 100644 --- a/website/source/docs/job-specification/template.html.md +++ b/website/source/docs/job-specification/template.html.md @@ -237,14 +237,71 @@ DB_PASSWD={{ .Data.data.DB_PASSWD | toJSON }} {{ end }} ``` -For more details see [go-envparser's -README](https://github.com/hashicorp/go-envparse#readme). +For more details see [go-envparser's README][go-envparse]. ## Vault Integration ### PKI Certificate -This example acquires a PKI certificate from Vault in PEM format and stores it into your application's secret directory. +Vault is a popular open source tool for managing secrets. In addition to acting +as an encrypted KV store, Vault can also generate dynamic secrets, like PKI/TLS +certificates. + +When generating PKI certificates with Vault, the certificate, private key, and +any intermediate certs are all returned as part of the same API call. Most +software requires these files be placed in separate files on the system. + +~> **Note**: `generate_lease` must be set to `true` (non-default) on the Vault PKI +role.

Failure to do so will cause the template to frequently render a new +certificate, approximately every minute. This creates a significant number of +certificates to be expired in Vault and could ultimately lead to Vault performance +impacts and failures. + + +#### As individual files + +For templates, all dependencies are mapped into a single list. This means that +multiple templates watching the same path return the same data. + +```hcl +template { + data = <