https://pulumi.com logo
Title
g

gifted-vase-28337

10/08/2020, 12:41 AM
The
identifiers
argument to
aws.iam.GetPolicyDocumentStatementPrincipalArgs
expects
Sequence[str]
type, rejecting
Sequence[Output[str]]
. How can I use a resource output in generating an input to `aws.iam.GetPolicyDocumentStatementPrincipalArgs`'s
identifiers
argument?
pulumi.Output.concat
and
pulumi.Output.apply
both return
Output[str]
, an incompatible type to
str
(per mypy) that causes
panic: fatal: A failure has occurred: Unrecognized structpb value kind in RPC...
.
Two failing approaches:
identifiers=[pulumi.Output.apply(account.id, lambda id: f"arn:aws:iam::{id}:root")]
identifiers=[pulumi.Output.concat("arn:aws:iam::", account.id, ":root")]
l

lemon-agent-27707

10/08/2020, 12:48 AM
The approach here is to do your call to
GetPolicyDocument..()
from within an
All
or
Apply
call that coordinates and waits for the outputs you need. This will return a new output value that can be used elsewhere.
🙌 1
g

gifted-vase-28337

10/08/2020, 12:53 AM
Thanks Evan!
l

lemon-agent-27707

10/08/2020, 12:54 AM
😛artypus-8bit: Important to note that this approach is fine for getting resources. Get calls are synchronous and don't change the dependency graph. However, creating resources within Apply/All causes problems and should be avoided.
✔️ 1