• HashiCorp Developer

  • HashiCorp Cloud Platform
  • Terraform
  • Packer
  • Consul
  • Vault
  • Boundary
  • Nomad
  • Waypoint
  • Vagrant
Nomad
  • Install
  • Intro
  • Tutorials
  • Documentation
  • API
  • Tools
  • Plugins
  • Sign up
Nomad Home

Documentation

Skip to main contentOverview

    • Overview
    • agent
    • agent-info
    • fmt
    • monitor
    • status
    • ui
      • Overview
      • get
      • init
      • list
      • put
      • purge
    • version

  • Schedulers

  • Nomad Ecosystem
  • Nomad Partnerships
  • Who Uses Nomad
  • FAQ

  • Resources

  • Tutorial Library
  • Community Forum
    (opens in new tab)
  • Support
    (opens in new tab)
  • GitHub
    (opens in new tab)
  1. Developer
  2. Nomad
  3. Documentation
  4. Commands (CLI)
  5. var
  • Nomad
  • v1.3.x
  • v1.2.x
  • v1.1.x
  • v1.0.x
  • v0.12.x
  • v0.11.x

»Command: var

The var command is used to interact with Nomad variables.

Usage

Usage: nomad var <subcommand> [options] [args]

Run nomad var <subcommand> -h for help on that subcommand. The following subcommands are available:

  • var init - Create a variable specification file
  • var list - List variables the user has access to
  • var get - Retrieve a variable
  • var put - Insert or update a variable
  • var purge - Permanently delete a variable

Examples

Create or update the variable stored at the path "secret/creds", which contains an item named passcode with the value my-long-passcode.

$ nomad var put -out=table secret/creds passcode=my-long-passcode
Successfully created variable "secret/creds"!

Namespace   = default
Path        = secret/creds
Create Time = 2022-08-23T11:14:37-04:00
Check Index = 116

Items
passcode = my-long-passcode

Update a value:

$ nomad var get secret/creds | nomad var put -in=json -out=table -v - user=dba
Reading whole JSON variable specification from stdin
Successfully updated variable "secret/creds"!

Namespace   = default
Path        = secret/creds
Create Time = 2022-08-23T11:14:37-04:00
Check Index = 116

Items
passcode = my-long-passcode
user     = dba
Edit this page on GitHub

On this page

  1. Command: var
  2. Usage
  3. Examples
Give Feedback(opens in new tab)
  • Certifications
  • System Status
  • Terms of Use
  • Security
  • Privacy
  • Trademark Policy
  • Trade Controls
  • Give Feedback(opens in new tab)