Reference » Services » Directory » Variable » Values Add
Adds a value to a variable. The value can be text or binary, it is stored and returned exactly as it is provided.
Permission Required
update
Command Line
NAME
add - Add a value
SYNOPSIS
conjur [global options] variable values add VARIABLE VALUE
Examples
Create and Populate a Variable
The value can either be specified as a command line argument, or it can be read from STDIN.
If the value is read from STDIN, it will have a newline terminator, which you should account for when you read the value out again.
$ conjur variable create -k password -m text/plain 64g700
<snip>
$ conjur variable value 64g700
error: 404 Resource Not Found
$ conjur variable values add 64g700 value-1
Value added
$ conjur variable value 64g700
value-1$ echo 'value-2' | conjur variable values add 64g700
Value added
$ conjur variable value 64g700
value-2
Manage Variable Permissions
# Create and populate new variable
# Create a new identity
# Login as the new identity and attempt to read the variable value; access is denied
# Grant 'execute' privilege on the variable to the new identity
# Demonstrate that the new identity can now read the variable value
$ variable=`conjur variable create -k password -m text/plain | jsonfield id`
<snip>
$ echo 'the-secret' | conjur variable values add $variable
Value added
$ conjur host create > host.json
$ host=`cat host.json | jsonfield id`
$ conjur authn login -p `cat host.json | jsonfield api_key` host/$host
$ conjur authn whoami
{"account":"demo","username":"host/76m256"}
$ conjur variable value $variable
error: 403 Forbidden
$ conjur authn login myself
$ conjur resource permit variable $variable host:$host execute
Permission granted
$ conjur authn login host/$host -p `cat host.json | jsonfield api_key`
$ conjur variable value $variable
the-secret