https://pulumi.com logo
#getting-started
Title
# getting-started
b

better-umbrella-26052

02/03/2023, 7:51 PM
Please, I'm seeking help navigating documentation. I'm working with AWS and Python. In the same module, I want to create an IAM role and create an unrelated IAM policy with a statement allowing passing of the role. I just got smacked in the face with the problem that I cannot use an output from the role, specifically the arn, as a string in the policy. A coworker suggested an approach by writing a helper function that takes the role arn and a non-pulumi parameter with code like this:
Copy code
access_policy = aws.iam.Policy(
   name,
   path="/",
   description="description",
   policy=Output.all(config_data, other_role.arn,
        ).apply(generate_access_policy),
)
Where "config_data" is a non-pulumi object, other_role.arn is the output and generate_access_policy is the function which returns the json string for the policy. However, the documentation I found says that Output.all is used for grouping inputs (and Output.input_from). So, this doesn't seem to be the correct form. Where do I go in the documentation to find help in resolving this need?
e

echoing-dinner-19531

02/03/2023, 8:06 PM
Also lots of people find this blog post quite helpful: https://leebriggs.co.uk/blog/2021/05/09/pulumi-apply
b

better-umbrella-26052

02/03/2023, 8:30 PM
Thanks, @echoing-dinner-19531!
3 Views