passing array for endpoints with cli

565 views
Skip to first unread message

ngjin...@gmail.com

unread,
Aug 27, 2018, 10:37:39 PM8/27/18
to Vault
for an endpoint like auth/token/create which accepts array for 'policies', how do I pass in an array on the cli?

vault write auth/token/create policies="[policy1, policy2]" does seem to work

Chris Hoffman

unread,
Aug 27, 2018, 10:42:47 PM8/27/18
to Vault
You can pass repeating parameters and they will be collected together and passed as a list.

vault write auth/token/create policies=policy1 policies=policy2

Chris
On Aug 27, 2018, 10:37 PM -0400, ngjin...@gmail.com, wrote:
for an endpoint like auth/token/create which accepts array for 'policies', how do I pass in an array on the cli?

vault write auth/token/create policies="[policy1, policy2]" does seem to work

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/vault/issues
IRC: #vault-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Vault" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vault-tool+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vault-tool/ff13e442-4e66-4379-a5ac-611761783d24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vasilev Vjacheslav

unread,
Aug 28, 2018, 1:43:42 PM8/28/18
to Vault
It should be -policy ... -policy ...

Jeff Mitchell

unread,
Aug 28, 2018, 6:51:14 PM8/28/18
to Vault
HI Vasilev,

-policy is a flag particular to `vault token create`. Chris was showing the general case for generic `vault write` commands. In addition, most places in the API that can accept a JSON array will also accept a comma-delimited string, e.g. policies=foo,bar

Best,
Jeff

On Tue, Aug 28, 2018 at 10:43 AM Vasilev Vjacheslav <avo...@gmail.com> wrote:
It should be -policy ... -policy ...

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/vault/issues
IRC: #vault-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Vault" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vault-tool+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages