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
}
}