feat: support for KV version 1 and custom-named engines (#12)

* feat: kv v1 and engine path

* doc: add custom version and engine path usage docs

Co-authored-by: Richard Simpson <richardsimpson@outlook.com>
This commit is contained in:
Giancarlo França 2020-02-04 12:40:55 -03:00 committed by GitHub
parent 3b9239de79
commit f229481670
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 465 additions and 139 deletions

View file

@ -1,6 +1,8 @@
# vault-action
A helper action for easily pulling secrets from the default v2 K/V backend of vault.
A helper action for easily pulling secrets from the K/V backend of vault.
Expects [Version 2](https://www.vaultproject.io/docs/secrets/kv/kv-v2/) of the KV Secrets Engine by default.
## Example Usage
@ -39,7 +41,7 @@ with:
url: https://vault.mycompany.com:8200
method: approle
roleId: ${{ secrets.roleId }}
secretId : ${{ secrets.secretId }}
secretId: ${{ secrets.secretId }}
```
## Key Syntax
@ -93,9 +95,33 @@ with:
ci/aws secretKey | AWS_SECRET_ACCESS_KEY
```
### Using K/V version 1
By default, `vault-action` expects a K/V engine using [version 2](https://www.vaultproject.io/docs/secrets/kv/kv-v2.html).
In order to work with a [v1 engine](https://www.vaultproject.io/docs/secrets/kv/kv-v1/), the `kv-version` parameter may be passed:
```yaml
with:
kv-version: 1
```
### Custom Engine Path
When you enable the K/V Engine, by default it's placed at the path `secret`, so a secret named `ci` will be accessed from `secret/ci`. However, [if you enabled the secrets engine using a custom `path`](https://www.vaultproject.io/docs/commands/secrets/enable/#inlinecode--path-4), you
can pass it as follows:
```yaml
with:
path: my-secrets
secrets: ci npmToken
```
This way, the `ci` secret in the example above will be retrieved from `my-secrets/ci`.
### Namespace
This action could be use with namespace Vault Enterprise feature. You can specify namespace in request :
This action could be use with namespace Vault Enterprise feature. You can specify namespace in request :
```yaml
steps: