Hashicorp Vault Resource for Concourse.
Important: Currently, the vault-resource operates on the KV Secret Engine v1 ONLY.
-
url
: RequiredURL of Vault
-
role_id
: RequiredThis is the approle id. The role_id can be obtained by running
vault read auth/approle/<my-role>/role-id
-
secret_id
: RequiredThis is the secret id of the approle. The secret_id can be obtained by running
vault write -f auth/approle/role/<my-role>/secret-id
-
path
: RequiredThe path of the secret in vault. For example,
/secret/ci/my-secret
-
tarball
: OptionalThis is a boolean value and defaults to
false
. See the behavior for more details. This feature was added so that directories with secrets like certs, keys and other sensitive information can be stored easily in vault. For example, secrets generated by bosh-bootloader. -
ca_cert
: OptionalThe CA certificate of the Vault server can be provided if you are working with a self-signed CA Vault server. The certificate contents can be provided as a source variable and will be written to file for the Vault client to use.
resource_types:
- name: vault
type: docker-image
source:
repository: wfernandes/vault-resource
tag: latest
resources:
- name: vault-datadog-api-key
type: vault
source:
url: ((vault.url))
role_id: ((vault.role_id))
secret_id: ((vault.secret_id))
path: /secret/ci/datadog-api-key
ca_cert: ((vault.ca_cert))
Fetch a secret,
plan:
- get: team-datadog-api-key
trigger: true
Push a secret,
- put: vault-datadog-api-key
params:
data: vault-test-output
See tests/pipeline.yml for a full example.
-
check:
Reports the sha256 hash of the contents of the secret as the version. That is, for the secret
/secret/ci/my-secret
there is a key/value pairfoo=bar
, the version will be thesha256sum
hash of the json payload{"foo":"bar}
. This is done because currently, this resource only supports version 1 of the KV secret engine. -
in:
If
tarball: false
,It puts the value of each key in a separate file within the destination directory. So if the secret had the following contents in json format,
{ "foo": "bar", "some/path/key": "some-value" }
The destination directory would contain a file called
foo
with the contents ofbar
and another file at the path ofsome/path/key
containing the value ofsome-value
.If
tarball: true
,It expects a key called
tarball
and it extracts the contents of the tarball within the destination directory. -
out:
If
tarball: false
,It converts each file and its contents into key/value pair respectively. For example, if the
path: secret/ci/my-secret
and the source directory contains the following structure,. ├── foo └── some └── path └── to └── secret └── ca.crt
Then the keys put under
secret/ci/my-secret
would befoo
andsome/path/to/secret/ca.crt
with the contents of the file as the values.If
tarball: true
,It
tar
's up all the contents of the source directory and puts it under the keytarball
.