I am struggling with using Output in a string used...
# python
p
I am struggling with using Output in a string used as an input for another resource. I have an Account, whose id I need when creating an IAM policy document:
Copy code
aws.iam.GroupPolicy(f'assume-{self.nickname.lower()}-{role}-role',
                                    name=f'assume{role}role',
                                    group=group,
                                    policy=account.id.apply(lambda account_id: f'''
{{
  "Version": "2012-10-17",
  "Statement": [
    {{
      "Action": [
        "sts:*"
      ],
      "Resource": "arn:aws:iam::{account_id}:role/{role}",
      "Effect": "Allow"
    }}
  ]
}}'''),
                                    opts=ResourceOptions(depends_on=[account]))
role
is a regular string.
group
is another resource. Thanks in advance!
c
If you are waiting on two different resources you could do
Pulumi.Output.All(resource1.id, resource2.id).Apply(lambda args: f"""{args[0]]:{args[1]}""")
p
The
group
is not in the string I am constructing, but it is a parameter to
GroupPolicy
and should be implicitly waited for.