Allows the retrieval, addition, modification and deletion of key/value entries in a Consul cluster via the agent or server.
The entire contents of the record, including the indices, flags and session are returned as value
.
When a value is removed, the existing value if any is returned as part of the results. This behavior is valid for non-recursive deletion.
See KV Store for more details.
- name: Set value
uses: blablacar/action-consul-kv@master
with:
key: foo
value: bar
- name: Get value
id: consul
uses: blablacar/action-consul-kv@master
with:
key: foo
- run: echo ${{ steps.consul.outputs.data }} # bar
The action to take with the supplied key and value.
If the state is present
and value
is set, the key contents will be set to the value supplied and changed
will be set to true
only if the value was different to the current contents.
If the state is present
and value
is not set, the existing value associated to the key will be returned.
The state absent
will remove the key/value pair, again 'changed' will be set to true only
if the key actually existed prior to the removal.
An attempt can be made to obtain or free the lock associated with a key/value pair with the states acquire
or attempt changed will be true if the attempt is successful, false otherwise.
Possible values are present
, absent
, acquire
and release
(acquire
and release
are experimental).
Default: present
.
Required The key at which the value should be stored.
The value should be associated with the given key, required if state
is present
.
Host of the consul agent.
Default: localhost
The port on which the consul agent is running.
Default: 8500
The protocol scheme on which the consul agent is running.
Default: http
Optional. Trusted certificates in PEM format.
Optional. The datacenter that this agent will communicate with. By default the datacenter of the host is used.
Optional. The token key identifying an ACL rule set that controls access to the key value pair.
If the key represents a prefix, each entry with the prefix can be retrieved by setting this to true
.
Default: false
If the state
is present
and value
is set, perform a read after setting the value and return this value.
Default: true
Experimental. The session that should be used to acquire or release a lock associated with a key/value pair.
Experimental.
Used when acquiring a lock with a session. If the cas
is 0
, then Consul will only put the key if it does not already exist.
If the cas
value is non-zero, then the key is only set if the index matches the ModifyIndex of that key.
Returns true
if the key or key value has been changed.
A string label to differentiate this status from the status of other systems. For recursive requests, contains a serialized object with k/v.
Optional, returned if the key exists.
Flags opaque to user, can be used by application. Optional.
ModifyIndex to block and wait for changes. Optional.
The scripts and documentation in this project are released under the MIT License