/concourse-consul-kv-resource

A Concourse resource for getting and setting values from with Consul's KV store

Primary LanguageJavaScript

Docker Automated build Build Status

concourse-consul-kv-resource

A Concourse resource for interacting with Consul's KV store.

concourse-consul-kv-resource can be used to get or set a key in Consul's KV store.

Source configuration

  • key: Required. The Consul key to interact with. Note that all URL path parts following /v1/kv are required. For example, if your key is my-consul:8500/v1/kv/my/key, then key should be "my/key".
  • host: Required. The Consul host.
  • token: Required. A Consul ACL token.
  • tls_cert: Required. A TLS cert for the Consul.
  • tls_key: Required. A TLS cert key for the Consul.
  • port: Optional. The port on which the Consul API is hosted. Defaults to 8500.
  • protocol: Optional. The protocol to use in calling the Consul API. Defaults to https.
  • skip_cert_check: Optional. Check the validity of the SSL cert.

Behavior

in: Get a Consul KV key's value

Gets the value of the Consul KV key configured in the source.

out: Set a Consul KV key's value

Sets the Consul KV key configured in the source to the value specified in the params.

Parameters

value or file must be set. Both cannot be set.

  • value: Optional. The value to set the key to.
  • file: Optional. The path to a file in which the intended value is written.

Example pipeline

resources:

- name: my-consul-key
  type: consul-kv
  source:
    token: my-acl-token
    host: my-consul.com
    tls_cert: my-cert-string
    tls_key: my-cert-key-string
    key: my/key

resource_types:

- name: consul-kv
  type: docker-image
  source:
    repository: clapclapexcitement/concourse-consul-kv-resource
    tag: latest

jobs:

- name: set-my-consul-key
  plan:
  - put: my-consul-key
    params:
      value: 'foobar'

- name: set-my-consul-key-from-a-file
  plan:
  - put: my-consul-key
    params:
      file: my-new-key/my-key-file