sparse-intern-71089
11/12/2021, 11:47 AMhappy-parrot-60128
11/12/2021, 12:02 PMpulumi.all
helper to work with a list of outputs e.g.
let var3 = pulumi
.all(props.secret.map((secret) => gcp.secretmanager.getSecret({ secretId: `${secret}*` })))
.apply((secrets) => secrets.map((s) => s.name));
This makes the type of var3
an Output<string[]>
. You can then use this as an input to another resource, or use another .apply(...)
to manipulate it further. Does that help?square-coat-62279
11/12/2021, 12:15 PMhappy-parrot-60128
11/12/2021, 12:16 PMsquare-coat-62279
11/12/2021, 1:52 PMhappy-parrot-60128
11/12/2021, 1:59 PMsquare-coat-62279
11/12/2021, 2:01 PMhappy-parrot-60128
11/12/2021, 2:03 PMstring[]
?square-coat-62279
11/12/2021, 2:14 PMhappy-parrot-60128
11/12/2021, 2:21 PMsecrets
? It should be something like pulumi.UnwrappedObject<gcp.secretmanager.GetSecretResult>[]
happy-parrot-60128
11/12/2021, 3:01 PMprops.secret
- and therefore the input to pulumi.all isn't nailed down either. You could try manually specifying the type first e.g. let secret: string[] = props.secret
square-coat-62279
11/12/2021, 3:43 PMdata: var2.map(p => ({
"key": p,
"name": p,
"version": "latest"
})),
the objective is to loop through the item in the array and create a new array that looks like this:
data:
- key: secret1
name: secret1
version: latest
- key: secret2
name: secret2
version: latest
square-coat-62279
11/12/2021, 4:56 PMhappy-parrot-60128
11/12/2021, 5:33 PMsquare-coat-62279
11/13/2021, 10:26 AMhappy-parrot-60128
11/15/2021, 10:31 AM