serverless-vault-vars v0.1.0
Serverless-vault-vars
This plugin allows you to use Hashicorp vault secrets in your serverless.yml.
Configuration
Setup
In serverless.yml:
plugins:
- serverless-vault-varsVault address
By default the plugin will speak to a vault on http://localhost:8200. To use another url:
In your serverless.yml
custom:
vault_address: https://example.comVia environment variables (same as vault cli):
VAULT_ADDR=https://example.comPriority is: serverless.yml > environment variable > default value
Vault token
In your serverless.yml
custom:
vault_token: sometokenVia environment variables (same as vault cli):
VAULT_TOKEN=sometokenIn ~/.vault-token (same as vault cli):
sometokenPriority is: serverless.yml > environment variable > token file
Usage
Once you've configured the plugin, you can use vault vars by referencing them with the vault: prefix.
This should be followed by the secret's path, and then the key of the value you want as follows:
Gien the following vault secret:
path: secretapp/config
structure:
username: someusername
password: somepasswordTo get the info in your serverless yml:
custom:
username: ${vault:secretapp/config.username}
functions:
somefunction:
handler: x.handler
environment:
password: ${vault:secretapp/config.password}