Skip to content

Support accessing all returned key/value pairs from secret provider plugins #27214

@Mongey

Description

@Mongey

Proposal

Nomad should provide a way for jobs to access all key/value pairs returned by a secret provider plugin, rather than requiring users to reference each key explicitly (e.g., ${secret.example.KNOWN_KEY}).

Secret provider plugins return a map under "result":
https://developer.hashicorp.com/nomad/plugins/author/secret-provider#secret-fetch

Example:

{
  "result": {
    "username": "",
    "password": "",
    "token": ""
  }
}

Nomad currently allows accessing only a single known key, and there is no mechanism to iterate over or consume the full map (AFAIK)

Use-cases

I want to inject all values from a secret backend into the environment.

image the following in ssm parameter store
/my-app/prd/database_url - psql://postgres:5432/a
/my-app/prd/smtp_password - example

I would want to be able have access to all of these variables without knowing what is there in the template.

template {
    data = "{{- range $k, $v := secret.app_secrets }}{{ $k }}=${{v}} {{- end -}}"
 
  }

Attempted Solutions

n/a

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Triaging

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions