The `identifiers` argument to `aws.iam.GetPolicyDo...
# python
g
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:
Copy code
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
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
Thanks Evan!
l
partypus 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