https://pulumi.com logo
#python
Title
# python
c

crooked-pillow-11944

09/13/2021, 2:59 PM
Does somebody have an example of using
Output.all
with a list? The documentation says that you would use it's
Output
with an
.apply
but I'm uncertain of a practical application for this
f

full-artist-27215

09/13/2021, 3:06 PM
From our codebase:
Copy code
policy=pulumi.Output.all(*[t.arn for t in tables]).apply(
            lambda arns: json.dumps(
                {
                    "Version": "2012-10-17",
                    "Statement": [
                        {
                            "Effect": "Allow",
                            "Action": [
                                # Read
                                "dynamodb:BatchGetItem",
                                "dynamodb:GetRecords",
                                "dynamodb:GetShardIterator",
                                "dynamodb:Query",
                                "dynamodb:GetItem",
                                "dynamodb:Scan",
                                # Write
                                "dynamodb:BatchWriteItem",
                                "dynamodb:PutItem",
                                "dynamodb:UpdateItem",
                                "dynamodb:DeleteItem",
                            ],
                            "Resource": [a for a in arns],
                        }
                    ],
                }
            )
        ),
Though I suspect that final
[a for a in arns]
is a holdover from a prior refactoring... could probably just be
arns
at this point 😅
2 Views