https://pulumi.com logo
Title
b

bland-pharmacist-96854

01/24/2023, 12:38 PM
this works well for values, but not for keys 😕
e

echoing-dinner-19531

01/24/2023, 12:50 PM
What's this being passed to?
You'll probably need to use
eks_cluster.eks_cluster.name.apply(helper)
to do this, where helper is a function that takes the name as a plain string and returns that dict object your constructing
b

bland-pharmacist-96854

01/24/2023, 2:08 PM
it is being passed to a iam policy
Full code, this should work, but it fills the role with the error shown in the second screenshot
e

echoing-dinner-19531

01/24/2023, 3:56 PM
You can't use 'f' strings with pulumi outputs.
you want something like:
assume_role_policy=eks_cluster.core.oidc_provider.url.apply(lambda url: json.dumps({ ....}),
I've also raised https://github.com/pulumi/pulumi/pull/11968 to see if we can do better at handling Outputs in dict keys.
g

gorgeous-minister-41131

01/24/2023, 10:01 PM
Nice. These would be really handy (OutputDicts) esp if they supported a lazy way to coexist with a normal dict. Could make common tagging that rely on some Outputs a bit easier in some of my pulumi codebases without having to send in the entire mutable object to a callback.
b

bland-pharmacist-96854

01/30/2023, 4:59 PM
@echoing-dinner-19531 is it possible to simplify that? What happens if inside the
assume_role_policy
I need more than one output?
e

echoing-dinner-19531

01/30/2023, 5:30 PM
For now, you'd have to use the
all
method to combine multiple outputs into one. But that PR has merged and will be in the next release (due this Wednesday v3.54) which should then let you just put output values as keys or values in dicts and pass that to
Output.jsonDumps
It's just test code not a real example but https://github.com/pulumi/pulumi/blob/master/sdk/python/lib/test/test_output.py#L390-L395 shows that this works