Skip to content

PROPOSAL: dagger.#JsonSecret is a high-level wrapper to #TransformSecret #1497

@talentedmrjones

Description

@talentedmrjones

As discussed in #1429 we need some high-level wrappers to ease the entry into #TransformSecret. This is a proposal for the design of dagger.#JsonSecret (I'm not attached to names at this point, open/happy to consider other suggestions)

package dagger

import (
  "encoding/json"
)

#JsonSecrets: #TransformSecret: {
  #function: {
    input: _
    output: json.Unmarshal(input)
  }
}

To use it:

dagger.#Plan & {
  inputs: secrets: jsonStuff: {
    command: {
      name: "aws-vault"
      args: ["exec", "--json", "profileName"]
    }
  }

  actions: {
    jsonStuff: dagger.#JsonSecrets & {
      input: inputs.secrets.sopsStuff
    }

    // we can now reference jsonStuff.output.AwsAccessKey.contents
  }
}

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions