Vault - How to store comma separated values or array using CLI

I want to store the comma-separated values like a list of IP addresses into Hashicorp Vault. I am using Consul as the backend for storage. Please let me know is it possible or not? If yes! let me know how to implement it.

Example scenario

IP = "125.2.4.1,122.56.3.2" (OR) IP = [125.2.4.1, 122.56.3.2]


Solution 1:

You can store arbitrary text into Vault, so sure!

If you just set the value as "125.2.4.1,122.56.3.2", then you can pull that same string out again later. You will simply have to interpret it as a list in your end-use case, whatever that might be.

$ vault kv put secret/ips ip="125.2.4.1,122.56.3.2"

Key              Value
---              -----
created_time     2020-07-06T23:20:03.250328Z
deletion_time    n/a
destroyed        false
version          1

$ vault kv get secret/ips

====== Metadata ======
Key              Value
---              -----
created_time     2020-07-06T23:20:03.250328Z
deletion_time    n/a
destroyed        false
version          1

===== Data =====
Key        Value
---        -----
ip         125.2.4.1,122.56.3.2

$ vault kv get -field=ip secret/ips

125.2.4.1,122.56.3.2